package mf;

import android.app.Activity;
import android.view.LayoutInflater;
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.q2;
import ie.t1;
import ie.w2;
import java.util.List;
import kotlinx.coroutines.y;
import org.drive_hunter.R;
import xyz.stream.api.entity.LeagueEntity;
import xyz.stream.api.entity.MatchChannelEntity;
import xyz.stream.api.entity.MatchEntity;
import xyz.stream.view.OnItemListener;
import xyz.stream.view.RoundImageView;
import xyz.stream.view.SingleTypeAdapter;

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ k(int i10, Activity activity, List list) {
        super(list, activity);
        this.f30691b = i10;
    }

    public static void e(k kVar, int i10, w2 w2Var, View view, boolean z10) {
        if (!z10) {
            kVar.getClass();
            w2Var.f27627h.setSelected(false);
            w2Var.f27624e.setBackgroundResource(R.color.transparent);
            y.l0(w2Var.f27620a);
            return;
        }
        OnItemListener onItemListener = kVar.onItemListener;
        if (onItemListener != null) {
            onItemListener.onItemFocus(view, i10);
        }
        w2Var.f27627h.setSelected(true);
        w2Var.f27624e.setBackgroundResource(R.drawable.shape_radius_white_4_24);
        y.k0(1.07f, w2Var.f27620a);
    }

    public static void f(k kVar, q2 q2Var, int i10, boolean z10) {
        if (!z10) {
            kVar.getClass();
            q2Var.f27386c.setSelected(false);
        } else {
            OnItemListener onItemListener = kVar.onItemListener;
            if (onItemListener != null) {
                onItemListener.onItemFocus(q2Var.f27384a, i10);
            }
            q2Var.f27386c.setSelected(true);
        }
    }

    @Override // xyz.stream.view.SingleTypeAdapter
    public final v3.a createBinding(ViewGroup viewGroup) {
        switch (this.f30691b) {
            case 0:
                return q2.inflate(LayoutInflater.from(viewGroup.getContext()), viewGroup, false);
            case 1:
                return t1.inflate(this.context.getLayoutInflater(), viewGroup, false);
            default:
                return w2.inflate(this.context.getLayoutInflater(), viewGroup, false);
        }
    }

    @Override // xyz.stream.view.SingleTypeAdapter
    public final void onBindData(v3.a aVar, Object obj, int i10) {
        switch (this.f30691b) {
            case 0:
                q2 q2Var = (q2) aVar;
                MatchChannelEntity matchChannelEntity = (MatchChannelEntity) obj;
                q2Var.f27386c.setText(matchChannelEntity.getName());
                String icon = matchChannelEntity.getIcon();
                TextView textView = q2Var.f27386c;
                ConstraintLayout constraintLayout = q2Var.f27384a;
                RoundImageView roundImageView = q2Var.f27385b;
                if (icon == null || matchChannelEntity.getIcon().isEmpty()) {
                    roundImageView.setVisibility(8);
                    textView.setTextAlignment(4);
                } else {
                    roundImageView.setVisibility(0);
                    com.bumptech.glide.c.e(constraintLayout).load(matchChannelEntity.getIcon()).y(roundImageView);
                    textView.setTextAlignment(2);
                }
                constraintLayout.setOnFocusChangeListener(new oe.h(this, q2Var, i10, 19));
                break;
            case 1:
                t1 t1Var = (t1) aVar;
                LeagueEntity leagueEntity = (LeagueEntity) obj;
                if (leagueEntity != null) {
                    t1Var.f27494c.setVisibility(8);
                    t1Var.f27495d.setText(leagueEntity.getName());
                    Integer icon2 = leagueEntity.getIcon();
                    RoundImageView roundImageView2 = t1Var.f27493b;
                    if (icon2 == null || leagueEntity.getIcon().intValue() == 0) {
                        com.bumptech.glide.c.c(this.context).load(leagueEntity.getLogo()).y(roundImageView2);
                    } else {
                        roundImageView2.setImageResource(leagueEntity.getIcon().intValue());
                    }
                } else {
                    t1Var.f27494c.setVisibility(0);
                }
                break;
            default:
                w2 w2Var = (w2) aVar;
                MatchEntity matchEntity = (MatchEntity) obj;
                if (matchEntity != null) {
                    w2Var.f27624e.setVisibility(0);
                    w2Var.f27625f.setVisibility(8);
                    ConstraintLayout constraintLayout2 = w2Var.f27620a;
                    u uVarE = com.bumptech.glide.c.e(constraintLayout2);
                    ImageView imageView = w2Var.f27622c;
                    uVarE.f(imageView);
                    u uVarE2 = com.bumptech.glide.c.e(constraintLayout2);
                    ImageView imageView2 = w2Var.f27623d;
                    uVarE2.f(imageView2);
                    com.bumptech.glide.c.e(constraintLayout2).load(matchEntity.getTeam1Logo()).y(imageView);
                    com.bumptech.glide.c.e(constraintLayout2).load(matchEntity.getTeam2Logo()).y(imageView2);
                    w2Var.f27627h.setText(matchEntity.getTeam1Name() + " vs. " + matchEntity.getTeam2Name());
                    w2Var.f27626g.setText(kotlinx.coroutines.flow.h.k(matchEntity.getTime(), "yyyy-MM-dd HH:mm:ss", "EEE, MMM dd HH:mm a"));
                    constraintLayout2.setOnFocusChangeListener(new oe.h(this, i10, w2Var, 22));
                } else {
                    w2Var.f27624e.setVisibility(8);
                    w2Var.f27625f.setVisibility(0);
                }
                break;
        }
    }
}
