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

import X.2GO;
import X.2K7;
import X.8bl;
import X.AVG;
import X.Bb8;
import X.C3304STc;
import X.C3451SYt;
import X.C4458Spi;
import X.LeC;
import X.M12;
import X.OQS;
import X.SG1;
import X.SU7;
import X.SV0;
import android.util.SparseArray;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.discover.model.SearchApiResult;
import java.util.Objects;
import kotlin.h.b.n;

public abstract class SearchOriginalFragment<D> extends SearchFragment<D> implements C4458Spi, 2GO {
    public SparseArray LIZ;
    public SU7<?> LIZJ;

    static {
        Covode.recordClassIndex(65539);
    }

    public void LIZ(LeC leC, String str) {
    }

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

    public static boolean LJIILIIL() {
        try {
            return 2K7.LIZ.LIZJ();
        } catch (Exception unused) {
            return false;
        }
    }

    public final SU7<?> LJIIL() {
        SU7<?> su7 = this.LIZJ;
        if (su7 == null) {
            n.LIZ("");
        }
        return su7;
    }

    public final String LJIL() {
        SU7<?> su7 = this.LIZJ;
        if (su7 == null) {
            n.LIZ("");
            return null;
        }
        C3304STc sTc = su7.LJII;
        if (sTc != null) {
            return sTc.LJIJJ;
        }
        return null;
    }

    public void onDestroyView() {
        super.onDestroyView();
        SU7<?> su7 = this.LIZJ;
        if (su7 == null) {
            n.LIZ("");
        }
        su7.do_();
        LIZJ();
    }

    public void LJFF() {
        SU7<?> su7 = this.LIZJ;
        if (su7 == null) {
            n.LIZ("");
        }
        if (su7.LJII instanceof C3304STc) {
            SG1 LJJJ = LJJJ();
            SU7<?> su72 = this.LIZJ;
            if (su72 == null) {
                n.LIZ("");
            }
            Bb8 bb8 = su72.LJII;
            n.LIZIZ(bb8, "");
            OQS LIZ2 = SG1.LIZ(LJJJ, (SearchApiResult) bb8.getData(), (Exception) null, 2);
            if (LIZ2 != null) {
                LIZ(LIZ2);
                return;
            }
        }
        LJJJJ();
        LJJJJJL();
    }

    public final void bO_() {
        AVG avg;
        SU7<?> su7 = this.LIZJ;
        if (su7 == null) {
            n.LIZ("");
        }
        su7.LIZIZ(SearchBaseFragment.LJJIZ);
        SU7<?> su72 = this.LIZJ;
        if (su72 == null) {
            n.LIZ("");
        }
        Object[] objArr = new Object[5];
        objArr[0] = 4;
        objArr[1] = LJJJJJ();
        objArr[2] = 1;
        objArr[3] = Integer.valueOf(this.LJJIJIIJI);
        SV0 sv0 = this.LJJ;
        if (sv0 != null) {
            avg = sv0.getFilterOption();
        } else {
            avg = null;
        }
        objArr[4] = avg;
        su72.LIZ(objArr);
    }

    public final void LIZ(SU7<?> su7) {
        M12.LIZ(su7);
        this.LIZJ = su7;
    }

    public final void c_(boolean z) {
        String LIZLLL = LIZLLL();
        SU7<?> su7 = this.LIZJ;
        if (su7 == null) {
            n.LIZ("");
        }
        C3304STc sTc = su7.LJII;
        Objects.requireNonNull(sTc, "null cannot be cast to non-null type com.ss.android.ugc.aweme.discover.presenter.SearchBaseModel<*, *>");
        LIZ(LIZLLL, sTc.LJIJ, LJJII(), z);
    }

    public void LIZ(int i) {
        AVG avg;
        LJJIJL().setIsRefreshingData(true);
        SU7<?> su7 = this.LIZJ;
        if (su7 == null) {
            n.LIZ("");
        }
        Object[] objArr = new Object[5];
        objArr[0] = 1;
        objArr[1] = LJJII();
        objArr[2] = Integer.valueOf(i);
        objArr[3] = Integer.valueOf(this.LJJIJIIJI);
        SV0 sv0 = this.LJJ;
        if (sv0 != null) {
            avg = sv0.getFilterOption();
        } else {
            avg = null;
        }
        objArr[4] = avg;
        su7.LIZ(objArr);
    }

    public final void LIZ(boolean z, boolean z2) {
        if (this.LIZJ != null) {
            super.LIZ(z, z2);
        }
    }

    public final void LIZ(int i, AVG avg) {
        super.LIZ(i, avg);
        getActivity();
        if (LJIILIIL()) {
            SU7<?> su7 = this.LIZJ;
            if (su7 == null) {
                n.LIZ("");
            }
            su7.LIZIZ(SearchBaseFragment.LJJIZ);
            SU7<?> su72 = this.LIZJ;
            if (su72 == null) {
                n.LIZ("");
            }
            su72.LIZ(this.LJJIII);
            LIZ(i);
            return;
        }
        8bl.LIZ(new C3451SYt(this), 100);
    }
}
