package p000if;

import android.app.Activity;
import android.view.KeyEvent;
import android.view.View;
import androidx.recyclerview.widget.j2;
import jf.i;
import kotlinx.coroutines.y;
import org.drive_hunter.R;
import re.a;
import xyz.netfly.ui.live.tv.LiveActivity;
import xyz.stream.api.entity.LiveChannelEntity;
import xyz.stream.api.entity.TagLiveEntity;
import xyz.stream.view.OnItemListener;
import xyz.stream.view.UiUtils;

/* JADX INFO: loaded from: classes3.dex */
public final class h implements OnItemListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ j f27819a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ j2 f27821c;

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ k f27823e;

    public h(int i10, j2 j2Var, j jVar, k kVar, i iVar) {
        this.f27823e = kVar;
        this.f27819a = jVar;
        this.f27820b = iVar;
        this.f27821c = j2Var;
        this.f27822d = i10;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // xyz.stream.view.OnItemListener
    public final void onItemClick(View view, int i10) {
        super.onItemClick(view, i10);
        LiveChannelEntity liveChannelEntity = (LiveChannelEntity) this.f27820b.getItem(i10);
        if (liveChannelEntity == null) {
            return;
        }
        int iIntValue = liveChannelEntity.getCategoryId().intValue();
        k kVar = this.f27823e;
        j2 j2Var = this.f27821c;
        int tagId = this.f27822d;
        int iA = kVar.a(j2Var, tagId);
        if (iA != -1) {
            tagId = ((TagLiveEntity) kVar.f27831b.get(iA)).getTagId();
        }
        if (tagId == -1) {
            iIntValue = -1;
        } else if (tagId == -2) {
            iIntValue = -2;
        }
        LiveChannelEntity liveChannelEntityH = a.u().h(liveChannelEntity.getId().intValue());
        Activity activity = kVar.f27830a;
        if (liveChannelEntityH == null) {
            UiUtils.showTip(activity, activity.getString(R.string.no_video_source));
            return;
        }
        a.u().getClass();
        if (a.t(liveChannelEntityH) > 1) {
            y.a0(activity);
        } else {
            LiveActivity.S(activity, liveChannelEntity, iIntValue);
        }
    }

    @Override // xyz.stream.view.OnItemListener
    public final void onItemFocus(View view, int i10) {
        this.f27823e.getClass();
    }

    @Override // xyz.stream.view.OnItemListener
    public final boolean onItemKey(View view, int i10, KeyEvent keyEvent, int i11) {
        int iA;
        if (i10 == 19 || i10 == 20) {
            this.f27819a.f27829b.f26685c.scrollToPosition(0);
        }
        if (UiUtils.isDpadRight(i10) && keyEvent.getAction() == 0 && i11 == this.f27820b.getItemCount() - 1) {
            return true;
        }
        k kVar = this.f27823e;
        if (kVar.f27834e == null || (iA = kVar.a(this.f27821c, this.f27822d)) == -1) {
            return false;
        }
        return kVar.f27834e.e(view, i10, keyEvent, iA, i11);
    }
}
