package Q5;

import android.view.View;
import androidx.leanback.widget.C0455b;
import androidx.leanback.widget.I;
import c7.InterfaceC0597e;
import com.martsnew.domain.type.MediaType;
import com.martsnew.tv.R;
import com.martsnew.tv.ui.mylist.TvMyListFragment;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import n4.u0;
import u5.K0;
import y5.x;

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

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

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

    public /* synthetic */ b(TvMyListFragment tvMyListFragment, int i) {
        this.f5835q = i;
        this.f5836r = tvMyListFragment;
    }

    @Override // c7.InterfaceC0597e
    public final Object l(Object obj, E6.d dVar) {
        A6.n nVar = A6.n.f457a;
        TvMyListFragment tvMyListFragment = this.f5836r;
        switch (this.f5835q) {
            case u0.f15495q /* 0 */:
                List list = (List) obj;
                if (list != null) {
                    int i = TvMyListFragment.f11189L1;
                    tvMyListFragment.K0().f17602M.b();
                    if (list.isEmpty()) {
                        tvMyListFragment.V0(false);
                        tvMyListFragment.U0(false);
                        tvMyListFragment.W0(false);
                        View view = tvMyListFragment.X;
                        K0 k02 = tvMyListFragment.f11192K1;
                        W2.g.H(view, k02 != null ? k02.f6656z : null);
                    } else {
                        ArrayList arrayList = new ArrayList(B6.m.a0(list));
                        Iterator it = list.iterator();
                        while (true) {
                            boolean zHasNext = it.hasNext();
                            C0455b c0455b = tvMyListFragment.f18986B1;
                            if (zHasNext) {
                                A6.h hVar = (A6.h) it.next();
                                c0455b.f();
                                C0455b c0455b2 = new C0455b((x) tvMyListFragment.f11191J1.getValue());
                                c0455b2.e(0, (Collection) hVar.f447r);
                                arrayList.add(new I(new B3.f(4, tvMyListFragment.t(hVar.f446q == MediaType.f11105r ? R.string.title_movies : R.string.title_tv_series)), c0455b2));
                            } else {
                                c0455b.e(0, arrayList);
                                tvMyListFragment.W0(false);
                            }
                        }
                    }
                }
                return nVar;
            case 1:
                l lVar = (l) obj;
                if (!P6.g.a(lVar, i.f5847a)) {
                    if (lVar instanceof j) {
                        tvMyListFragment.R0(((j) lVar).f5848a);
                    } else {
                        if (!(lVar instanceof k)) {
                            throw new A6.b();
                        }
                        tvMyListFragment.S0(((k) lVar).f5849a);
                    }
                }
                return nVar;
            default:
                int i5 = TvMyListFragment.f11189L1;
                tvMyListFragment.W0(false);
                tvMyListFragment.V0(false);
                tvMyListFragment.U0(true);
                return nVar;
        }
    }
}
