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

import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.0CD;
import X.0CH;
import X.1Bd;
import X.2GD;
import X.2HN;
import X.2Pr;
import X.2Yt;
import X.2Yu;
import X.2cN;
import X.36a;
import X.3Ft;
import X.5Am;
import X.5An;
import X.5vY;
import X.5wO;
import X.6iy;
import X.7ZM;
import X.7he;
import X.8gF;
import X.8gI;
import X.9EH;
import X.AgT;
import X.Ahl;
import X.Ahm;
import X.Aid;
import X.B1N;
import X.B8T;
import X.BCt;
import X.BCu;
import X.C2795S9n;
import X.C3298SSw;
import X.C3300SSy;
import X.C3320STs;
import X.C3328SUa;
import X.C3329SUb;
import X.C3347SUt;
import X.C3411SXf;
import X.C3419SXn;
import X.C3427SXv;
import X.C3439SYh;
import X.C3596Sbo;
import X.C3670Sd0;
import X.C3671Sd1;
import X.C4618SsI;
import X.Cg3;
import X.Crj;
import X.Cwt;
import X.Cwu;
import X.D4t;
import X.DRZ;
import X.DUT;
import X.DUy;
import X.DUz;
import X.DV9;
import X.DVU;
import X.EIE;
import X.EaU;
import X.F5K;
import X.FLI;
import X.LgM;
import X.LsC;
import X.LsD;
import X.LsE;
import X.LsF;
import X.Lsh;
import X.M12;
import X.MGk;
import X.MLO;
import X.MWv;
import X.PHD;
import X.QKL;
import X.SDQ;
import X.SNU;
import X.SU9;
import X.SV0;
import X.SV1;
import X.SV4;
import X.SV5;
import X.SV6;
import X.SV7;
import X.SW6;
import X.SXD;
import X.SXK;
import X.SY7;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import androidx.lifecycle.SharedViewModelProvider;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.jedi.arch.JediViewModel;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.common.c.a;
import com.ss.android.ugc.aweme.discover.api.SearchApiNew;
import com.ss.android.ugc.aweme.discover.helper.SearchMusicPlayerLifecycleObserver;
import com.ss.android.ugc.aweme.discover.model.SearchIntermediateViewModel;
import com.ss.android.ugc.aweme.discover.model.SearchStateViewModel;
import com.ss.android.ugc.aweme.discover.ui.SearchResultFragment;
import com.ss.android.ugc.aweme.discover.viewmodel.SearchEnterViewModel;
import com.ss.android.ugc.aweme.discover.viewmodel.SearchInfoViewModel;
import com.ss.android.ugc.aweme.search.theme.dark.ThemeViewModel;
import com.ss.android.ugc.aweme.setting.services.SettingServiceImpl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedDeque;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;

public final class SearchResultActivity extends SNU implements B1N<Aid>, 5vY, BCt, EIE, C3300SSy {
    public static final C2795S9n LIZJ = new C2795S9n((byte) 0);
    public static boolean LJIIIZ;
    public Aid LIZ = new Aid();
    public View LIZIZ;
    public SV0 LIZLLL;
    public String LJ = "";
    public final Crj LJFF = 7he.LIZ(new Ahl(this));
    public final Crj LJI = 7he.LIZ(new Ahm(this));
    public final Crj LJII = 7he.LIZ(new SDQ(this));
    public final Crj LJIIIIZZ;
    public SparseArray LJIIJ;

    static {
        Covode.recordClassIndex(104000);
    }

    private final SearchIntermediateViewModel LIZIZ() {
        return (SearchIntermediateViewModel) this.LJFF.getValue();
    }

    private final SearchStateViewModel LIZJ() {
        return (SearchStateViewModel) this.LJI.getValue();
    }

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

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

    public final boolean getUniqueOnlyGlobal() {
        return true;
    }

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

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

    public final /* bridge */ /* synthetic */ 0Bv be_() {
        return this.LIZ;
    }

    public final /* bridge */ /* synthetic */ 5An getReceiver() {
        return this;
    }

