package G5;

import android.view.View;
import androidx.leanback.widget.C0455b;
import androidx.leanback.widget.I;
import c7.InterfaceC0597e;
import com.martsnew.tv.R;
import com.martsnew.tv.ui.history.TvHistoryFragment;
import java.util.List;
import n4.u0;
import u5.D0;
import y5.x;

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

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

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

    public /* synthetic */ c(TvHistoryFragment tvHistoryFragment, int i) {
        this.f2983q = i;
        this.f2984r = tvHistoryFragment;
    }

    @Override // c7.InterfaceC0597e
    public final Object l(Object obj, E6.d dVar) {
        A6.n nVar = A6.n.f457a;
        TvHistoryFragment tvHistoryFragment = this.f2984r;
        switch (this.f2983q) {
            case u0.f15495q /* 0 */:
                List list = (List) obj;
                if (list != null) {
                    if (list.isEmpty()) {
                        int i = TvHistoryFragment.f11150N1;
                        tvHistoryFragment.Z0();
                    } else {
                        C0455b c0455b = new C0455b((x) tvHistoryFragment.f11152J1.getValue());
                        c0455b.e(0, list);
                        I i5 = new I(new B3.f(4, tvHistoryFragment.t(R.string.title_history)), c0455b);
                        C0455b c0455b2 = tvHistoryFragment.f18986B1;
                        c0455b2.f();
                        c0455b2.f8626c.add(0, i5);
                        c0455b2.f8479a.f(0, 1);
                        View view = tvHistoryFragment.X;
                        D0 d02 = tvHistoryFragment.f11153K1;
                        W2.g.H(view, d02 != null ? d02.f6656z : null);
                        tvHistoryFragment.W0(false);
                    }
                }
                return nVar;
            case 1:
                m mVar = (m) obj;
                if (!P6.g.a(mVar, j.f2995a)) {
                    if (mVar instanceof k) {
                        tvHistoryFragment.R0(((k) mVar).f2996a);
                    } else {
                        if (!(mVar instanceof l)) {
                            throw new A6.b();
                        }
                        tvHistoryFragment.S0(((l) mVar).f2997a);
                    }
                }
                return nVar;
            default:
                int i8 = TvHistoryFragment.f11150N1;
                tvHistoryFragment.W0(false);
                tvHistoryFragment.V0(false);
                tvHistoryFragment.U0(true);
                return nVar;
        }
    }
}
