package com.ss.android.ugc.aweme.mix.mixdetail;

import X.0C0;
import X.0CH;
import X.0HH;
import X.2Pr;
import X.2uR;
import X.2uW;
import X.2uX;
import X.2uk;
import X.2ul;
import X.2um;
import X.2uq;
import X.2us;
import X.3QV;
import X.3c7;
import X.3c9;
import X.3cA;
import X.3cC;
import X.3cI;
import X.3cN;
import X.3cO;
import X.3cP;
import X.3cQ;
import X.3cR;
import X.3cS;
import X.4EW;
import X.4FQ;
import X.4HR;
import X.4hP;
import X.A7H;
import X.ARD;
import X.ARE;
import X.ARO;
import X.ARP;
import X.AW0;
import X.AW2;
import X.AW4;
import X.AW5;
import X.AW7;
import X.AWB;
import X.AWD;
import X.AWE;
import X.AWF;
import X.AWG;
import X.AWI;
import X.AWJ;
import X.AWS;
import X.C1149AUf;
import X.C1168AUy;
import X.C1192AVw;
import X.C1193AVx;
import X.C2188AoK;
import X.C3251BDb;
import X.Csa;
import X.Css;
import X.Cuh;
import X.Cus;
import X.Cv8;
import X.Cvh;
import X.CwK;
import X.CwU;
import X.Cwc;
import X.Cwf;
import X.D1G;
import X.KEM;
import X.LsC;
import X.LsD;
import X.LsE;
import X.LsF;
import X.Lsh;
import X.M12;
import X.PHD;
import android.content.Context;
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.assem.arch.core.Assembler;
import com.bytedance.assem.arch.viewModel.AssemViewModel;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment;
import com.ss.android.ugc.aweme.mix.mixdetail.viewmodel.MixVideosManageViewModel;
import com.ss.android.ugc.aweme.mix.services.MixFeedService;
import kotlin.h.b.n;

public final class MixFeedManagerFragment extends AmeBaseFragment implements ARE {
    public static final AWJ LJIIJ = new AWJ((byte) 0);
    public 3c7 LIZ;
    public 2um LIZIZ;
    public String LIZJ = "";
    public String LIZLLL = "";
    public boolean LJ;
    public long LJIIIZ = 300;
    public final Csa LJIIJJI;
    public SparseArray LJIIL;

    static {
        Covode.recordClassIndex(92472);
    }

    public final MixVideosManageViewModel LIZ() {
        return (MixVideosManageViewModel) this.LJIIJJI.getValue();
    }

    public final 0CH getActualLifecycleOwner() {
        ARD.LIZIZ(this);
        return this;
    }

    public final Cv8 getActualLifecycleOwnerHolder() {
        ARD.LIZ(this);
        return this;
    }

    public final 4hP getActualReceiver() {
        ARD.LIZLLL(this);
        return this;
    }

    public final Cuh<4hP> getActualReceiverHolder() {
        ARD.LIZJ(this);
        return this;
    }

    public final 0CH getHostLifecycleOwner() {
        M12.LIZ(this);
        return null;
    }

    public final 0CH getOwnLifecycleOwner() {
        ARD.LJ(this);
        return this;
    }

    public final 4hP getReceiverForHostVM() {
        M12.LIZ(this);
        return null;
    }

    public final boolean getUniqueOnlyDefault() {
        return ARD.LJFF(this);
    }

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        SparseArray sparseArray = this.LJIIL;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public MixFeedManagerFragment() {
        D1G LIZ2 = KEM.LIZ.LIZ(MixVideosManageViewModel.class);
        this.LJIIJJI = new Csa(LIZ2, new ARO(LIZ2), Css.LIZ, C2188AoK.LIZ((0CH) this, true), C2188AoK.LIZ((0C0) this, true), A7H.LIZ, ARP.INSTANCE);
    }