    public final 0CH getLifecycleOwner() {
        5wO.LIZJ(this);
        return this;
    }

    public final DUz getLifecycleOwnerHolder() {
        5wO.LIZ(this);
        return this;
    }

    public final DUy<DVU> getReceiverHolder() {
        5wO.LIZIZ(this);
        return this;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [android.content.Context] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private boolean LJI() {
        /*
            r2 = this;
            com.ss.android.ugc.aweme.homepage.api.msadapt.IMSAdaptionService r1 = com.ss.android.ugc.aweme.homepage.msadapt.MSAdaptionService.LIZJ()
            r0 = r2
            boolean r0 = r1.LIZ(r0)
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.search.activity.SearchResultActivity.LJI():boolean");
    }

    public final BCu getInflater() {
        return (BCu) this.LJIIIIZZ.getValue();
    }

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

    public final void onBackPressed() {
        SV1 LIZ2 = getSupportFragmentManager().LIZ("container");
        if (!(LIZ2 instanceof SV1) || !LIZ2.LIZ(MLO.SYSTEM_BACK_METHOD)) {
            SearchResultActivity.super.onBackPressed();
        }
    }

    private final void LJ() {
        SearchResultActivity LIZ2 = LgM.LIZIZ.LIZ();
        if (LIZ2 != null && n.LIZ("dark", SettingServiceImpl.LJIJJ().LIZ(LIZ2.hashCode()))) {
            0Bx LIZ3 = 0By.LIZ(this, (0Bv) null);
            if (2GD.LIZ) {
                0Bs.LIZ(LIZ3, this);
            }
            M12.LIZ("dark");
            LIZ3.LIZ(ThemeViewModel.class).LIZ = "dark";
        }
    }

    public final String LJII() {
        SearchResultFragment LIZ2 = getSupportFragmentManager().LIZ("container");
        if (LIZ2 instanceof SearchResultFragment) {
            int LJJJJI = LIZ2.LJJJJI();
            if (LJJJJI == C3320STs.LIZ()) {
                return "general_search";
            }
            if (LJJJJI == C3320STs.LIZIZ.LIZJ()) {
                return "search_result";
            }
        }
        return "";
    }

    /* JADX WARNING: type inference failed for: r0v2, types: [android.app.Activity] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void finish() {
        /*
            r5 = this;
            super.finish()
            java.lang.String r4 = r5.LJ
            X.M12.LIZ(r4)
            X.9Y1 r3 = X.9Y1.LIZ()
            java.lang.String r2 = "remove_search_animation"
            r1 = 0
            r0 = 1
            int r1 = r3.LIZ(r2, r1, r0)
            r0 = 2
            if (r1 != r0) goto L_0x001e
            boolean r0 = android.text.TextUtils.isEmpty(r4)
            if (r0 == 0) goto L_0x001e
        L_0x001d:
            return
        L_0x001e:
            r0 = r5
            X.HCo.LIZ(r0)
            goto L_0x001d
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.search.activity.SearchResultActivity.finish():void");
    }

    /* JADX WARNING: type inference failed for: r4v0, types: [com.ss.android.ugc.aweme.search.activity.SearchResultActivity, X.SNU, android.app.Activity] */
    public final void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.search.activity.SearchResultActivity", "onResume", true);
        super.onResume();
        MGk.LIZ.LIZ();
        C3419SXn.LIZJ.LIZ((Map<String, String>) new LinkedHashMap(), false);
        2Yt.LIZJ = hashCode();
        F5K.LIZ = hashCode();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.search.activity.SearchResultActivity", "onResume", false);
    }

    public SearchResultActivity() {
        for (SearchMusicPlayerLifecycleObserver LIZ2 : 6iy.LIZ(new SearchMusicPlayerLifecycleObserver(this))) {
            getLifecycleOwner();
            getLifecycle().LIZ(LIZ2);
        }
        this.LJIIIIZZ = 7he.LIZ(new Cg3(this));
    }

    private final SV0 LIZLLL() {
        Intent intent = getIntent();
        if (intent == null) {
            return null;
        }
        String LIZ2 = LIZ(intent, "keyword");
        String LIZ3 = LIZ(intent, "display_keyword");
        if (TextUtils.isEmpty(LIZ3)) {
            LIZ3 = LIZ(intent, "displayKeyword");
        }
        String LIZ4 = LIZ(intent, "enter_from");
        String LIZ5 = LIZ(intent, "search_from");
        String LIZ6 = LIZ(intent, "enter_method");
        if (TextUtils.isEmpty(LIZ4)) {
            return null;
        }
        SV0 sv0 = new SV0();
        sv0.setRealSearchWord(LIZ2);
        if (!TextUtils.isEmpty(LIZ3)) {
            LIZ2 = LIZ3;
        }
        sv0.setKeyword(LIZ2);
        sv0.setSearchFrom(LIZ5);
        sv0.setEnterMethod(LIZ6);
        return sv0;
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [com.ss.android.ugc.aweme.search.activity.SearchResultActivity, X.SNU, android.app.Activity] */
    public final void onStop() {
        8gF.LIZLLL(this);
        super.onStop();
        if (!C3347SUt.LIZ) {
            QKL.LIZLLL = 300;
        }
        C3347SUt.LIZ = false;
        LIZJ().setSearchPageVisible(false);
        LIZJ().setIsLeavingSearch(false);
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    private final void LJFF() {
        String str;
        C3596Sbo sbo;
        String LIZ2;
        String str2;
        String str3;
        String str4;
        if (getIntent() != null) {
            Intent intent = getIntent();
            SV0 sv0 = (SV0) intent.getSerializableExtra("searchParam");
            this.LIZLLL = sv0;
            if (sv0 == null || (str = sv0.getKeyword()) == null) {
                str = "";
            }
            this.LJ = str;
            SearchIntermediateViewModel LIZIZ2 = LIZIZ();
            SV0 sv02 = this.LIZLLL;
            if (sv02 != null) {
                sbo = sv02.getTimeParam();
            } else {
                sbo = null;
            }
            LIZIZ2.timeParam = sbo;
            SV5 sv5 = (SV5) intent.getSerializableExtra("search_enter_param");
            SXD sxd = (SXD) intent.getSerializableExtra("search_context_source");
            LIZ(sv5);
            LIZIZ(sv5);
            if (this.LIZLLL == null) {
                this.LIZLLL = LIZLLL();
            }
            SV0 sv03 = this.LIZLLL;
            if (sv03 == null) {
                finish();
                return;
            }
            if (sv5 == null) {
                sv5 = sv03.getSearchEnterParam();
                if (sv5 != null) {
                    str2 = sv5.getEnterSearchFrom();
                } else {
                    str2 = null;
                }
                SW6 sw6 = new SW6(str2, (String) null, false, false, (String) null, (String) null, 0, 126, (2HN) null);
                if (sv5 != null) {
                    str3 = sv5.getAuthorId();
                    str4 = sv5.getGroupId();
                } else {
                    str3 = null;
                    str4 = null;
                }
                sxd = new SXD(new SV6(sw6, (SV7) null, new MWv(str3, str4), (7ZM) null, 10, (2HN) null), (SY7) null, 2, (2HN) null);
            }
            if (!(sv5 != null || (LIZ2 = LIZ(intent, "enter_from")) == null || LIZ2.length() == 0)) {
                String LIZ3 = LIZ(intent, "group_id");
                String LIZ4 = LIZ(intent, "author_id");
                SV4 newBuilder = SV5.Companion.newBuilder();
                newBuilder.LIZ = LIZ2;
                newBuilder.LIZJ = LIZ3;
                newBuilder.LIZLLL = LIZ4;
                sv5 = newBuilder.LIZ();
            }
            if (sxd == null) {
                String LIZ5 = LIZ(intent, "enter_from");
                if (LIZ5 == null || LIZ5.length() == 0) {
                    sxd = new SXD((SV6) null, (SY7) null, 3, (2HN) null);
                } else {
                    String LIZ6 = LIZ(intent, "group_id");
                    sxd = new SXD(new SV6(new SW6(LIZ5, (String) null, false, false, (String) null, (String) null, 0, 126, (2HN) null), (SV7) null, new MWv(LIZ(intent, "author_id"), LIZ6), (7ZM) null, 10, (2HN) null), (SY7) null, 2, (2HN) null);
                }
            }
            EaU.LIZ.LIZ(this).LIZJ.LIZJ().LIZ("source_default_key", sxd, SXD.class);
            EaU.LIZ.LIZ(this).LIZJ.LIZJ().LIZ("source_default_key", new C3419SXn(), C3419SXn.class);
            if (sv5 != null) {
                SearchEnterViewModel.LIZJ.LIZ(this).LIZ(this, sv5);
            }
            SV0 sv04 = this.LIZLLL;
            if (sv04 == null) {
                n.LIZIZ();
            }
            sv04.setOpenNewSearchContainer(true);
            SV0 sv05 = this.LIZLLL;
            if (sv05 == null) {
                n.LIZIZ();
            }
            LIZ(sv05, sv5);
            return;
        }
        finish();
    }

    /* JADX WARNING: type inference failed for: r7v0, types: [com.ss.android.ugc.aweme.search.activity.SearchResultActivity, X.SNU, android.app.Activity] */
    public final void onDestroy() {
        View decorView;
        8gF.LJ(this);
        Window window = getWindow();
        if (!(window == null || (decorView = window.getDecorView()) == null)) {
            C3670Sd0 sd0 = C3671Sd1.LIZIZ;
            n.LIZIZ(decorView, "");
            sd0.LIZIZ(decorView);
        }
        super.onDestroy();
        SU9.LIZLLL--;
        SU9.LIZJ--;
        if (SU9.LIZLLL <= 0) {
            SU9.LIZ.clear();
        }
        C3328SUa.LIZ.clear();
        C3329SUb.LIZ.clear();
        C3411SXf.LJIIJ = 0;
        C3411SXf.LJIIJJI = 0;
        C3411SXf.LIZIZ = false;
        C3411SXf.LIZJ = false;
        C3411SXf.LIZLLL = false;
        SearchEnterViewModel.LIZJ.LIZ(this);
        SearchEnterViewModel.LIZIZ.remove(Integer.valueOf(hashCode()));
        int hashCode = hashCode();
        Map map = 2Yt.LIZ;
        if (map == null) {
            n.LIZIZ();
        }
        for (Set set : map.values()) {
            if (set == null) {
                n.LIZIZ();
            }
            Iterator it = set.iterator();
            while (it.hasNext()) {
                if (((2Yu) it.next()).LIZJ == hashCode) {
                    it.remove();
                }
            }
        }
        C3427SXv sXv = C3427SXv.LIZ;
        sXv.LIZIZ--;
        if (sXv.LIZIZ <= 0) {
            EventBus.LIZ().LIZIZ((Object) sXv);
            sXv.LIZ().clear();
            sXv.LIZIZ = 0;
        }
        SearchApiNew.LIZLLL.clear();
        C3298SSw sSw = C3298SSw.LIZJ;
        M12.LIZ(this);
        sSw.LIZIZ(this);
        if (C3298SSw.LIZ.size() == 0) {
            FLI.LIZ().unregisterActivityLifecycleCallbacks(sSw);
            if (EventBus.LIZ().LIZ((Object) sSw)) {
                C4618SsI.LIZIZ(sSw);
            }
            C3298SSw.LIZIZ = false;
        }
        int hashCode2 = hashCode();
        ConcurrentLinkedDeque concurrentLinkedDeque = 8gI.LIZ;
        ArrayList<Cwu> arrayList = new ArrayList<>();
        for (Object next : concurrentLinkedDeque) {
            Cwu cwu = (Cwu) next;
            if (!(cwu == null || hashCode2 != ((Number) cwu.getFirst()).intValue() || cwu.getSecond() == null)) {
                arrayList.add(next);
            }
        }
        for (Cwu cwu2 : arrayList) {
            8gI.LIZ.remove(cwu2);
            ((C3439SYh) cwu2.getSecond()).LIZLLL();
        }
        LgM.LIZIZ.LIZ(this);
        AgT.LIZIZ.remove(Integer.valueOf(hashCode()));
    }

    public static final /* synthetic */ View LIZ(SearchResultActivity searchResultActivity) {
        View view = searchResultActivity.LIZIZ;
        if (view == null) {
            n.LIZ("");
        }
        return view;
    }

    public final void onNewIntent(Intent intent) {
        SearchResultActivity.super.onNewIntent(intent);
        MGk.LIZ.LIZ();
        setIntent(intent);
        LJFF();
    }

    public final void onRestoreInstanceState(Bundle bundle) {
        M12.LIZ(bundle);
        super.onRestoreInstanceState(bundle);
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("is_recreate", 1);
        a.LIZ("search_recreate_monitor", jSONObject);
    }

    private final void LIZ(SV5 sv5) {
        if (sv5 != null) {
            if (sv5.getUseSingleStack()) {
                n.LIZIZ(getIntent().putExtra("in_single_stack", true), "");
            } else {
                LJ();
            }
            sv5.setUseSingleStack(false);
        }
    }

    private final void LIZIZ(SV5 sv5) {
        if (sv5 != null && 36a.LIZ(sv5.getEnterSearchFrom())) {
            SharedViewModelProvider sharedViewModelProvider = new SharedViewModelProvider(new 1Bd());
            0CD lifecycle = getLifecycle();
            n.LIZIZ(lifecycle, "");
            SearchInfoViewModel LIZ2 = sharedViewModelProvider.LIZ(lifecycle, SearchInfoViewModel.class);
            String enterSearchFrom = sv5.getEnterSearchFrom();
            if (enterSearchFrom == null) {
                n.LIZIZ();
            }
            LIZ2.LIZ(enterSearchFrom);
        }
    }

    public final boolean dispatchTouchEvent(MotionEvent motionEvent) {
        Boolean isShowingFeedbackGuide;
        SXK LIZJ2 = SXD.Companion.LIZJ(this);
        if (LIZJ2 == null || (isShowingFeedbackGuide = LIZJ2.isShowingFeedbackGuide()) == null || !isShowingFeedbackGuide.booleanValue()) {
            return super.dispatchTouchEvent(motionEvent);
        }
        SXK LIZJ3 = SXD.Companion.LIZJ(this);
        if (LIZJ3 != null) {
            LIZJ3.setShowingFeedbackGuide(false);
        }
        return super.dispatchTouchEvent(motionEvent);
    }

    public final void onConfigurationChanged(Configuration configuration) {
        boolean z;
        M12.LIZ(configuration);
        super.onConfigurationChanged(configuration);
        if (!LJI()) {
            if (Build.VERSION.SDK_INT >= 24) {
                z = isInMultiWindowMode();
            } else {
                z = false;
            }
            int i = configuration.screenWidthDp;
            int i2 = configuration.screenHeightDp;
            Context LIZ2 = 9EH.LJJIFFI.LIZ();
            if ((!"HUAWEI".equalsIgnoreCase(Build.MANUFACTURER) || !LIZ2.getPackageManager().hasSystemFeature("com.huawei.hardware.sensor.posture")) && ((!"HUAWEI".equalsIgnoreCase(Build.MANUFACTURER) || (!"HWTAH ".equalsIgnoreCase(Build.DEVICE) && !"HWTAH-C".equalsIgnoreCase(Build.DEVICE) && !"unknownRLI".equalsIgnoreCase(Build.DEVICE) && !"unknownRHA".equalsIgnoreCase(Build.DEVICE))) && (!"HUAWEI".equalsIgnoreCase(Build.MANUFACTURER) || (!"TAH-AN00".equalsIgnoreCase(Build.MODEL) && !"TAH-N29".equalsIgnoreCase(Build.MODEL) && !"TAH-AN00m".equalsIgnoreCase(Build.MODEL) && !"TAH-N29m".equalsIgnoreCase(Build.MODEL) && !"RLI-AN00".equalsIgnoreCase(Build.MODEL) && !"RLI-N29".equalsIgnoreCase(Build.MODEL) && !"RHA-AN00m".equalsIgnoreCase(Build.MODEL) && !"RHA-N29m".equalsIgnoreCase(Build.MODEL))))) {
                3Ft.LIZ = false;
                3Ft.LIZIZ = 0;
                3Ft.LIZJ = 0;
            } else {
                3Ft.LIZ = z;
                if (z) {
                    3Ft.LIZIZ = i;
                    3Ft.LIZJ = i2;
                } else {
                    3Ft.LIZIZ = 0;
                    3Ft.LIZJ = 0;
                }
            }
            if (z != LJIIIZ) {
                getSupportFragmentManager().LIZ("container");
            }
            LJIIIZ = z;
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v21, resolved type: com.ss.android.ugc.aweme.search.activity.SearchResultActivity[]} */
    /* JADX WARNING: type inference failed for: r5v1, types: [android.content.Context, X.0CH, com.ss.android.ugc.aweme.search.activity.SearchResultActivity, X.1oX, X.SNU, java.lang.Object, android.app.Activity] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* JADX WARNING: Unknown variable types count: 1 */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onCreate(android.os.Bundle r18) {
        /*
            r17 = this;
            r5 = r17
            r5 = r5
            r1 = r18
            X.8gF.LIZ(r5, r1)
            java.lang.String r4 = "com.ss.android.ugc.aweme.search.activity.SearchResultActivity"
            java.lang.String r3 = "onCreate"
            r7 = 1
            com.bytedance.apm.agent.v2.instrumentation.ActivityAgent.onTrace(r4, r3, r7)
            X.S6h r0 = new X.S6h
            r0.<init>(r5)
            r5.activityConfiguration(r0)
            super.onCreate(r1)
            X.FNa r1 = X.FNa.INSTANCE
            r0 = 2131561086(0x7f0d0a7e, float:1.8747563E38)
            r6 = 0
            android.view.View r0 = r1.getView(r5, r0, r6)
            r5.setContentView((android.view.View) r0)
            r5.LJFF()
            X.MGk r0 = X.MGk.LIZ
            r0.LIZ()
            boolean r0 = r5.LJI()
            r2 = 0
            if (r0 != 0) goto L_0x004e
            java.lang.String r8 = r5.LJ
            X.M12.LIZ(r8)
            X.9Y1 r1 = X.9Y1.LIZ()
            java.lang.String r0 = "remove_search_animation"
            int r0 = r1.LIZ(r0, r2, r7)
            if (r0 == 0) goto L_0x00bf
            boolean r0 = android.text.TextUtils.isEmpty(r8)
            if (r0 == 0) goto L_0x00bf
        L_0x004e:
            X.SSw r1 = X.C3298SSw.LIZJ
            X.M12.LIZ(r5)
            boolean r0 = X.C3298SSw.LIZIZ
            if (r0 != 0) goto L_0x0063
            android.app.Application r0 = X.FLI.LIZ()
            r0.registerActivityLifecycleCallbacks(r1)
            X.C4618SsI.LIZ(r1)
            X.C3298SSw.LIZIZ = r7
        L_0x0063:
            r1.LIZ((android.app.Activity) r5)
            X.Le7.LIZ()
            X.FNa r1 = X.FNa.INSTANCE
            X.SeE r0 = new X.SeE
            r0.<init>(r5)
            r1.async(r0)
            X.SXv r1 = X.C3427SXv.LIZ
            int r0 = r1.LIZIZ
            int r0 = r0 + r7
            r1.LIZIZ = r0
            org.greenrobot.eventbus.EventBus r0 = org.greenrobot.eventbus.EventBus.LIZ()
            org.greenrobot.eventbus.EventBus.LIZ((org.greenrobot.eventbus.EventBus) r0, (java.lang.Object) r1)
            r0 = 2131365380(0x7f0a0e04, float:1.8350624E38)
            android.view.View r1 = r5.findViewById(r0)
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r1, r0)
            r5.LIZIZ = r1
            X.Crj r0 = r5.LJII
            java.lang.Object r0 = r0.getValue()
            com.ss.android.ugc.aweme.search.activity.SearchGlobalViewModel r0 = (com.ss.android.ugc.aweme.search.activity.SearchGlobalViewModel) r0
            androidx.lifecycle.LiveData<java.lang.Integer> r1 = r0.LIZJ
            X.Lve r0 = new X.Lve
            r0.<init>(r5)
            r1.observe(r5, r0)
            X.LgM r9 = X.LgM.LIZIZ
            X.M12.LIZ(r5)
            java.util.Queue r0 = X.LgM.LIZ
            java.util.Iterator r8 = r0.iterator()
            r1 = 0
        L_0x00ad:
            boolean r0 = r8.hasNext()
            if (r0 == 0) goto L_0x00cd
            java.lang.Object r0 = r8.next()
            java.util.List r0 = (java.util.List) r0
            int r0 = r0.size()
            int r1 = r1 + r0
            goto L_0x00ad
        L_0x00bf:
            int r1 = android.os.Build.VERSION.SDK_INT
            r0 = 30
            if (r1 < r0) goto L_0x00c9
            X.HCo.LIZ(r5, r7)
            goto L_0x004e
        L_0x00c9:
            X.HCo.LIZ(r5, r2)
            goto L_0x004e
        L_0x00cd:
            r0 = 6
            if (r1 < r0) goto L_0x00ea
            java.util.Queue r0 = X.LgM.LIZ
            java.lang.Object r1 = X.Lea.LJ(r0)
            java.util.List r1 = (java.util.List) r1
            if (r1 != 0) goto L_0x00df
            java.util.ArrayList r1 = new java.util.ArrayList
            r1.<init>()
        L_0x00df:
            boolean r0 = r1.isEmpty()
            if (r0 == 0) goto L_0x015b
            java.util.Queue r0 = X.LgM.LIZ
            r0.poll()
        L_0x00ea:
            java.util.Queue r0 = X.LgM.LIZ
            boolean r0 = r0.isEmpty()
            if (r0 != 0) goto L_0x0104
            android.content.Intent r0 = r5.getIntent()
            android.os.Bundle r1 = X.LgM.LIZ(r0)
            if (r1 == 0) goto L_0x0115
            java.lang.String r0 = "in_single_stack"
            boolean r0 = r1.getBoolean(r0)
            if (r0 == 0) goto L_0x0115
        L_0x0104:
            com.ss.android.ugc.aweme.search.activity.SearchResultActivity[] r0 = new com.ss.android.ugc.aweme.search.activity.SearchResultActivity[r7]
            r0[r2] = r5
            java.util.ArrayList r1 = X.LeS.LIZLLL(r0)
            java.util.Queue r0 = X.LgM.LIZ
            r0.offer(r1)
        L_0x0111:
            com.bytedance.apm.agent.v2.instrumentation.ActivityAgent.onTrace(r4, r3, r2)
            return
        L_0x0115:
            com.ss.android.ugc.aweme.search.activity.SearchResultActivity r1 = r9.LIZ()
            X.SXF r0 = X.SXD.Companion
            X.SXD r1 = r0.LIZ((X.0CH) r1)
            if (r1 != 0) goto L_0x0129
        L_0x0121:
            java.util.List r0 = r9.LIZIZ()
            r0.add(r5)
            goto L_0x0111
        L_0x0129:
            X.SXF r0 = X.SXD.Companion
            X.SXD r8 = r0.LIZ((X.0CH) r5)
            if (r8 != 0) goto L_0x0132
            goto L_0x0121
        L_0x0132:
            X.SXF r7 = X.SXD.Companion
            X.SV6 r10 = r8.getImmutableData()
            X.SV6 r0 = r1.getImmutableData()
            X.SW6 r11 = r0.getSearchCommonModel()
            r12 = 0
            X.SV6 r0 = r1.getImmutableData()
            X.MWv r13 = r0.getSearchVideoModel()
            r14 = 0
            r15 = 10
            r16 = 0
            X.SV6 r1 = X.SV6.copy$default(r10, r11, r12, r13, r14, r15, r16)
            r0 = 2
            X.SXD r0 = X.SXD.copy$default(r8, r1, r6, r0, r6)
            r7.LIZ((X.0CH) r5, (X.SXD) r0)
            goto L_0x0121
        L_0x015b:
            java.lang.Object r1 = r1.remove(r2)
            android.app.Activity r1 = (android.app.Activity) r1
            if (r1 == 0) goto L_0x00ea
            boolean r0 = r1.isDestroyed()
            if (r0 != 0) goto L_0x00ea
            boolean r0 = r1.isFinishing()
            if (r0 != 0) goto L_0x00ea
            r1.finish()
            goto L_0x00ea
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.search.activity.SearchResultActivity.onCreate(android.os.Bundle):void");
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }

    public final <VM1 extends JediViewModel<S1>, S1 extends 5Am, R> R withState(VM1 vm1, LsC<? super S1, ? extends R> lsC) {
        M12.LIZ(vm1, lsC);
        return 5wO.LIZ(vm1, lsC);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [android.content.Context] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private final void LIZ(X.SV0 r5, X.SV5 r6) {
        /*
            r4 = this;
            X.SRa r1 = com.ss.android.ugc.aweme.discover.ui.SearchResultFragment.LJJJJ
            r0 = r4
            com.ss.android.ugc.aweme.discover.ui.SearchResultFragment r3 = r1.LIZ(r5, r6, r0)
            X.0AA r0 = r4.getSupportFragmentManager()
            X.0AP r2 = r0.LIZ()
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r2, r0)
            r1 = 2131365158(0x7f0a0d26, float:1.8350173E38)
            java.lang.String r0 = "container"
            r2.LIZIZ(r1, r3, r0)
            r2.LIZJ()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.search.activity.SearchResultActivity.LIZ(X.SV0, X.SV5):void");
    }

    public final <S extends 5Am> 2cN subscribe(JediViewModel<S> jediViewModel, DUT<S> dut, LsD<? super DVU, ? super S, 2Pr> lsD) {
        M12.LIZ(jediViewModel, dut, lsD);
        return 5wO.LIZ(this, jediViewModel, dut, lsD);
    }

    public final <S extends 5Am, A> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, DUT<DRZ<A>> dut, LsD<? super DVU, ? super A, 2Pr> lsD) {
        M12.LIZ(jediViewModel, phd, dut, lsD);
        return 5wO.LIZ(this, jediViewModel, phd, dut, lsD);
    }

    public final <S extends 5Am, A, B> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, DUT<Cwt<A, B>> dut, LsE<? super DVU, ? super A, ? super B, 2Pr> lsE) {
        M12.LIZ(jediViewModel, phd, phd2, dut, lsE);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, dut, lsE);
    }

    public final <S extends 5Am, T> 2cN asyncSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends B8T<? extends T>> phd, DUT<DRZ<B8T<T>>> dut, LsD<? super DVU, ? super Throwable, 2Pr> lsD, LsC<? super DVU, 2Pr> lsC, LsD<? super DVU, ? super T, 2Pr> lsD2) {
        M12.LIZ(jediViewModel, phd, dut);
        return 5wO.LIZ(this, jediViewModel, phd, dut, lsD, lsC, lsD2);
    }

    public final <S extends 5Am, A, B, C> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, DUT<DV9<A, B, C>> dut, LsF<? super DVU, ? super A, ? super B, ? super C, 2Pr> lsF) {
        M12.LIZ(jediViewModel, phd, phd2, phd3, dut, lsF);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, phd3, dut, lsF);
    }

    public final <S extends 5Am, A, B, C, D> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, PHD<S, ? extends D> phd4, DUT<D4t<A, B, C, D>> dut, Lsh<? super DVU, ? super A, ? super B, ? super C, ? super D, 2Pr> lsh) {
        M12.LIZ(jediViewModel, phd, phd2, phd3, phd4, dut, lsh);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, phd3, phd4, dut, lsh);
    }
}
