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

import X.2UX;
import X.2nK;
import X.M12;
import android.os.SystemClock;
import android.util.SparseArray;
import android.view.View;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.base.arch.JediBaseFragment;

public abstract class BaseDiscoverTabFragment extends JediBaseFragment {
    public final String LIZIZ;
    public long LIZJ = -1;
    public SparseArray LIZLLL;

    static {
        Covode.recordClassIndex(65374);
    }

    public abstract int LIZJ();

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

    public abstract String LJ();

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

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

    public void LIZ(boolean z, boolean z2) {
        if (!z) {
            if (this.LIZJ <= 0) {
                this.LIZJ = SystemClock.elapsedRealtime();
            }
        } else if (this.LIZJ > 0) {
            String LJ = LJ();
            M12.LIZ(LJ);
            2UX r1 = new 2UX();
            r1.LIZ("enter_from", LJ);
            r1.LIZ("duration", SystemClock.elapsedRealtime() - this.LIZJ);
            2nK.LIZ("stay_time", r1.LIZ);
            this.LIZJ = -1;
        }
    }
}
