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

import X.070;
import X.1hK;
import X.2cN;
import X.2xd;
import X.Ar5;
import X.Bii;
import X.C1089DLx;
import X.C1365DWn;
import X.C1423DYt;
import X.C1594DcE;
import X.C1933Dhh;
import X.C1936Dhk;
import X.C1938Dhm;
import X.C2163DlP;
import X.C2196Dlw;
import X.C2197Dlx;
import X.C2198Dly;
import X.C2199Dlz;
import X.C2200Dm0;
import X.C2202Dm2;
import X.C2204Dm4;
import X.C2206Dm6;
import X.C2276DnE;
import X.C2354DoU;
import X.C2470DqM;
import X.C2478DqU;
import X.C2479DqV;
import X.C2483DqZ;
import X.C2484Dqa;
import X.D1G;
import X.DL2;
import X.DUS;
import X.DUT;
import X.DV0;
import X.DY5;
import X.KEM;
import X.LsC;
import X.LsD;
import X.M12;
import X.OQg;
import X.OQh;
import X.OhL;
import X.T9Q;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import com.bytedance.covode.number.Covode;
import com.bytedance.jedi.arch.JediViewModel;
import com.bytedance.jedi.arch.lifecycleAwareLazy;
import com.ss.android.ugc.aweme.following.ui.adapter.FollowListAdapter;
import com.ss.android.ugc.aweme.recommend.RecommendListViewModel;
import com.ss.android.ugc.aweme.views.WrapLinearLayoutManager;
import kotlin.h.b.n;

public final class SuggestRelationFragment extends BaseRelationFragment {
    public FollowListAdapter LJIIJ;
    public final lifecycleAwareLazy LJIIJJI;
    public DY5 LJIIL;
    public SparseArray LJIILIIL;

    static {
        Covode.recordClassIndex(80852);
    }

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

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

    public final int LJFF() {
        return 2131559763;
    }

    public final String LJIIIIZZ() {
        return "suggested_list";
    }

    public final int LJIILL() {
        return 2131232870;
    }

    public final int LJIILLIIL() {
        return 2131831045;
    }

