package C5;

import android.view.View;
import android.widget.ImageView;
import androidx.leanback.widget.C0455b;
import androidx.leanback.widget.I;
import c7.InterfaceC0597e;
import com.martsnew.tv.R;
import com.martsnew.tv.ui.continuewatch.TvContinueWatchFragment;
import java.util.List;
import n4.u0;
import u5.C0;
import u5.K0;
import y5.x;

/* JADX INFO: loaded from: classes.dex */
public final class d implements InterfaceC0597e {

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

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final /* synthetic */ TvContinueWatchFragment f1346r;

    public /* synthetic */ d(TvContinueWatchFragment tvContinueWatchFragment, int i) {
        this.f1345q = i;
        this.f1346r = tvContinueWatchFragment;
    }

    @Override // c7.InterfaceC0597e
    public final Object l(Object obj, E6.d dVar) {
        ImageView imageView;
        A6.n nVar = A6.n.f457a;
        TvContinueWatchFragment tvContinueWatchFragment = this.f1346r;
        switch (this.f1345q) {
            case u0.f15495q /* 0 */:
                List list = (List) obj;
                if (list != null) {
                    int i = TvContinueWatchFragment.f11137M1;
                    tvContinueWatchFragment.K0().f17602M.b();
                    if (list.isEmpty()) {
                        tvContinueWatchFragment.V0(false);
                        tvContinueWatchFragment.U0(false);
                        tvContinueWatchFragment.W0(false);
                        C0 c02 = tvContinueWatchFragment.f11141L1;
                        if (c02 != null && (imageView = c02.f17524K) != null) {
                            imageView.requestFocus();
                        }
                        View view = tvContinueWatchFragment.X;
                        K0 k02 = tvContinueWatchFragment.f11140K1;
                        W2.g.H(view, k02 != null ? k02.f6656z : null);
                    } else {
                        C0455b c0455b = new C0455b((x) tvContinueWatchFragment.f11139J1.getValue());
                        c0455b.e(0, list);
                        I i5 = new I(new B3.f(4, tvContinueWatchFragment.t(R.string.title_continue_watch)), c0455b);
                        C0455b c0455b2 = tvContinueWatchFragment.f18986B1;
                        c0455b2.f8626c.add(0, i5);
                        c0455b2.f8479a.f(0, 1);
                        tvContinueWatchFragment.W0(false);
                    }
                }
                return nVar;
            case 1:
                n nVar2 = (n) obj;
                if (!P6.g.a(nVar2, k.f1357a)) {
                    if (nVar2 instanceof l) {
                        tvContinueWatchFragment.R0(((l) nVar2).f1358a);
                    } else {
                        if (!(nVar2 instanceof m)) {
                            throw new A6.b();
                        }
                        tvContinueWatchFragment.S0(((m) nVar2).f1359a);
                    }
                }
                return nVar;
            default:
                int i8 = TvContinueWatchFragment.f11137M1;
                tvContinueWatchFragment.W0(false);
                tvContinueWatchFragment.V0(false);
                tvContinueWatchFragment.U0(true);
                return nVar;
        }
    }
}