    public final void LIZIZ() {
        Context context = getContext();
        if (context == null) {
            n.LIZIZ();
        }
        n.LIZIZ(context, "");
        4EW r2 = new 4EW(context);
        r2.LIZJ(2131823813);
        r2.LIZLLL(2131823812);
        3QV.LIZ(r2, new AW2(this));
        4FQ.LIZ(r2.LIZ().LIZJ());
    }

    public final void onResume() {
        MixFeedManagerFragment.super.onResume();
        View view = getView();
        if (view == null) {
            n.LIZIZ();
        }
        n.LIZIZ(view, "");
        view.setFocusableInTouchMode(true);
        View view2 = getView();
        if (view2 == null) {
            n.LIZIZ();
        }
        view2.requestFocus();
        View view3 = getView();
        if (view3 == null) {
            n.LIZIZ();
        }
        view3.setOnKeyListener(new AW0(this));
    }

    public static final /* synthetic */ 2um LIZ(MixFeedManagerFragment mixFeedManagerFragment) {
        2um r1 = mixFeedManagerFragment.LIZIZ;
        if (r1 == null) {
            n.LIZ("");
        }
        return r1;
    }

    public static final /* synthetic */ 3c7 LIZIZ(MixFeedManagerFragment mixFeedManagerFragment) {
        3c7 r1 = mixFeedManagerFragment.LIZ;
        if (r1 == null) {
            n.LIZ("");
        }
        return r1;
    }

    public final void LIZ(boolean z) {
        LIZ().LIZ(z);
        if (z) {
            3c7 r1 = this.LIZ;
            if (r1 == null) {
                n.LIZ("");
            }
            r1.LIZ("cancel_text", 3cP.LIZ);
            3c7 r12 = this.LIZ;
            if (r12 == null) {
                n.LIZ("");
            }
            r12.LIZ("edit_playlist_text", new 2uW(this));
            3c7 r13 = this.LIZ;
            if (r13 == null) {
                n.LIZ("");
            }
            r13.LIZ("done_text", 3cQ.LIZ);
            3c7 r14 = this.LIZ;
            if (r14 == null) {
                n.LIZ("");
            }
            r14.LIZ("back_btn", 3cN.LIZ);
        } else {
            3c7 r15 = this.LIZ;
            if (r15 == null) {
                n.LIZ("");
            }
            r15.LIZ("cancel_text", 3cR.LIZ);
            3c7 r16 = this.LIZ;
            if (r16 == null) {
                n.LIZ("");
            }
            r16.LIZ("edit_playlist_text", new 2uX(this));
            3c7 r17 = this.LIZ;
            if (r17 == null) {
                n.LIZ("");
            }
            r17.LIZ("done_text", 3cS.LIZ);
            3c7 r18 = this.LIZ;
            if (r18 == null) {
                n.LIZ("");
            }
            r18.LIZ("back_btn", 3cO.LIZ);
        }
        if (z) {
            2um r0 = this.LIZIZ;
            if (r0 == null) {
                n.LIZ("");
            }
            r0.getEditMixLayout().setVisibility(0);
            2um r02 = this.LIZIZ;
            if (r02 == null) {
                n.LIZ("");
            }
            r02.getRemoveConfirmView().setVisibility(8);
            return;
        }
        2um r03 = this.LIZIZ;
        if (r03 == null) {
            n.LIZ("");
        }
        r03.getEditMixLayout().setVisibility(8);
        2um r04 = this.LIZIZ;
        if (r04 == null) {
            n.LIZ("");
        }
        r04.getRemoveConfirmView().setVisibility(0);
    }

    public final <VM1 extends AssemViewModel<S1>, S1 extends 4HR, R> R LIZ(VM1 vm1, LsC<? super S1, ? extends R> lsC) {
        M12.LIZ(vm1, lsC);
        return ARD.LIZ(this, vm1, lsC);
    }

