package com.ss.android.ugc.aweme.relation.ffp.ui;

import X.0C0;
import X.0CH;
import X.2cN;
import X.2uR;
import X.3ae;
import X.3c7;
import X.3cA;
import X.3cC;
import X.3cI;
import X.4Dd;
import X.A7H;
import X.C1216AWu;
import X.C1980Aky;
import X.C2021Ald;
import X.C2022Ale;
import X.C2023Alf;
import X.C2024Alg;
import X.C2026Ali;
import X.C2027Alj;
import X.C2028Alk;
import X.C2029All;
import X.C2030Alm;
import X.C2031Aln;
import X.C2033Alp;
import X.C2034Alq;
import X.C2035Alr;
import X.C2036Als;
import X.C2037Alt;
import X.C2039Alv;
import X.C2041Alx;
import X.C2188AoK;
import X.Csa;
import X.Csc;
import X.Css;
import X.Csw;
import X.Csy;
import X.Cus;
import X.Cva;
import X.D1G;
import X.JdA;
import X.KEM;
import X.M12;
import X.Mjy;
import X.Mk2;
import X.Mk3;
import android.content.Context;
import android.content.res.Resources;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.View;
import android.widget.FrameLayout;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.relation.ffp.vm.FFPMainFragmentVM;
import com.ss.android.ugc.aweme.relation.ffp.vm.FindFriendsPageVM;
import java.util.concurrent.TimeUnit;
import kotlin.h.b.n;

public final class FFPMainFragment extends FFPBaseFragment {
    public Fragment LJ;
    public Fragment LJFF;
    public final Csc LJI;
    public final Csa LJII;
    public C2026Ali LJIIIIZZ;
    public 3c7 LJIIIZ;
    public final Mjy LJIIJ;
    public final int LJIIJJI;
    public SparseArray LJIIL;

    static {
        Covode.recordClassIndex(102956);
    }

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

    public final FindFriendsPageVM LIZ() {
        return (FindFriendsPageVM) this.LJI.getValue();
    }

    public final FFPMainFragmentVM LIZIZ() {
        return (FFPMainFragmentVM) this.LJII.getValue();
    }

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

    public final int LIZJ() {
        return this.LJIIJJI;
    }

    public final void onDestroyView() {
        super.onDestroyView();
        this.LJIIJ.LIZ();
        LJI();
    }

    public final void LJII() {
        super.LJII();
        Cus.LIZ(this, LIZIZ(), C1216AWu.LIZ, Cva.LIZJ(), new C2021Ald(this), 4);
    }

    public final boolean LJIIIIZZ() {
        Fragment LIZ = getChildFragmentManager().LIZ(2131363283);
        Fragment fragment = this.LJFF;
        if (!(LIZ instanceof SearchResultFragment) || fragment == null) {
            return false;
        }
        C2026Ali ali = this.LJIIIIZZ;
        if (ali == null) {
            n.LIZ("");
        }
        ali.LIZ();
        LIZIZ().LIZ(JdA.LIZ(fragment.getClass()));
        this.LJFF = null;
        return true;
    }

    public FFPMainFragment() {
        Csa csa;
        C2039Alv alv = C2039Alv.LIZ;
        this.LJI = new Csc(KEM.LIZ.LIZ(FindFriendsPageVM.class), alv, Css.LIZ, C2188AoK.LIZ((0CH) this, false), A7H.LIZ, C2036Als.INSTANCE, C2188AoK.LIZ((Fragment) this, true), C2188AoK.LIZIZ((Fragment) this, true));
        Csy csy = Csy.LIZ;
        D1G LIZ = KEM.LIZ.LIZ(FFPMainFragmentVM.class);
        C2033Alp alp = new C2033Alp(LIZ);
        C2035Alr alr = C2035Alr.INSTANCE;
        if (n.LIZ(csy, Csw.LIZ)) {
            csa = new Csa(LIZ, alp, Css.LIZ, C2188AoK.LIZ((0CH) this, true), C2188AoK.LIZ((0C0) this, true), A7H.LIZ, alr, 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, alp, Css.LIZ, C2188AoK.LIZ((0CH) this, false), C2188AoK.LIZ((0C0) this, false), A7H.LIZ, alr, C2188AoK.LIZ((Fragment) this, false), C2188AoK.LIZIZ((Fragment) this, false));
        }
        this.LJII = csa;
        this.LJIIJ = new Mjy();
        this.LJIIJJI = 2131559780;
    }

    public final void LIZ(View view) {
        View view2 = view;
        M12.LIZ(view2);
        FindFriendsPageVM LIZ = LIZ();
        FFPMainFragmentVM LIZIZ = LIZIZ();
        M12.LIZ(LIZIZ);
        LIZ.LIZ = LIZIZ;
        3c7 findViewById = view2.findViewById(2131367895);
        3c7 r8 = findViewById;
        2uR r7 = new 2uR();
        3cA r1 = new 3cA();
        r1.LIZ(2131755170);
        r1.LIZIZ = true;
        r1.LIZ(new C2030Alm(r8, this));
        r7.LIZ(new 3cI[]{r1});
        3cC r12 = new 3cC();
        CharSequence text = getText(2131825110);
        n.LIZIZ(text, "");
        r12.LIZ(text);
        r7.LIZ(r12);
        3cA r13 = new 3cA();
        r13.LIZ(2131755615);
        r13.LIZIZ = true;
        r13.LIZ(new C2034Alq(this));
        r7.LIZIZ(new 3cI[]{r13});
        r8.setNavActions(r7);
        r8.LIZ(false);
        n.LIZIZ(findViewById, "");
        this.LJIIIZ = r8;
        View findViewById2 = view2.findViewById(2131369886);
        C2026Ali ali = (C2026Ali) findViewById2;
        C2027Alj alj = new C2027Alj(2131825115, false, false, false, new C1980Aky(this), new C2022Ale(this), new C2023Alf(this), 14);
        M12.LIZ(alj);
        ali.LJ = alj;
        FrameLayout frameLayout = ali.LIZLLL;
        3ae r82 = new 3ae();
        r82.LIZIZ = 2130968589;
        Resources system = Resources.getSystem();
        n.LIZIZ(system, "");
        r82.LIZJ = Float.valueOf(TypedValue.applyDimension(1, 2.0f, system.getDisplayMetrics()));
        Context context = ali.getContext();
        n.LIZIZ(context, "");
        frameLayout.setBackground(r82.LIZ(context));
        2cN LIZLLL = C2041Alx.LIZ(ali.LIZ).LIZLLL(500, TimeUnit.MILLISECONDS).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZLLL(new C2029All(ali));
        n.LIZIZ(LIZLLL, "");
        4Dd.LIZ(LIZLLL, ali.LJFF);
        ali.LIZ.setOnTouchListener(new C2024Alg(ali, alj));
        ali.LIZ.setOnEditorActionListener(new C2028Alk(ali));
        ali.LIZ.setHint(ali.getContext().getText(alj.LIZ));
        if (alj.LIZJ) {
            ali.LIZJ.setOnClickListener(new C2031Aln(ali));
        }
        if (alj.LIZIZ) {
            ali.LIZIZ.setOnClickListener(new C2037Alt(ali, alj));
        }
        ali.LIZJ.setVisibility(8);
        ali.LIZIZ.setVisibility(8);
        4Dd.LIZ(ali.LJFF, this.LJIIJ);
        n.LIZIZ(findViewById2, "");
        this.LJIIIIZZ = ali;
    }
}