    public final int LJIIZILJ() {
        return 2131833189;
    }

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

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        cb_();
    }

    public final void onResume() {
        SuggestRelationFragment.super.onResume();
        boolean z = this.LIZLLL;
    }

    public final void onDestroy() {
        SuggestRelationFragment.super.onDestroy();
        Ar5.LIZ.LIZJ();
    }

    public final void LJIJ() {
        OQg LIZJ = LIZJ(2131370636);
        n.LIZIZ(LIZJ, "");
        LIZJ.setVisibility(0);
        LIZJ(2131370636).setStatus(LIZLLL());
    }

    public SuggestRelationFragment() {
        C2163DlP dlP = new C2163DlP(this);
        D1G LIZ = KEM.LIZ.LIZ(RecommendListViewModel.class);
        C2199Dlz dlz = new C2199Dlz(LIZ);
        this.LJIIJJI = new lifecycleAwareLazy(this, dlz, new C2200Dm0(this, dlz, LIZ, dlP));
    }

    public final OQh LJIIJJI() {
        OQh oQh = new OQh();
        oQh.LIZ(2xd.LIZ(C1594DcE.LIZ));
        String string = getString(2131827469);
        n.LIZIZ(string, "");
        oQh.LIZ(string);
        String string2 = getString(2131822530);
        n.LIZIZ(string2, "");
        oQh.LIZ(string2);
        oQh.LJIIIZ = new C2206Dm6(this);
        return oQh;
    }

    public final void LJIILJJIL() {
        DY5 dy5 = this.LJIIL;
        if (dy5 != null) {
            dy5.ds_();
            return;
        }
        OQg LIZJ = LIZJ(2131370636);
        n.LIZIZ(LIZJ, "");
        LIZJ.setVisibility(0);
        LIZJ(2131370636).LIZ();
        DL2 dl2 = LIZJ().LIZ;
        if (dl2 != null) {
            dl2.LIZ(false);
        }
        DL2 dl22 = LIZJ().LIZ;
        if (dl22 != null) {
            dl22.LIZIZ();
        }
        LIZJ().LJIIJ();
    }

    public static final /* synthetic */ FollowListAdapter LIZ(SuggestRelationFragment suggestRelationFragment) {
        FollowListAdapter followListAdapter = suggestRelationFragment.LJIIJ;
        if (followListAdapter == null) {
            n.LIZ("");
        }
        return followListAdapter;
    }

    /* JADX WARNING: type inference failed for: r12v0, types: [com.ss.android.ugc.aweme.following.ui.SuggestRelationFragment, com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment, X.DV1, com.ss.android.ugc.aweme.base.arch.JediBaseFragment, androidx.fragment.app.Fragment, com.ss.android.ugc.aweme.following.ui.BaseRelationFragment] */
    public final void onViewCreated(View view, Bundle bundle) {
        boolean z;
        M12.LIZ(view);
        SuggestRelationFragment.super.onViewCreated(view, bundle);
        View findViewById = view.findViewById(2131372627);
        n.LIZIZ(findViewById, "");
        DY5 dy5 = (DY5) findViewById;
        if (1 == ((Number) C2204Dm4.LIZ.getValue()).intValue()) {
            z = true;
        } else {
            z = false;
        }
        if (!z) {
            dy5.setVisibility(8);
        } else {
            dy5.setVisibility(0);
            T9Q LIZJ = LIZJ(2131370557);
            n.LIZIZ(LIZJ, "");
            LIZJ.setVisibility(8);
            OQg LIZJ2 = LIZJ(2131370636);
            n.LIZIZ(LIZJ2, "");
            LIZJ2.setVisibility(8);
            dy5.LIZ((1hK) null, this, new C1365DWn(this, C1423DYt.LIZIZ.LIZ()));
            if (!this.LIZLLL) {
                dy5.ds_();
            }
            this.LJIIL = dy5;
        }
        if (this.LJIIL == null) {
            T9Q LIZJ3 = LIZJ(2131370557);
            n.LIZIZ(LIZJ3, "");
            LIZJ3.setEnabled(false);
            getActivity();
            WrapLinearLayoutManager wrapLinearLayoutManager = new WrapLinearLayoutManager();
            wrapLinearLayoutManager.LIZIZ(1);
            RecyclerView LIZJ4 = LIZJ(2131369773);
            n.LIZIZ(LIZJ4, "");
            LIZJ4.setLayoutManager(wrapLinearLayoutManager);
            RecyclerView LIZJ5 = LIZJ(2131369773);
            n.LIZIZ(LIZJ5, "");
            LIZJ5.setItemAnimator(new OhL());
            Bii.LIZ(LIZJ(2131369773), 8);
            FollowListAdapter followListAdapter = new FollowListAdapter(this, "suggest_user", LJI());
            this.LJIIJ = followListAdapter;
            RecyclerView LIZJ6 = LIZJ(2131369773);
            n.LIZIZ(LIZJ6, "");
            followListAdapter.setLoaddingTextColor(070.LIZJ(LIZJ6.getContext(), 2131100281));
            RecyclerView LIZJ7 = LIZJ(2131369773);
            n.LIZIZ(LIZJ7, "");
            FollowListAdapter followListAdapter2 = this.LJIIJ;
            if (followListAdapter2 == null) {
                n.LIZ("");
            }
            LIZJ7.setAdapter(followListAdapter2);
            FollowListAdapter followListAdapter3 = this.LJIIJ;
            if (followListAdapter3 == null) {
                n.LIZ("");
            }
            followListAdapter3.setLoadMoreListener(new C2202Dm2(this));
            DV0.LIZ(this, (JediViewModel) LIZJ(), C2470DqM.LIZ, (DUT) null, (LsD) new C2276DnE(this), (LsC) new C1933Dhh(this), (LsD) new C1936Dhk(this), 2);
            2cN unused = selectSubscribe(LIZJ(), C2484Dqa.LIZ, DUS.LIZ(), new C1938Dhm(this));
            DV0.LIZ(this, (JediViewModel) LIZJ(), C2479DqV.LIZ, (DUT) null, (LsD) new C2196Dlw(this), (LsC) new C2197Dlx(this), (LsD) C1089DLx.LIZ, 2);
            2cN unused2 = selectSubscribe(LIZJ(), C2483DqZ.LIZ, C2478DqU.LIZ, DUS.LIZ(), new C2198Dly(this));
            RecommendListViewModel LIZJ8 = LIZJ();
            LIZJ8.b_(new C2354DoU(LIZJ8));
            if (!this.LIZLLL) {
                DL2 dl2 = LIZJ().LIZ;
                if (dl2 != null) {
                    dl2.LIZ(false);
                }
                DL2 dl22 = LIZJ().LIZ;
                if (dl22 != null) {
                    dl22.LIZIZ();
                }
                LIZJ().LJIIJ();
            }
        }
    }
}
