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

import X.C03012Pr;
import X.Ls2;
import X.M12;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.foundation.fragment.BaseFragment;
import kotlin.h.b.n;

public class BaseSettingFragment extends BaseFragment {
    public View LJ;
    public boolean LJFF;
    public SparseArray LJI;

    static {
        Covode.recordClassIndex(106315);
    }

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

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

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

    public final void LIZIZ(Ls2<C03012Pr> ls2) {
        M12.LIZ(ls2);
        if (!this.LJFF) {
            this.LJFF = true;
            ls2.invoke();
        }
    }

    public final View LIZ(Ls2<? extends View> ls2) {
        M12.LIZ(ls2);
        View view = this.LJ;
        if (view == null) {
            this.LJ = (View) ls2.invoke();
        } else {
            ViewGroup viewGroup = null;
            ViewParent parent = view.getParent();
            if (parent instanceof ViewGroup) {
                viewGroup = parent;
            }
            ViewGroup viewGroup2 = viewGroup;
            if (viewGroup2 != null) {
                viewGroup2.endViewTransition(this.LJ);
            }
        }
        View view2 = this.LJ;
        if (view2 == null) {
            n.LIZIZ();
        }
        return view2;
    }
}
