package mf;

import android.app.Activity;
import android.content.res.Resources;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.bumptech.glide.u;
import ie.s1;
import ie.y2;
import java.util.ArrayList;
import org.drive_hunter.R;
import xyz.stream.api.entity.LeagueEntity;
import xyz.stream.view.OnItemListener;
import xyz.stream.view.SingleTypeAdapter;
import xyz.stream.view.UiUtils;

/* JADX INFO: loaded from: classes3.dex */
public final class j extends SingleTypeAdapter {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ int f30689b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f30690c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ j(int i10, Activity activity, ArrayList arrayList) {
        super(arrayList, activity);
        this.f30689b = i10;
        this.f30690c = -1;
    }

    public static /* synthetic */ void e(j jVar, int i10, y2 y2Var, View view, boolean z10) {
        if (z10) {
            OnItemListener onItemListener = jVar.onItemListener;
            if (onItemListener != null) {
                onItemListener.onItemFocus(view, i10);
            }
            y2Var.f27736b.setTextColor(jVar.context.getResources().getColor(R.color.white));
            return;
        }
        jVar.getClass();
        y2Var.f27736b.setTextColor(jVar.context.getResources().getColor(i10 == jVar.f30690c ? R.color.main_color : R.color.black_9));
    }

    public static /* synthetic */ void f(j jVar, int i10, LeagueEntity leagueEntity, s1 s1Var, View view, boolean z10) {
        if (z10) {
            OnItemListener onItemListener = jVar.onItemListener;
            if (onItemListener != null) {
                onItemListener.onItemFocus(view, i10);
            }
            if (leagueEntity.getId().intValue() == 0) {
                UiUtils.setSvgPicture(s1Var.f27474b, R.drawable.all_league, Integer.valueOf(R.color.white));
            }
            s1Var.f27475c.setTextColor(jVar.context.getResources().getColor(R.color.white));
            return;
        }
        jVar.getClass();
        if (leagueEntity.getId().intValue() == 0) {
            UiUtils.setSvgPicture(s1Var.f27474b, R.drawable.all_league, Integer.valueOf(jVar.f30690c == i10 ? R.color.main_color : R.color.white));
        }
        TextView textView = s1Var.f27475c;
        int i11 = jVar.f30690c;
        Resources resources = jVar.context.getResources();
        textView.setTextColor(i10 == i11 ? resources.getColor(R.color.main_color) : resources.getColor(R.color.white));
    }

    @Override // xyz.stream.view.SingleTypeAdapter
    public final v3.a createBinding(ViewGroup viewGroup) {
        switch (this.f30689b) {
            case 0:
                return s1.inflate(this.context.getLayoutInflater(), viewGroup, false);
            default:
                return y2.inflate(this.context.getLayoutInflater(), viewGroup, false);
        }
    }

    @Override // xyz.stream.view.SingleTypeAdapter
    public final void onBindData(v3.a aVar, Object obj, int i10) {
        switch (this.f30689b) {
            case 0:
                s1 s1Var = (s1) aVar;
                LeagueEntity leagueEntity = (LeagueEntity) obj;
                s1Var.f27475c.setText(leagueEntity.getName());
                ConstraintLayout constraintLayout = s1Var.f27473a;
                u uVarE = com.bumptech.glide.c.e(constraintLayout);
                ImageView imageView = s1Var.f27474b;
                uVarE.f(imageView);
                if (leagueEntity.getId().intValue() == 0) {
                    UiUtils.setSvgPicture(imageView, R.drawable.all_league, Integer.valueOf((this.f30690c != i10 || constraintLayout.hasFocus()) ? R.color.white : R.color.main_color));
                } else if (leagueEntity.getIcon() == null || leagueEntity.getIcon().intValue() == 0) {
                    com.bumptech.glide.c.c(this.context).load(leagueEntity.getLogo()).y(imageView);
                } else {
                    imageView.setImageResource(leagueEntity.getIcon().intValue());
                }
                int i11 = this.f30690c;
                TextView textView = s1Var.f27475c;
                if (i10 == i11) {
                    textView.setTypeface(null, 1);
                    textView.setTextColor(constraintLayout.hasFocus() ? this.context.getResources().getColor(R.color.white) : this.context.getResources().getColor(R.color.main_color));
                } else {
                    textView.setTypeface(null, 0);
                    textView.setTextColor(this.context.getResources().getColor(R.color.white));
                }
                constraintLayout.setOnFocusChangeListener(new we.a(this, i10, leagueEntity, s1Var, 6));
                break;
            default:
                y2 y2Var = (y2) aVar;
                String str = (String) obj;
                if (kotlinx.coroutines.flow.h.G(str)) {
                    y2Var.f27736b.setText(this.context.getString(R.string.today));
                } else {
                    y2Var.f27736b.setText(kotlinx.coroutines.flow.h.k(str, "yyyy-MM-dd", "MMM dd"));
                }
                if (i10 == this.f30690c) {
                    y2Var.f27736b.setTypeface(null, 1);
                    y2Var.f27736b.setTextColor(y2Var.f27735a.hasFocus() ? this.context.getResources().getColor(R.color.white) : this.context.getResources().getColor(R.color.main_color));
                } else {
                    y2Var.f27736b.setTypeface(null, 0);
                    y2Var.f27736b.setTextColor(this.context.getResources().getColor(R.color.black_9));
                }
                y2Var.f27735a.setOnFocusChangeListener(new oe.h(this, i10, y2Var, 21));
                break;
        }
    }

    public final void setSelectedPosition(int i10) {
        switch (this.f30689b) {
            case 0:
                int i11 = this.f30690c;
                this.f30690c = i10;
                if (i11 != -1) {
                    notifyItemChanged(i11);
                }
                notifyItemChanged(i10);
                break;
            default:
                int i12 = this.f30690c;
                this.f30690c = i10;
                if (i12 != -1) {
                    notifyItemChanged(i12);
                }
                notifyItemChanged(i10);
                break;
        }
    }
}
