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

import X.2Eq;
import X.2GO;
import X.ATt;
import X.BbC;
import X.C1069Rc9;
import X.C3320STs;
import X.C3407SXb;
import X.C3697SdR;
import X.DzH;
import X.E4u;
import X.Euf;
import X.ISm;
import X.M12;
import X.MJU;
import X.STF;
import X.SU7;
import X.SUD;
import android.util.SparseArray;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.discover.model.SearchUser;
import com.ss.android.ugc.aweme.discover.ui.SearchOriginalFragment;
import com.ss.android.ugc.aweme.profile.model.FollowStatus;
import com.ss.android.ugc.aweme.profile.model.FollowStatusEvent;
import com.ss.android.ugc.aweme.profile.model.User;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import kotlin.h.b.n;
import org.greenrobot.eventbus.ThreadMode;

public final class SearchUserFragment extends SearchOriginalFragment<SearchUser> implements BbC<SearchUser>, E4u, 2GO {
    public 2Eq LIZ;
    public SparseArray LIZIZ;

    static {
        Covode.recordClassIndex(65270);
    }

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

    public final void LIZJ(FollowStatus followStatus) {
    }

    public final String LIZLLL() {
        return "user";
    }

    public final boolean LJJIJIIJI() {
        return true;
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        Map<Integer, Object> subscriberEventTypes = super.getSubscriberEventTypes();
        subscriberEventTypes.put(7, new C1069Rc9(SearchUserFragment.class, "onFollowStatus", FollowStatusEvent.class, ThreadMode.POSTING, 0, false));
        subscriberEventTypes.put(22, new C1069Rc9(SearchUserFragment.class, "onProfileFollowEvent", ATt.class, ThreadMode.POSTING, 0, false));
        return subscriberEventTypes;
    }

    public final boolean LJIJI() {
        return MJU.LIZ.LIZIZ();
    }

    public SearchUserFragment() {
        this.LJJIFFI = C3320STs.LIZIZ.LIZIZ();
    }

    public final void onDestroyView() {
        super.onDestroyView();
        2Eq r0 = this.LIZ;
        if (r0 != null) {
            r0.do_();
        }
        LIZJ();
    }

    public final void LJIIJJI() {
        LIZ(new C3697SdR(this.LJJ, LJJIII(), new C3407SXb(this), this, "search_result"));
    }

    public final void LJIIIIZZ() {
        LIZ((SU7<?>) new STF());
        LJIIL().a_((BbC) this);
        2Eq LJIIJ = Euf.LIZ.LJIIJ();
        this.LIZ = LJIIJ;
        if (LJIIJ == null) {
            n.LIZIZ();
        }
        LJIIJ.LIZ(this);
        LJIIL().LIZ((SUD) this);
    }

    public final void LIZIZ(FollowStatus followStatus) {
        M12.LIZ(followStatus);
        if (aq_()) {
            LIZ(followStatus);
        }
    }

    @ISm
    public final void onFollowStatus(FollowStatusEvent followStatusEvent) {
        M12.LIZ(followStatusEvent);
        LIZ(followStatusEvent.status);
    }

    public final void e_(Exception exc) {
        M12.LIZ(exc);
        if (aq_()) {
            DzH.LIZ(getContext(), exc, 2131825188);
        }
    }

    @ISm
    public final void onProfileFollowEvent(ATt aTt) {
        M12.LIZ(aTt);
        if (aTt.LIZIZ instanceof User) {
            Object obj = aTt.LIZIZ;
            Objects.requireNonNull(obj, "null cannot be cast to non-null type com.ss.android.ugc.aweme.profile.model.User");
            FollowStatus followStatus = new FollowStatus();
            followStatus.userId = ((User) obj).getUid();
            followStatus.followStatus = aTt.LIZ;
            LIZ(followStatus);
        }
    }

    public final void LIZIZ(List<? extends SearchUser> list, boolean z) {
        SU7<?> LJIIL = LJIIL();
        M12.LIZ(LJIIL);
        super.LIZIZ(list, ((STF) LJIIL).LIZLLL());
    }
}
