package com.ss.android.ugc.aweme.notification;

import X.0GK;
import X.0Gf;
import X.0Gp;
import X.1CX;
import X.1DM;
import X.2GO;
import X.2HN;
import X.2HZ;
import X.2K7;
import X.2kS;
import X.4PU;
import X.7he;
import X.8gF;
import X.B9U;
import X.BSq;
import X.BbC;
import X.C0295Crj;
import X.C0436Cwu;
import X.C1880Dgq;
import X.C3459EFb;
import X.C3895EVv;
import X.C3900EWa;
import X.C3904EWe;
import X.C3921EWv;
import X.C4062Eaw;
import X.C4072Eb6;
import X.C5116Erw;
import X.CWi;
import X.CqM;
import X.CwZ;
import X.DS8;
import X.E1H;
import X.E84;
import X.EA3;
import X.EA4;
import X.EA6;
import X.EFR;
import X.EFY;
import X.EVK;
import X.EVN;
import X.EVT;
import X.EVY;
import X.EWH;
import X.EWL;
import X.EWS;
import X.EWY;
import X.EWZ;
import X.HeD;
import X.ISm;
import X.LWw;
import X.M12;
import X.Mjy;
import X.OQN;
import X.OQg;
import X.OQh;
import X.Rc9;
import X.SNU;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.SparseArray;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.router.arg.RouteArgExtension;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.analysis.Analysis;
import com.ss.android.ugc.aweme.notice.repo.list.bean.BaseNotice;
import com.ss.android.ugc.aweme.notification.bean.MusNotificationDetailArg;
import com.ss.android.ugc.aweme.notification.model.MusNewNotificationModel;
import com.ss.android.ugc.aweme.notification.vm.NotificationDetailVM;
import java.util.HashMap;
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 MusNotificationDetailActivity extends SNU implements 0GK, B9U, 4PU, BbC<BaseNotice>, C1880Dgq, 2HZ, 2GO {
    public static final C3900EWa LJFF = new C3900EWa((byte) 0);
    public C3904EWe LIZ;
    public boolean LIZIZ;
    public long LIZJ = -1;
    public String LIZLLL = "close";
    public HashMap<String, String> LJ = LWw.LIZJ(new C0436Cwu[]{CwZ.LIZ("EVENT_ORIGIN_FEATURE", "TEMAI"), CwZ.LIZ("page_name", "shop_info"), CwZ.LIZ("previous_page", "shop_message"), CwZ.LIZ("enter_from", "notification_page")});
    public final C0295Crj LJI = RouteArgExtension.INSTANCE.navArg(this);
    public final EFR LJII = EFR.LIZIZ;
    public EFY LJIIIIZZ;
    public EA4 LJIIIZ;
    public EA4 LJIIJ;
    public EA3 LJIIJJI;
    public final C0295Crj LJIIL = 7he.LIZ(EWY.LIZ);
    public MusNewNotificationModel LJIILIIL;
    public final C0295Crj LJIILJJIL = 7he.LIZ(new EA6(this));
    public final C0295Crj LJIILL = 7he.LIZ(EWH.LIZ);
    public SparseArray LJIILLIIL;

    static {
        Covode.recordClassIndex(95247);
    }

    private final EWZ LIZLLL() {
        return (EWZ) this.LJIIL.getValue();
    }

    private final NotificationDetailVM LJII() {
        return (NotificationDetailVM) this.LJIILJJIL.getValue();
    }

    public final void LIZ(int i) {
    }

    public final void LIZ(Exception exc) {
    }

    public final void LIZIZ() {
    }

    public final void LIZJ(List<BaseNotice> list, boolean z) {
    }

    public final void _$_clearFindViewByIdCache() {
        SparseArray sparseArray = this.LJIILLIIL;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final View _$_findCachedViewById(int i) {
        if (this.LJIILLIIL == null) {
            this.LJIILLIIL = new SparseArray();
        }
        View view = (View) this.LJIILLIIL.get(i);
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.LJIILLIIL.put(i, findViewById);
        return findViewById;
    }

    public final void cn_() {
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(206, new Rc9(MusNotificationDetailActivity.class, "onSwitchBusinessAccountSuccessEvent", DS8.class, ThreadMode.MAIN, 0, false));
        return hashMap;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity, X.SNU, android.app.Activity] */
    public final void onPause() {
        8gF.LIZJ(this);
        MusNotificationDetailActivity.super.onPause();
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity, X.SNU, android.app.Activity] */
    public final void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity", "onResume", true);
        MusNotificationDetailActivity.super.onResume();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity", "onResume", false);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity, X.SNU, android.app.Activity] */
    public final void onStart() {
        8gF.LIZ(this);
        MusNotificationDetailActivity.super.onStart();
    }

    public final void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity", "onWindowFocusChanged", true);
        MusNotificationDetailActivity.super.onWindowFocusChanged(z);
    }

    public final void onBackPressed() {
        MusNotificationDetailActivity.super.onBackPressed();
        this.LIZLLL = "return";
    }

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

    public final void bw_() {
        EA3 ea3 = this.LJIIJJI;
        if (ea3 == null) {
            n.LIZ("");
        }
        ea3.showLoadMoreLoading();
    }

    private final MusNotificationDetailArg LIZJ() {
        MusNotificationDetailArg musNotificationDetailArg = (MusNotificationDetailArg) this.LJI.getValue();
        if (musNotificationDetailArg == null) {
            return new MusNotificationDetailArg(0, 0, (String) null, (String) null, (String) null, false, 63, (2HN) null);
        }
        return musNotificationDetailArg;
    }

    private final C3459EFb LJIIIIZZ() {
        C3459EFb eFb = new C3459EFb(LIZJ().groupType, LIZJ().title, LIZJ().tabName);
        eFb.LIZ(LJII());
        return eFb;
    }

    private final void LJIIJ() {
        EA3 ea3 = this.LJIIJJI;
        if (ea3 == null) {
            n.LIZ("");
        }
        ea3.showLoadMoreEmpty();
        EA3 ea32 = this.LJIIJJI;
        if (ea32 == null) {
            n.LIZ("");
        }
        ea32.setShowFooter(false);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity, X.SNU, android.app.Activity] */
    public final void onDestroy() {
        8gF.LJ(this);
        MusNotificationDetailActivity.super.onDestroy();
        LIZLLL().do_();
        ((Mjy) this.LJIILL.getValue()).dispose();
    }

    public final void bc_() {
        LIZLLL().LIZ(new Object[]{4, Integer.valueOf(LIZJ().groupType), null, Boolean.valueOf(LIZJ().mergeTikTokShop)});
    }

    public final Analysis cU_() {
        Analysis analysis = new Analysis();
        int i = LIZJ().groupType;
        String str = "fans";
        if (i == 2) {
            str = "comment";
        } else if (i == 3) {
            str = "like";
        } else if (i == 6) {
            str = "at";
        }
        analysis.setLabelName(str);
        n.LIZIZ(analysis, "");
        return analysis;
    }

    public final void LJFF() {
        EA3 ea3 = this.LJIIJJI;
        if (ea3 == null) {
            n.LIZ("");
        }
        if (ea3.mShowFooter) {
            EA3 ea32 = this.LJIIJJI;
            if (ea32 == null) {
                n.LIZ("");
            }
            ea32.setShowFooter(false);
            EA3 ea33 = this.LJIIJJI;
            if (ea33 == null) {
                n.LIZ("");
            }
            ea33.notifyDataSetChanged();
            LJIIJ();
        }
        1DM _$_findCachedViewById = _$_findCachedViewById(2131368134);
        n.LIZIZ(_$_findCachedViewById, "");
        _$_findCachedViewById.setRefreshing(false);
        EA3 ea34 = this.LJIIJJI;
        if (ea34 == null) {
            n.LIZ("");
        }
        if (ea34.getItemCount() == 0) {
            OQg _$_findCachedViewById2 = _$_findCachedViewById(2131370625);
            OQh oQh = new OQh();
            EA4 ea4 = this.LJIIIZ;
            if (ea4 == null) {
                n.LIZ("");
            }
            oQh.LIZ(ea4.LIZIZ());
            EA4 ea42 = this.LJIIIZ;
            if (ea42 == null) {
                n.LIZ("");
            }
            oQh.LIZ(ea42.LIZJ());
            _$_findCachedViewById2.setStatus(oQh);
            OQg _$_findCachedViewById3 = _$_findCachedViewById(2131370625);
            n.LIZIZ(_$_findCachedViewById3, "");
            _$_findCachedViewById3.setVisibility(0);
        }
        EWS.LIZIZ.LIZ(0);
    }

    /* JADX WARNING: type inference failed for: r5v0, types: [com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity, X.4Qh, X.SNU, android.app.Activity] */
    public final void onStop() {
        8gF.LIZLLL(this);
        MusNotificationDetailActivity.super.onStop();
        if (E1H.LIZ && LIZJ().groupType == 210 && this.LIZJ != -1) {
            _$_findCachedViewById(2131368125).post(new EVN(this));
        }
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    public final void LIZ() {
        if (LJIIIZ()) {
            EA3 ea3 = this.LJIIJJI;
            if (ea3 == null) {
                n.LIZ("");
            }
            if (ea3.getItemCount() == 0) {
                _$_findCachedViewById(2131370625).LIZ();
                OQg _$_findCachedViewById = _$_findCachedViewById(2131370625);
                n.LIZIZ(_$_findCachedViewById, "");
                _$_findCachedViewById.setVisibility(0);
            }
            LIZLLL().LIZ(new Object[]{1, Integer.valueOf(LIZJ().groupType), null, Boolean.valueOf(LIZJ().mergeTikTokShop)});
            LJII().LIZ().clear();
            EWS.LIZIZ.LIZ();
            return;
        }
        EA3 ea32 = this.LJIIJJI;
        if (ea32 == null) {
            n.LIZ("");
        }
        if (ea32.getItemCount() == 0) {
            0Gp.LIZ(100).LIZ(new EVK(this), 0Gp.LIZIZ, (0Gf) null);
        }
        EWS.LIZ = null;
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void onSwitchBusinessAccountSuccessEvent(DS8 ds8) {
        finish();
    }

    public final void LIZJ(Exception exc) {
        EA3 ea3 = this.LJIIJJI;
        if (ea3 == null) {
            n.LIZ("");
        }
        ea3.showPullUpLoadMore();
    }

    public final void LIZLLL(int i) {
        M12.LIZ("NotificationDetail", "onItemClick:".concat(String.valueOf(i)));
        this.LIZLLL = "next";
    }

    /* JADX WARNING: type inference failed for: r1v3, types: [android.app.Activity] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZIZ(java.lang.Exception r8) {
        /*
            r7 = this;
            X.EA3 r0 = r7.LJIIJJI
            java.lang.String r1 = ""
            if (r0 != 0) goto L_0x0009
            kotlin.h.b.n.LIZ(r1)
        L_0x0009:
            boolean r0 = r0.mShowFooter
            r5 = 0
            if (r0 == 0) goto L_0x0022
            X.EA3 r0 = r7.LJIIJJI
            if (r0 != 0) goto L_0x0015
            kotlin.h.b.n.LIZ(r1)
        L_0x0015:
            r0.setShowFooter(r5)
            X.EA3 r0 = r7.LJIIJJI
            if (r0 != 0) goto L_0x001f
            kotlin.h.b.n.LIZ(r1)
        L_0x001f:
            r0.notifyDataSetChanged()
        L_0x0022:
            r0 = 2131368134(0x7f0a18c6, float:1.835621E38)
            android.view.View r0 = r7._$_findCachedViewById(r0)
            X.1DM r0 = (X.1DM) r0
            kotlin.h.b.n.LIZIZ(r0, r1)
            r0.setRefreshing(r5)
            X.EA3 r0 = r7.LJIIJJI
            if (r0 != 0) goto L_0x0038
            kotlin.h.b.n.LIZ(r1)
        L_0x0038:
            int r0 = r0.getItemCount()
            if (r0 != 0) goto L_0x0077
            r6 = 2131370625(0x7f0a2281, float:1.8361262E38)
            android.view.View r0 = r7._$_findCachedViewById(r6)
            X.OQg r0 = (X.OQg) r0
            kotlin.h.b.n.LIZIZ(r0, r1)
            r0.setVisibility(r5)
            X.Ams r0 = X.Ams.LIZ
            boolean r0 = r0.isStandardUIEnable()
            if (r0 == 0) goto L_0x007d
            X.Ams r4 = X.Ams.LIZ
            android.view.View r2 = r7._$_findCachedViewById(r6)
            X.OQg r2 = (X.OQg) r2
            kotlin.h.b.n.LIZIZ(r2, r1)
            X.EVV r1 = new X.EVV
            r0 = r7
            r1.<init>(r0)
            java.lang.String r3 = "inbox_notification_detail"
            r4.setStatusView(r2, r3, r1, r8)
            X.Ams r2 = X.Ams.LIZ
            r1 = r7
            android.view.View r0 = r7._$_findCachedViewById(r6)
            X.OQg r0 = (X.OQg) r0
            r2.triggerNetworkTips(r1, r3, r8, r0)
        L_0x0077:
            X.EWS r0 = X.EWS.LIZIZ
            r0.LIZ((int) r5)
            return
        L_0x007d:
            android.view.View r3 = r7._$_findCachedViewById(r6)
            X.OQg r3 = (X.OQg) r3
            X.OQh r2 = new X.OQh
            r2.<init>()
            X.EVW r1 = new X.EVW
            r0 = r7
            r1.<init>(r0)
            X.30v.LIZ(r2, r1)
            r3.setStatus(r2)
            goto L_0x0077
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity.LIZIZ(java.lang.Exception):void");
    }

    /* JADX WARNING: type inference failed for: r10v0, types: [com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity, X.4Qh, X.SNU, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        EFY efy;
        boolean z;
        EFY efy2;
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity", "onCreate", true);
        activityConfiguration(C3921EWv.LIZ);
        MusNotificationDetailActivity.super.onCreate(bundle);
        EWS.LIZIZ.LIZ(EVT.DETAIL_TYPE_NOTIFICATION, LIZJ().groupType, LIZJ().nid);
        setContentView(2131558848);
        this.LIZJ = SystemClock.elapsedRealtime();
        this.LIZ = new C3904EWe(this, LIZJ().groupType);
        C4062Eaw LIZ2 = C5116Erw.LIZ(LIZJ().groupType);
        C4072Eb6 eb6 = null;
        if (LIZ2 != null) {
            eb6 = LIZ2.LIZ;
        }
        if (eb6 == C4072Eb6.AfterClick) {
            C5116Erw.LIZLLL(LIZJ().groupType);
            LIZJ();
            CqM.LIZ(new E84());
        }
        if (LIZJ().groupType == -1) {
            ActivityAgent.onTrace("com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity", "onCreate", false);
            return;
        }
        if (EFR.LIZ.get(Integer.valueOf(LIZJ().groupType)) == null || (efy2 = EFR.LIZ.get(Integer.valueOf(LIZJ().groupType))) == null || efy2.LIZ() == null) {
            efy = LJIIIIZZ();
            z = true;
        } else {
            efy = EFR.LIZ.get(Integer.valueOf(LIZJ().groupType));
            if (efy == null) {
                n.LIZIZ();
            }
            z = false;
        }
        EFY efy3 = efy;
        this.LJIIIIZZ = efy3;
        if (efy3 == null) {
            n.LIZ("");
        }
        efy3.LIZ(LJII());
        EFY efy4 = this.LJIIIIZZ;
        if (efy4 == null) {
            n.LIZ("");
        }
        EA4 LIZ3 = efy4.LIZ();
        if (LIZ3 == null) {
            n.LIZIZ();
        }
        this.LJIIIZ = LIZ3;
        if (!z) {
            LIZ3 = LJIIIIZZ().LIZ();
            if (LIZ3 == null) {
                n.LIZIZ();
            }
        } else if (LIZ3 == null) {
            n.LIZ("");
        }
        this.LJIIJ = LIZ3;
        RecyclerView _$_findCachedViewById = _$_findCachedViewById(2131368125);
        n.LIZIZ(_$_findCachedViewById, "");
        1CX itemAnimator = _$_findCachedViewById.getItemAnimator();
        Objects.requireNonNull(itemAnimator, "null cannot be cast to non-null type androidx.recyclerview.widget.SimpleItemAnimator");
        itemAnimator.LJIIL = false;
        RecyclerView _$_findCachedViewById2 = _$_findCachedViewById(2131368125);
        n.LIZIZ(_$_findCachedViewById2, "");
        _$_findCachedViewById2.setLayoutManager(new LinearLayoutManager());
        _$_findCachedViewById(2131368125).LIZIZ(new BSq(1, (int) HeD.LIZIZ(this, 1.0f), 0));
        _$_findCachedViewById(2131368125).LIZ(new CWi(this));
        _$_findCachedViewById(2131368134).setOnRefreshListener(this);
        OQN _$_findCachedViewById3 = _$_findCachedViewById(2131371262);
        EA4 ea4 = this.LJIIIZ;
        if (ea4 == null) {
            n.LIZ("");
        }
        _$_findCachedViewById3.setTitle(ea4.LIZ());
        _$_findCachedViewById(2131371262).setOnTitleBarClickListener(new EWL(this));
        EA4 ea42 = this.LJIIIZ;
        if (ea42 == null) {
            n.LIZ("");
        }
        EA4 ea43 = this.LJIIJ;
        if (ea43 == null) {
            n.LIZ("");
        }
        this.LJIIJJI = new EA3(this, ea42, ea43, LIZJ().unReadMessageCount);
        MusNewNotificationModel musNewNotificationModel = new MusNewNotificationModel();
        this.LJIILIIL = musNewNotificationModel;
        musNewNotificationModel.setCurrentNoticeGroup(LIZJ().groupType);
        EWZ LIZLLL2 = LIZLLL();
        MusNewNotificationModel musNewNotificationModel2 = this.LJIILIIL;
        if (musNewNotificationModel2 == null) {
            n.LIZ("");
        }
        LIZLLL2.LIZ(musNewNotificationModel2);
        LIZLLL().a_(this);
        EA3 ea3 = this.LJIIJJI;
        if (ea3 == null) {
            n.LIZ("");
        }
        ea3.setLoadMoreListener(this);
        EA3 ea32 = this.LJIIJJI;
        if (ea32 == null) {
            n.LIZ("");
        }
        ea32.setShowFooter(true);
        EA3 ea33 = this.LJIIJJI;
        if (ea33 == null) {
            n.LIZ("");
        }
        ea33.showLoadMoreEmpty();
        RecyclerView _$_findCachedViewById4 = _$_findCachedViewById(2131368125);
        n.LIZIZ(_$_findCachedViewById4, "");
        EA3 ea34 = this.LJIIJJI;
        if (ea34 == null) {
            n.LIZ("");
        }
        _$_findCachedViewById4.setAdapter(ea34);
        _$_findCachedViewById(2131370625).LIZ();
        OQg _$_findCachedViewById5 = _$_findCachedViewById(2131370625);
        n.LIZIZ(_$_findCachedViewById5, "");
        _$_findCachedViewById5.setVisibility(0);
        LIZ();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity", "onCreate", false);
    }

    public final void LIZIZ(List<BaseNotice> list, boolean z) {
        if (list == null || list.isEmpty()) {
            z = false;
        }
        if (!z) {
            LJIIJ();
        } else {
            EA3 ea3 = this.LJIIJJI;
            if (ea3 == null) {
                n.LIZ("");
            }
            ea3.resetLoadMoreState();
        }
        EA3 ea32 = this.LJIIJJI;
        if (ea32 == null) {
            n.LIZ("");
        }
        ea32.setDataAfterLoadMore(list);
    }

    public final void LIZ(List<BaseNotice> list, boolean z) {
        EA3 ea3 = this.LJIIJJI;
        if (ea3 == null) {
            n.LIZ("");
        }
        ea3.setShowFooter(true);
        int i = 0;
        if (this.LIZIZ) {
            EA3 ea32 = this.LJIIJJI;
            if (ea32 == null) {
                n.LIZ("");
            }
            ea32.LIZIZ = 0;
        }
        this.LIZIZ = true;
        if (!z) {
            LJIIJ();
        } else {
            EA3 ea33 = this.LJIIJJI;
            if (ea33 == null) {
                n.LIZ("");
            }
            ea33.resetLoadMoreState();
        }
        MusNewNotificationModel musNewNotificationModel = this.LJIILIIL;
        if (musNewNotificationModel == null) {
            n.LIZ("");
        }
        2kS r0 = musNewNotificationModel.unsubscribeSetting;
        if (r0 != null && r0.LIZIZ) {
            C3904EWe eWe = this.LIZ;
            if (eWe == null) {
                n.LIZ("");
            }
            eWe.LIZ().LIZ(eWe.LJ);
            _$_findCachedViewById(2131371262).setEndBtnVisibility(0);
            _$_findCachedViewById(2131371262).setEndBtnClickListener(new C3895EVv(this));
        }
        1DM _$_findCachedViewById = _$_findCachedViewById(2131368134);
        n.LIZIZ(_$_findCachedViewById, "");
        _$_findCachedViewById.setRefreshing(false);
        EA3 ea34 = this.LJIIJJI;
        if (ea34 == null) {
            n.LIZ("");
        }
        ea34.setData(list);
        OQg _$_findCachedViewById2 = _$_findCachedViewById(2131370625);
        n.LIZIZ(_$_findCachedViewById2, "");
        _$_findCachedViewById2.setVisibility(8);
        if (E1H.LIZ && LIZJ().groupType == 210) {
            _$_findCachedViewById(2131368125).post(new EVY(this));
        }
        EWS ews = EWS.LIZIZ;
        if (list != null) {
            i = list.size();
        }
        ews.LIZ(i);
    }
}
