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

import X.0C0;
import X.0CH;
import X.1hK;
import X.2GO;
import X.2HZ;
import X.2Pr;
import X.2cN;
import X.2nK;
import X.2uR;
import X.30I;
import X.30J;
import X.367;
import X.3DR;
import X.3QV;
import X.3cC;
import X.4Dd;
import X.4EV;
import X.4EW;
import X.4FQ;
import X.4HR;
import X.4hP;
import X.4uX;
import X.7he;
import X.A7H;
import X.ARD;
import X.ARE;
import X.C2188AoK;
import X.C2386ArW;
import X.C2387ArX;
import X.C2388ArY;
import X.C2389ArZ;
import X.C2391Arb;
import X.C2392Arc;
import X.C2393Ard;
import X.C2397Arh;
import X.C2400Ark;
import X.C2401Arl;
import X.C2597Auv;
import X.C2619AvH;
import X.C3251BDb;
import X.C6391CZv;
import X.Crj;
import X.Csa;
import X.Css;
import X.Csw;
import X.Csy;
import X.Cuh;
import X.Cv8;
import X.Cvh;
import X.CwK;
import X.CwU;
import X.CwZ;
import X.Cwc;
import X.Cwf;
import X.Cwu;
import X.D1G;
import X.ISm;
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.Mk2;
import X.Mk3;
import X.OQg;
import X.PHD;
import X.PhE;
import X.PlI;
import X.Rc9;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.View;
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.favorites.page.BasePage;
import com.ss.android.ugc.aweme.favorites.viewmodel.VideoCollectionContentViewModel;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import java.util.HashMap;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

@C6391CZv
public final class VideoAllFavoriteContentFragment extends BasePage implements ARE, C2619AvH, 2HZ, 2GO {
    public Long LJ;
    public final Crj LJFF = 7he.LIZ(C2391Arb.LIZ);
    public final Csa LJI;
    public SparseArray LJII;

    static {
        Covode.recordClassIndex(75784);
    }

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

    public final View LIZ(int i) {
        if (this.LJII == null) {
            this.LJII = new SparseArray();
        }
        View view = (View) this.LJII.get(i);
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJII.put(i, findViewById);
        return findViewById;
    }

    public final VideoCollectionContentViewModel LIZIZ() {
        return (VideoCollectionContentViewModel) this.LJI.getValue();
    }

    public final int LIZLLL() {
        return 2131559681;
    }

    public final void LJI() {
        SparseArray sparseArray = this.LJII;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(312, new Rc9(VideoAllFavoriteContentFragment.class, "handleOnOperationEvent", C2400Ark.class, ThreadMode.POSTING, 0, false));
        return hashMap;
    }

    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 void onDestroyView() {
        super.onDestroyView();
        LIZ().LIZ();
        EventBus.LIZ().LIZIZ(this);
        LJI();
    }

    private final void LJIIIZ() {
        2cN LIZ = new C2597Auv().LIZLLL.LIZ(2).LIZIZ(PhE.LIZIZ(PlI.LIZJ)).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C2401Arl(this), C2392Arc.LIZ);
        n.LIZIZ(LIZ, "");
        4Dd.LIZ(LIZ, LIZ());
    }

    public VideoAllFavoriteContentFragment() {
        Csa csa;
        Csy csy = Csy.LIZ;
        D1G LIZ = KEM.LIZ.LIZ(VideoCollectionContentViewModel.class);
        C2386ArW arW = new C2386ArW(LIZ);
        C2388ArY arY = C2388ArY.INSTANCE;
        if (n.LIZ(csy, Csw.LIZ)) {
            csa = new Csa(LIZ, arW, Css.LIZ, C2188AoK.LIZ((0CH) this, true), C2188AoK.LIZ((0C0) this, true), A7H.LIZ, arY, 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(LIZ, arW, Css.LIZ, C2188AoK.LIZ((0CH) this, false), C2188AoK.LIZ((0C0) this, false), A7H.LIZ, arY, C2188AoK.LIZ((Fragment) this, false), C2188AoK.LIZIZ((Fragment) this, false));
        }
        this.LJI = csa;
    }

    public final void LIZJ() {
        String valueOf;
        Resources resources;
        Resources resources2;
        CharSequence charSequence = null;
        if (this.LJ != null) {
            StringBuilder sb = new StringBuilder();
            Context context = getContext();
            if (!(context == null || (resources2 = context.getResources()) == null)) {
                charSequence = resources2.getText(2131824974);
            }
            sb.append(charSequence);
            sb.append(" (");
            sb.append(this.LJ);
            sb.append(')');
            valueOf = sb.toString();
        } else {
            Context context2 = getContext();
            if (!(context2 == null || (resources = context2.getResources()) == null)) {
                charSequence = resources.getText(2131824974);
            }
            valueOf = String.valueOf(charSequence);
        }
        3cC r0 = new 3cC();
        r0.LIZ(valueOf);
        LIZ(2131371289).LIZ(r0);
    }

    @ISm
    public final void handleOnOperationEvent(C2400Ark ark) {
        M12.LIZ(ark);
        if (ark.LIZ.LIZ == 3) {
            LIZIZ().LIZJ(true);
            LJIIIZ();
        }
    }

    public final void LIZ(Aweme aweme) {
        M12.LIZ(aweme);
        1hK activity = getActivity();
        if (activity != null) {
            n.LIZIZ(activity, "");
            2nK.LIZ("remove_unavailable_from_collection", new Cwu[]{CwZ.LIZ("collection_video", "enter_from")});
            4EW r2 = new 4EW(activity);
            r2.LIZ(false);
            r2.LIZ(activity.getResources().getString(2131824984));
            r2.LIZLLL(2131824982);
            3QV.LIZ(r2, new C2397Arh(this, activity, aweme));
            4FQ.LIZ(new 4EV(r2).LIZJ());
        }
    }

    public final void LIZ(View view, Aweme aweme) {
        M12.LIZ(view, aweme);
        VideoCollectionContentViewModel LIZIZ = LIZIZ();
        C2393Ard ard = new C2393Ard(this, view, aweme);
        M12.LIZ(LIZIZ, ard);
        ARD.LIZ(this, LIZIZ, ard);
    }

    public final void onViewCreated(View view, Bundle bundle) {
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        LIZJ();
        C3251BDb.LIZ((Fragment) this, (LsC<? super Assembler, 2Pr>) new 4uX(this, view));
        LJIIIZ();
        2uR r2 = new 2uR();
        367.LIZ(r2, "", new C2387ArX(this));
        LIZ(2131371289).setNavActions(r2);
        OQg findViewById = view.findViewById(2131370625);
        Context context = view.getContext();
        VideoCollectionContentViewModel LIZIZ = LIZIZ();
        PHD phd = C2389ArZ.LIZ;
        30I r7 = new 30I(findViewById, context);
        AssemViewModel.asyncSubscribe$default(LIZIZ, phd, (Cvh) null, new 3DR(this, findViewById), new 30J(findViewById), r7, 2, (Object) null);
        EventBus.LIZ(EventBus.LIZ(), this);
    }

    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);
    }
}