    public final void onViewCreated(View view, Bundle bundle) {
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        3c7 findViewById = view.findViewById(2131367675);
        n.LIZIZ(findViewById, "");
        3c7 r8 = findViewById;
        this.LIZ = r8;
        if (r8 == null) {
            n.LIZ("");
        }
        2uR r7 = new 2uR();
        3cA r1 = new 3cA();
        r1.LIZ(2131755170);
        r1.LIZIZ = false;
        r1.LIZ("back_btn");
        r1.LJ = false;
        r1.LIZ(new AW4(this));
        r7.LIZ(new 3cI[]{r1});
        3cI[] r5 = new 3cI[1];
        3c9 r3 = new 3c9();
        Context context = getContext();
        if (context == null) {
            n.LIZIZ();
        }
        n.LIZIZ(context, "");
        String string = context.getResources().getString(2131822315);
        n.LIZIZ(string, "");
        r3.LIZ(string);
        r3.LIZ("cancel_text");
        r3.LIZJ = true;
        r3.LIZ(new C1193AVx(this));
        r5[0] = r3;
        r7.LIZ(r5);
        3cC r32 = new 3cC();
        Context context2 = getContext();
        if (context2 == null) {
            n.LIZIZ();
        }
        n.LIZIZ(context2, "");
        String string2 = context2.getResources().getString(2131824437);
        n.LIZIZ(string2, "");
        r32.LIZ(string2);
        r32.LIZ("edit_playlist_text");
        r7.LIZ(r32);
        3cI[] r52 = new 3cI[1];
        3c9 r4 = new 3c9();
        Context context3 = getContext();
        if (context3 == null) {
            n.LIZIZ();
        }
        n.LIZIZ(context3, "");
        String string3 = context3.getResources().getString(2131824001);
        n.LIZIZ(string3, "");
        r4.LIZ(string3);
        r4.LIZJ = false;
        r4.LIZ("done_text");
        r52[0] = r4;
        r7.LIZIZ(r52);
        r8.setNavActions(r7);
        3c7 r0 = this.LIZ;
        if (r0 == null) {
            n.LIZ("");
        }
        View LIZ2 = r0.LIZ("done_text");
        if (LIZ2 != null && LIZ2.getVisibility() == 0) {
            Cus.LIZ(this, LIZ(), AWB.LIZ, (Cvh) null, new C1192AVw(this), 6);
        }
        3c7 r02 = this.LIZ;
        if (r02 == null) {
            n.LIZ("");
        }
        View LIZ3 = r02.LIZ("done_text");
        if (LIZ3 != null) {
            Boolean.valueOf(LIZ3.isEnabled());
        }
        3c7 r12 = this.LIZ;
        if (r12 == null) {
            n.LIZ("");
        }
        r12.LIZ("done_text", new AW7(this));
        C3251BDb.LIZ((Fragment) this, (LsC<? super Assembler, 2Pr>) new AW5(this));
        2um findViewById2 = view.findViewById(2131367674);
        n.LIZIZ(findViewById2, "");
        2um r03 = findViewById2;
        this.LIZIZ = r03;
        if (r03 == null) {
            n.LIZ("");
        }
        r03.getRemoveView().setOnClickListener(new AWI(this));
        2um r04 = this.LIZIZ;
        if (r04 == null) {
            n.LIZ("");
        }
        r04.getRemoveConfirmView().setOnClickListener(new C1149AUf(this));
        2um r05 = this.LIZIZ;
        if (r05 == null) {
            n.LIZ("");
        }
        r05.getAddVideoView().setOnClickListener(new AWS(this));
        Cus.LIZ(this, LIZ(), AWD.LIZ, AWF.LIZ, (Cvh) null, new 2uk(this), 12);
        2us r13 = new 2us();
        r13.element = MixFeedService.LJIIIIZZ().LIZLLL();
        Cus.LIZ(this, LIZ(), C1168AUy.LIZ, AWE.LIZ, (Cvh) null, new 2uq(this, r13), 12);
        Cus.LIZ(this, LIZ(), AWG.LIZ, (Cvh) null, new 2ul(this), 6);
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        Bundle arguments = getArguments();
        if (arguments != null) {
            String string = arguments.getString("key_mix_id");
            String str = "";
            if (string == null) {
                string = str;
            }
            this.LIZJ = string;
            String string2 = arguments.getString("enter_from");
            if (string2 != null) {
                str = string2;
            }
            this.LIZLLL = str;
        }
        return 0HH.LIZ(layoutInflater, 2131559741, viewGroup, false);
    }

