package com.ss.android.ugc.aweme.favorites.ui;

import X.0C0;
import X.0CH;
import X.0HH;
import X.1hK;
import X.2Pr;
import X.2cN;
import X.3S8;
import X.5Am;
import X.5An;
import X.5vY;
import X.5wO;
import X.7he;
import X.A7H;
import X.B8T;
import X.C2188AoK;
import X.C2440AsO;
import X.C2449AsX;
import X.C2460Asi;
import X.C2465Asn;
import X.C2475Asx;
import X.C2476Asy;
import X.C2478At0;
import X.C2480At2;
import X.C2482At4;
import X.C2494AtG;
import X.C2517Atd;
import X.Crj;
import X.Csa;
import X.Css;
import X.Csw;
import X.Csy;
import X.Cwt;
import X.D1G;
import X.D4t;
import X.DRZ;
import X.DUT;
import X.DUy;
import X.DUz;
import X.DV9;
import X.DVU;
import X.KEM;
import X.LsC;
import X.LsD;
import X.LsE;
import X.LsF;
import X.Lsh;
import X.M12;
import X.Mjy;
import X.PHD;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.jedi.arch.JediViewModel;
import com.bytedance.tux.sheet.sheet.TuxSheet;
import com.ss.android.ugc.aweme.favorites.viewmodel.VideoCollectionListViewModel;
import kotlin.h.b.n;

public final class VideoCollectionChooseCollectionSheetFragment extends Fragment implements 5vY, C2517Atd, C2494AtG {
    public static final C2475Asx LIZIZ = new C2475Asx((byte) 0);
    public C2465Asn LIZ;
    public final Crj LIZJ = 7he.LIZ(C2482At4.LIZ);
    public SparseArray LIZLLL;

    static {
        Covode.recordClassIndex(75821);
    }

    public final Mjy LIZJ() {
        return (Mjy) this.LIZJ.getValue();
    }

    public final boolean getUniqueOnlyGlobal() {
        return true;
    }

    public final /* bridge */ /* synthetic */ 5An getReceiver() {
        return this;
    }

    public final 0CH getLifecycleOwner() {
        5wO.LIZJ(this);
        return this;
    }

    public final DUz getLifecycleOwnerHolder() {
        5wO.LIZ(this);
        return this;
    }

    public final DUy<DVU> getReceiverHolder() {
        5wO.LIZIZ(this);
        return this;
    }

