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

import X.0AP;
import X.7he;
import X.8gF;
import X.C2708S6e;
import X.C2714S6k;
import X.C2807S9z;
import X.C3301SSz;
import X.Crj;
import X.M12;
import X.NzO;
import X.OQM;
import X.OQN;
import X.Odu;
import X.OeP;
import X.SA0;
import X.SNU;
import X.ST3;
import X.SV0;
import X.SV5;
import android.content.Intent;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.View;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.discover.ui.live.SearchLiveFragment;
import com.ss.android.ugc.aweme.discover.viewmodel.SearchEnterViewModel;
import java.io.Serializable;
import kotlin.h.b.n;

public final class SearchLiveListActivity extends SNU {
    public static final ST3 LIZ = new ST3((byte) 0);
    public final Crj LIZIZ = 7he.LIZ(new SA0(this));
    public SparseArray LIZJ;

    static {
        Covode.recordClassIndex(64147);
    }

    private final OeP LIZ() {
        return (OeP) this.LIZIZ.getValue();
    }

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

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

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

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

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

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

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

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.discover.activity.SearchLiveListActivity, X.SNU, android.app.Activity] */
    public final void onStop() {
        8gF.LIZLLL(this);
        super.onStop();
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    /* JADX WARNING: type inference failed for: r9v0, types: [com.ss.android.ugc.aweme.discover.activity.SearchLiveListActivity, X.1hK, X.4Qh, X.SNU, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        Serializable serializableExtra;
        Serializable serializableExtra2;
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.discover.activity.SearchLiveListActivity", "onCreate", true);
        activityConfiguration(C2708S6e.LIZ);
        super.onCreate(bundle);
        setContentView(2131561087);
        OQN _$_findCachedViewById = _$_findCachedViewById(2131371248);
        n.LIZIZ(_$_findCachedViewById, "");
        NzO titleView = _$_findCachedViewById.getTitleView();
        n.LIZIZ(titleView, "");
        titleView.setText(getString(2131820866));
        OQM _$_findCachedViewById2 = _$_findCachedViewById(2131371248);
        n.LIZIZ(_$_findCachedViewById2, "");
        _$_findCachedViewById2.getStartBtn().setOnClickListener(new C2714S6k(this));
        _$_findCachedViewById(2131371248).LIZ(true);
        Intent intent = getIntent();
        if (!(intent == null || (serializableExtra = intent.getSerializableExtra("param_live_enter")) == null)) {
            n.LIZIZ(serializableExtra, "");
            if (serializableExtra instanceof C3301SSz) {
                OeP LIZ2 = LIZ();
                C3301SSz sSz = (C3301SSz) serializableExtra;
                String searchKeyword = sSz.getSearchKeyword();
                if (searchKeyword == null) {
                    searchKeyword = "";
                }
                LIZ2.LIZ(new Odu(searchKeyword, (String) null, 2));
                SearchLiveListEnterParamViewModel LIZ3 = C2807S9z.LIZ(this).LIZ(SearchLiveListEnterParamViewModel.class);
                n.LIZIZ(LIZ3, "");
                LIZ3.LIZ = sSz;
                Intent intent2 = getIntent();
                if (!(intent2 == null || (serializableExtra2 = intent2.getSerializableExtra("param_search_enter")) == null)) {
                    n.LIZIZ(serializableExtra2, "");
                    if (serializableExtra2 instanceof SV5) {
                        SearchEnterViewModel.LIZJ.LIZ(this).LIZ(this, (SV5) serializableExtra2);
                    }
                    SearchLiveFragment searchLiveFragment = new SearchLiveFragment();
                    SV0 sv0 = new SV0();
                    sv0.setKeyword(LIZ().LIZ().LIZ);
                    sv0.setEnterMethod(sSz.getEnterMethod());
                    String fromSearchSubtag = sSz.getFromSearchSubtag();
                    if (fromSearchSubtag == null) {
                        fromSearchSubtag = "";
                    }
                    sv0.setFromSearchSubtag(fromSearchSubtag);
                    String preSearchId = sSz.getPreSearchId();
                    if (preSearchId == null) {
                        preSearchId = "";
                    }
                    sv0.setPreSearchId(preSearchId);
                    n.LIZIZ(sv0, "");
                    M12.LIZ(sv0);
                    searchLiveFragment.LJJ = sv0;
                    0AP LIZ4 = getSupportFragmentManager().LIZ();
                    LIZ4.LIZIZ(2131365158, searchLiveFragment, "container");
                    LIZ4.LIZJ();
                }
            }
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.discover.activity.SearchLiveListActivity", "onCreate", false);
    }
}