    public final <S extends 4HR> void subscribe(AssemViewModel<S> assemViewModel, Cvh<S> cvh, LsC<? super Throwable, 2Pr> lsC, LsD<? super 4hP, ? super S, 2Pr> lsD) {
        M12.LIZ(assemViewModel, cvh, lsD);
        ARD.LIZ(this, assemViewModel, cvh, lsC, lsD);
    }

    public final <S extends 4HR, A> void selectSubscribe(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, Cvh<CwK<A>> cvh, LsC<? super Throwable, 2Pr> lsC, LsD<? super 4hP, ? super A, 2Pr> lsD) {
        M12.LIZ(assemViewModel, phd, cvh, lsD);
        ARD.LIZ(this, assemViewModel, phd, cvh, lsC, lsD);
    }

    public final <S extends 4HR, A> void selectSubscribeOnAsync(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, Cvh<CwK<A>> cvh, LsC<? super Throwable, 2Pr> lsC, LsD<? super 4hP, ? super A, 2Pr> lsD) {
        M12.LIZ(assemViewModel, phd, cvh, lsD);
        ARD.LIZIZ(this, assemViewModel, phd, cvh, lsC, lsD);
    }

    public final <S extends 4HR, A, B> void selectSubscribe(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, Cvh<CwU<A, B>> cvh, LsC<? super Throwable, 2Pr> lsC, LsE<? super 4hP, ? super A, ? super B, 2Pr> lsE) {
        M12.LIZ(assemViewModel, phd, phd2, cvh, lsE);
        ARD.LIZ(this, assemViewModel, phd, phd2, cvh, lsC, lsE);
    }

    public final <S extends 4HR, A, B, C> void selectSubscribe(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, Cvh<Cwc<A, B, C>> cvh, LsC<? super Throwable, 2Pr> lsC, LsF<? super 4hP, ? super A, ? super B, ? super C, 2Pr> lsF) {
        LsF<? super 4hP, ? super A, ? super B, ? super C, 2Pr> lsF2 = lsF;
        AssemViewModel<S> assemViewModel2 = assemViewModel;
        PHD<S, ? extends A> phd4 = phd;
        PHD<S, ? extends B> phd5 = phd2;
        PHD<S, ? extends C> phd6 = phd3;
        Cvh<Cwc<A, B, C>> cvh2 = cvh;
        M12.LIZ(assemViewModel2, phd4, phd5, phd6, cvh2, lsF2);
        ARD.LIZ(this, assemViewModel2, phd4, phd5, phd6, cvh2, lsC, lsF2);
    }

    public final <S extends 4HR, A, B, C, D> void selectSubscribe(AssemViewModel<S> assemViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, PHD<S, ? extends D> phd4, Cvh<Cwf<A, B, C, D>> cvh, LsC<? super Throwable, 2Pr> lsC, Lsh<? super 4hP, ? super A, ? super B, ? super C, ? super D, 2Pr> lsh) {
        Lsh<? super 4hP, ? super A, ? super B, ? super C, ? super D, 2Pr> lsh2 = lsh;
        AssemViewModel<S> assemViewModel2 = assemViewModel;
        PHD<S, ? extends A> phd5 = phd;
        PHD<S, ? extends B> phd6 = phd2;
        PHD<S, ? extends C> phd7 = phd3;
        PHD<S, ? extends D> phd8 = phd4;
        Cvh<Cwf<A, B, C, D>> cvh2 = cvh;
        M12.LIZ(assemViewModel2, phd5, phd6, phd7, phd8, cvh2, lsh2);
        ARD.LIZ(this, assemViewModel2, phd5, phd6, phd7, phd8, cvh2, lsC, lsh2);
    }
}