    public final void onDestroyView() {
        VideoCollectionChooseCollectionSheetFragment.super.onDestroyView();
        LIZJ().LIZ();
        SparseArray sparseArray = this.LIZLLL;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final void LIZ() {
        String str;
        C2449AsX asX = new C2449AsX();
        Bundle arguments = getArguments();
        if (arguments != null) {
            str = arguments.getString("enterFrom");
        } else {
            str = null;
        }
        asX.LIZ(str);
        asX.LJFF();
        1hK activity = getActivity();
        if (activity != null) {
            n.LIZIZ(activity, "");
            new C2476Asy(this, new C2460Asi(this, activity)).invoke();
        }
    }

    public final void LIZIZ() {
        Csa csa;
        String str;
        Csy csy = Csy.LIZ;
        D1G LIZ2 = KEM.LIZ.LIZ(VideoCollectionListViewModel.class);
        C2478At0 at0 = new C2478At0(LIZ2);
        C2480At2 at2 = C2480At2.INSTANCE;
        if (n.LIZ(csy, Csw.LIZ)) {
            csa = new Csa(LIZ2, at0, Css.LIZ, C2188AoK.LIZ((0CH) this, true), C2188AoK.LIZ((0C0) this, true), A7H.LIZ, at2, C2188AoK.LIZ((Fragment) this, true), C2188AoK.LIZIZ((Fragment) this, true));
        } else if (csy != null && !n.LIZ(csy, Csy.LIZ)) {
            throw new IllegalArgumentException("Do not support this scope here.");
        } else {
            csa = new Csa(LIZ2, at0, Css.LIZ, C2188AoK.LIZ((0CH) this, false), C2188AoK.LIZ((0C0) this, false), A7H.LIZ, at2, C2188AoK.LIZ((Fragment) this, false), C2188AoK.LIZIZ((Fragment) this, false));
        }
        VideoCollectionListViewModel videoCollectionListViewModel = (VideoCollectionListViewModel) csa.getValue();
        Bundle arguments = getArguments();
        if (arguments != null) {
            str = arguments.getString("excludeId");
        } else {
            str = null;
        }
        videoCollectionListViewModel.LIZ(true, str, false);
    }

    public final void LIZ(C2465Asn asn) {
        M12.LIZ(asn);
        this.LIZ = asn;
    }

    public final void LIZ(C2440AsO asO) {
        M12.LIZ(asO);
        C2465Asn asn = this.LIZ;
        if (asn != null) {
            asn.LIZ(false, asO);
        }
        3S8.LIZ(TuxSheet.LJIJI, this);
    }

    public final <VM1 extends JediViewModel<S1>, S1 extends 5Am, R> R withState(VM1 vm1, LsC<? super S1, ? extends R> lsC) {
        M12.LIZ(vm1, lsC);
        return 5wO.LIZ(vm1, lsC);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:3:0x0014, code lost:
        if (r0 == null) goto L_0x0016;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onViewCreated(android.view.View r9, android.os.Bundle r10) {
        /*
            r8 = this;
            X.M12.LIZ(r9)
            android.os.Bundle r1 = r8.getArguments()
            r7 = 0
            if (r1 == 0) goto L_0x00d9
            java.lang.String r0 = "moveToCollection"
            boolean r0 = r1.getBoolean(r0)
            java.lang.Boolean r0 = java.lang.Boolean.valueOf(r0)
            if (r0 != 0) goto L_0x0019
        L_0x0016:
            kotlin.h.b.n.LIZIZ()
        L_0x0019:
            boolean r2 = r0.booleanValue()
            r1 = 1131413504(0x43700000, float:240.0)
            android.content.res.Resources r0 = android.content.res.Resources.getSystem()
            java.lang.String r5 = ""
            kotlin.h.b.n.LIZIZ(r0, r5)
            android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
            r3 = 1
            float r0 = android.util.TypedValue.applyDimension(r3, r1, r0)
            int r6 = X.LnI.LIZ(r0)
            r1 = 1114636288(0x42700000, float:60.0)
            android.content.res.Resources r0 = android.content.res.Resources.getSystem()
            kotlin.h.b.n.LIZIZ(r0, r5)
            android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
            float r0 = android.util.TypedValue.applyDimension(r3, r1, r0)
            int r4 = X.LnI.LIZ(r0)
            r1 = 1117782016(0x42a00000, float:80.0)
            android.content.res.Resources r0 = android.content.res.Resources.getSystem()
            kotlin.h.b.n.LIZIZ(r0, r5)
            android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
            float r0 = android.util.TypedValue.applyDimension(r3, r1, r0)
            int r3 = X.LnI.LIZ(r0)
            android.os.Bundle r1 = r8.getArguments()
            if (r1 == 0) goto L_0x0071
            java.lang.String r0 = "firstPageCount"
            int r0 = r1.getInt(r0)
            java.lang.Integer r7 = java.lang.Integer.valueOf(r0)
            if (r7 != 0) goto L_0x0074
        L_0x0071:
            kotlin.h.b.n.LIZIZ()
        L_0x0074:
            int r1 = r7.intValue()
            r0 = r2 ^ 1
            int r1 = r1 + r0
            int r3 = r3 * r1
            int r4 = r4 + r3
            int r4 = java.lang.Math.max(r6, r4)
            android.view.ViewGroup$LayoutParams r3 = r9.getLayoutParams()
            X.1hK r0 = r8.requireActivity()
            kotlin.h.b.n.LIZIZ(r0, r5)
            android.content.res.Resources r0 = r0.getResources()
            kotlin.h.b.n.LIZIZ(r0, r5)
            android.util.DisplayMetrics r0 = r0.getDisplayMetrics()
            if (r0 == 0) goto L_0x00d7
            int r0 = r0.heightPixels
        L_0x009b:
            float r1 = (float) r0
            r0 = 1060320051(0x3f333333, float:0.7)
            float r1 = r1 * r0
            int r0 = (int) r1
            int r0 = java.lang.Math.min(r0, r4)
            r3.height = r0
            r9.setLayoutParams(r3)
            r0 = 2131371242(0x7f0a24ea, float:1.8362513E38)
            android.view.View r1 = r9.findViewById(r0)
            android.widget.TextView r1 = (android.widget.TextView) r1
            if (r2 == 0) goto L_0x00d3
            r0 = 2131824965(0x7f111145, float:1.9282773E38)
        L_0x00b8:
            r1.setText(r0)
            r0 = 2131363121(0x7f0a0531, float:1.8346042E38)
            android.view.View r1 = r9.findViewById(r0)
            X.At1 r0 = new X.At1
            r0.<init>(r8)
            r1.setOnClickListener(r0)
            X.AtI r0 = new X.AtI
            r0.<init>(r8, r2, r9)
            X.C3251BDb.LIZ((androidx.fragment.app.Fragment) r8, (X.LsC<? super com.bytedance.assem.arch.core.Assembler, X.2Pr>) r0)
            return
        L_0x00d3:
            r0 = 2131824940(0x7f11112c, float:1.9282722E38)
            goto L_0x00b8
        L_0x00d7:
            r0 = 0
            goto L_0x009b
        L_0x00d9:
            r0 = r7
            goto L_0x0016
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.favorites.ui.VideoCollectionChooseCollectionSheetFragment.onViewCreated(android.view.View, android.os.Bundle):void");
    }

    public final <S extends 5Am> 2cN subscribe(JediViewModel<S> jediViewModel, DUT<S> dut, LsD<? super DVU, ? super S, 2Pr> lsD) {
        M12.LIZ(jediViewModel, dut, lsD);
        return 5wO.LIZ(this, jediViewModel, dut, lsD);
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        return 0HH.LIZ(layoutInflater, 2131559682, viewGroup, false);
    }

    public final <S extends 5Am, A> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, DUT<DRZ<A>> dut, LsD<? super DVU, ? super A, 2Pr> lsD) {
        M12.LIZ(jediViewModel, phd, dut, lsD);
        return 5wO.LIZ(this, jediViewModel, phd, dut, lsD);
    }

    public final <S extends 5Am, A, B> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, DUT<Cwt<A, B>> dut, LsE<? super DVU, ? super A, ? super B, 2Pr> lsE) {
        M12.LIZ(jediViewModel, phd, phd2, dut, lsE);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, dut, lsE);
    }

    public final <S extends 5Am, T> 2cN asyncSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends B8T<? extends T>> phd, DUT<DRZ<B8T<T>>> dut, LsD<? super DVU, ? super Throwable, 2Pr> lsD, LsC<? super DVU, 2Pr> lsC, LsD<? super DVU, ? super T, 2Pr> lsD2) {
        M12.LIZ(jediViewModel, phd, dut);
        return 5wO.LIZ(this, jediViewModel, phd, dut, lsD, lsC, lsD2);
    }

    public final <S extends 5Am, A, B, C> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, DUT<DV9<A, B, C>> dut, LsF<? super DVU, ? super A, ? super B, ? super C, 2Pr> lsF) {
        M12.LIZ(jediViewModel, phd, phd2, phd3, dut, lsF);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, phd3, dut, lsF);
    }

    public final <S extends 5Am, A, B, C, D> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, PHD<S, ? extends D> phd4, DUT<D4t<A, B, C, D>> dut, Lsh<? super DVU, ? super A, ? super B, ? super C, ? super D, 2Pr> lsh) {
        M12.LIZ(jediViewModel, phd, phd2, phd3, phd4, dut, lsh);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, phd3, phd4, dut, lsh);
    }
}
