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

import X.070;
import X.08R;
import X.0AP;
import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.0GV;
import X.0Gf;
import X.0Gp;
import X.0HH;
import X.1Bn;
import X.1hK;
import X.2GD;
import X.2GO;
import X.2ce;
import X.2ha;
import X.2jx;
import X.2kf;
import X.2sG;
import X.2xd;
import X.3KR;
import X.3ZQ;
import X.3bD;
import X.4ZZ;
import X.7V7;
import X.7he;
import X.81e;
import X.8Zu;
import X.8bl;
import X.9Y3;
import X.APJ;
import X.Ah9;
import X.B0Z;
import X.B0f;
import X.B0g;
import X.B0h;
import X.B6u;
import X.C1069Rc9;
import X.C3250SRa;
import X.C3251SRb;
import X.C3252SRc;
import X.C3292SSq;
import X.C3320STs;
import X.C3321STt;
import X.C3345SUr;
import X.C3354SVa;
import X.C3355SVb;
import X.C3384SWe;
import X.C3395SWp;
import X.C3396SWq;
import X.C3398SWs;
import X.C3403SWx;
import X.C3518SaY;
import X.C3527Sah;
import X.C5082Szm;
import X.C5084Szo;
import X.Cb6;
import X.CqM;
import X.Crj;
import X.D2T;
import X.D2W;
import X.Eqr;
import X.HeD;
import X.ISm;
import X.LdD;
import X.Ldl;
import X.LeH;
import X.Lea;
import X.LgM;
import X.Ls2;
import X.M12;
import X.MJG;
import X.MJh;
import X.MJp;
import X.MJq;
import X.MLO;
import X.MOH;
import X.MOI;
import X.OC9;
import X.SSW;
import X.SU9;
import X.SV0;
import X.SV1;
import X.SV5;
import X.SV6;
import X.SVQ;
import X.SVV;
import X.SVW;
import X.SVZ;
import X.SW1;
import X.SW2;
import X.SW3;
import X.SW4;
import X.SW5;
import X.SW6;
import X.SW8;
import X.SWF;
import X.SWG;
import X.SWH;
import X.SWJ;
import X.SWL;
import X.SWN;
import X.SWS;
import X.SX8;
import X.SXD;
import X.SXY;
import X.SYI;
import X.SYQ;
import android.animation.ArgbEvaluator;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.transition.Fade;
import android.transition.TransitionSet;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.widgets.NextLiveData;
import com.ss.android.agilelogger.ALog;
import com.ss.android.ugc.aweme.base.utils.KeyboardUtils;
import com.ss.android.ugc.aweme.discover.model.ISearchHistoryManager;
import com.ss.android.ugc.aweme.discover.model.SearchHistoryManager;
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.model.suggest.Word;
import com.ss.android.ugc.aweme.discover.model.tab.SearchTabJumpCenter;
import com.ss.android.ugc.aweme.discover.model.tab.SearchTabViewModel;
import com.ss.android.ugc.aweme.discover.ui.Dialog.SearchDialogFragment;
import com.ss.android.ugc.aweme.discover.viewmodel.SearchEnterViewModel;
import com.ss.android.ugc.aweme.im.sdk.common.controller.providedservices.IMService;
import com.ss.android.ugc.aweme.im.service.IIMService;
import com.ss.android.ugc.aweme.search.activity.SearchGlobalViewModel;
import com.ss.android.ugc.aweme.search.keyword.SearchEditTextViewModel;
import com.ss.android.ugc.aweme.search.survey.SurveyViewModel;
import com.ss.android.ugc.aweme.search.theme.dark.GlobalDarkThemeController;
import com.ss.android.ugc.aweme.search.theme.dark.ThemeViewModel;
import java.io.Serializable;
import java.util.Map;
import java.util.Objects;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public class SearchResultFragment extends BaseDiscoverAndSearchFragment implements SV1, 2GO {
    public static final int LJJJIL = 2ha.LIZ(16.0d);
    public static final C3250SRa LJJJJ = new C3250SRa((byte) 0);
    public ViewGroup LJJI;
    public ViewGroup LJJIFFI;
    public 4ZZ LJJII;
    public 4ZZ LJJIII;
    public ViewGroup LJJIIJ;
    public SearchIntermediateViewModel LJJIIJZLJL;
    public boolean LJJIIZ;
    public ThemeViewModel LJJIIZI;
    public SurveyViewModel LJJIJ;
    public Boolean LJJIJIIJI = false;
    public Integer LJJIJIIJIL;
    public Integer LJJIJIL;
    public Integer LJJIJL;
    public boolean LJJIJLIJ;
    public Integer LJJIL;
    public boolean LJJIZ;
    public boolean LJJJ;
    public String LJJJI = "";
    public View LJJJJI;
    public ViewGroup LJJJJIZL;
    public ViewGroup LJJJJJ;
    public View LJJJJJL;
    public ViewGroup LJJJJL;
    public View LJJJJLI;
    public int LJJJJLL = -1;
    public SearchEditTextViewModel LJJJJZ;
    public SearchGlobalViewModel LJJJJZI;
    public final Crj LJJJLIIL = 7he.LIZ(C3384SWe.LIZ);
    public final 3ZQ LJJJLL = 2xd.LIZ(C3251SRb.LIZ);
    public boolean LJJJLZIJ = true;
    public SparseArray LJJJZ;

    public final ArgbEvaluator LIZIZ() {
        return (ArgbEvaluator) this.LJJJLIIL.getValue();
    }

    public final int LJIIIIZZ() {
        return 2131561191;
    }

    public final int LJIIIZ() {
        return 2;
    }

    public final boolean LJIJJLI() {
        return false;
    }

    public Map<Integer, Object> getSubscriberEventTypes() {
        Map<Integer, Object> subscriberEventTypes = super.getSubscriberEventTypes();
        subscriberEventTypes.put(341, new C1069Rc9(SearchResultFragment.class, "onSetOnPageChangeListener", C3396SWq.class, ThreadMode.POSTING, 0, false));
        subscriberEventTypes.put(342, new C1069Rc9(SearchResultFragment.class, "onChangeBgColorEvent", C3395SWp.class, ThreadMode.POSTING, 0, false));
        subscriberEventTypes.put(343, new C1069Rc9(SearchResultFragment.class, "onSearchCorrectEvent", C3398SWs.class, ThreadMode.POSTING, 0, false));
        subscriberEventTypes.put(344, new C1069Rc9(SearchResultFragment.class, "onInnerSearchEvent", C3292SSq.class, ThreadMode.POSTING, 0, false));
        subscriberEventTypes.put(345, new C1069Rc9(SearchResultFragment.class, "onShareSearchCompleteEvent", B6u.class, ThreadMode.POSTING, 0, false));
        return subscriberEventTypes;
    }

    public final boolean LJJIIJ() {
        return this.LJJIZ;
    }

    private final 3ZQ LJJJJL() {
        3ZQ r1 = this.LJJJLL;
        r1.LJ = 2130968648;
        return r1;
    }

    public final int LIZJ() {
        if (this.LJJIIZ) {
            return 2131233781;
        }
        return 2131233780;
    }

    public final int LIZLLL() {
        if (this.LJJIIZ) {
            return 2131233791;
        }
        return 2131233790;
    }

    public final int LJ() {
        if (this.LJJIIZ) {
            return 2130968627;
        }
        return 2130968673;
    }

    public final void LJIIJ() {
        if (this.LJIJJ != null) {
            SV0 sv0 = this.LJIJJ;
            if (sv0 == null) {
                n.LIZIZ();
            }
            LIZIZ(sv0);
        }
    }

    public final int LJJIJL() {
        if (this.LJJIIZ) {
            return 2130968628;
        }
        return 2130968667;
    }

    public final int LJJIJLIJ() {
        if (this.LJJIIZ) {
            return 2131099686;
        }
        return 2131099750;
    }

    public final int LJJIZ() {
        if (this.LJJIIZ) {
            return 2131099689;
        }
        return 2131099758;
    }

    public final int LJJJ() {
        if (this.LJJIIZ) {
            return 2131233792;
        }
        return 2131233779;
    }

    public final ISearchHistoryManager LJJJJ() {
        ISearchHistoryManager inst = SearchHistoryManager.inst(LJIJI());
        n.LIZIZ(inst, "");
        return inst;
    }

    public void onStart() {
        SearchResultFragment.super.onStart();
        SWN.LIZ(EventBus.LIZ(), this);
    }

    public void onStop() {
        SearchResultFragment.super.onStop();
        SWN.LIZIZ(EventBus.LIZ(), this);
    }

    static {
        Covode.recordClassIndex(65541);
    }

    private final int LJJJJIZL() {
        if (LIZ() == null) {
            return 0;
        }
        SearchContainerFragment LIZ = LIZ();
        if (LIZ == null) {
            n.LIZIZ();
        }
        if (LIZ.LIZJ != null) {
            return LIZ.LIZJ.getCurrentItem();
        }
        return 0;
    }

    private final 3ZQ LJJJJJ() {
        int i;
        3ZQ r1 = this.LJJJLL;
        if (this.LJJIIZ) {
            i = 2130968624;
        } else {
            i = 2130968666;
        }
        r1.LJ = Integer.valueOf(i);
        return r1;
    }

    private final void LJJJJLL() {
        LIZIZ(2);
        EditText editText = this.LIZIZ;
        n.LIZIZ(editText, "");
        editText.setCursorVisible(false);
        LIZJ(true);
    }

    public final void LJIILJJIL() {
        if (LJJII() == 2) {
            this.LJJIZ = true;
            new OC9("SearchResultFragment#handleBackPressed").LIZ();
        }
    }

    public final String LJIJI() {
        String enterSearchFrom;
        SV5 sv5 = SearchEnterViewModel.LIZJ.LIZ(getActivity()).LIZ;
        if (sv5 == null || (enterSearchFrom = sv5.getEnterSearchFrom()) == null) {
            return "";
        }
        return enterSearchFrom;
    }

    public final void LJIL() {
        Window window;
        1hK activity = getActivity();
        if (activity != null && (window = activity.getWindow()) != null) {
            window.setSoftInputMode(51);
        }
    }

    public final boolean LJJIFFI() {
        SW6 searchCommonModel;
        SV6 LJ = SXD.Companion.LJ(getActivity());
        if (LJ == null || (searchCommonModel = LJ.getSearchCommonModel()) == null) {
            return true;
        }
        return searchCommonModel.getShouldShowSug();
    }

    public final String LJJIIJZLJL() {
        String LIZIZ = C3320STs.LIZIZ(LJJJJIZL());
        if (LIZIZ.length() <= 0 || LIZIZ == null) {
            return C3321STt.TOP.getTabName();
        }
        return LIZIZ;
    }

    public final int LJJIL() {
        if (n.LIZ(this.LJJIJIIJI, true)) {
            return 2131099686;
        }
        return 2131099731;
    }

    public final void LJJJI() {
        4ZZ r1;
        if (MJG.LIZIZ() && MJG.LIZ.LIZ() == 2 && (r1 = this.LJJIII) != null) {
            r1.setTuxIcon(2xd.LIZ(new C3252SRc(this)));
        }
    }

    public final int LJJJJI() {
        if (LIZ() == null) {
            return -1;
        }
        SearchContainerFragment LIZ = LIZ();
        if (LIZ == null) {
            n.LIZIZ();
        }
        return LIZ.LJIIL;
    }

    public void onDestroyView() {
        super.onDestroyView();
        8Zu.LIZ(8Zu.LIZ, new int[]{-1, -2});
        SparseArray sparseArray = this.LJJJZ;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    private final 3ZQ LJJJJJL() {
        int i;
        3ZQ r2 = this.LJJJLL;
        if (this.LJJIIZ) {
            i = 2131099685;
        } else {
            i = 2131099750;
        }
        Context context = getContext();
        if (context == null) {
            n.LIZIZ();
        }
        r2.LIZLLL = Integer.valueOf(08R.LIZIZ(070.LIZJ(context, i), 87));
        return r2;
    }

    private final void LJJJJZ() {
        if (this.LJIJJ != null && !this.LJJJLZIJ) {
            LgM lgM = LgM.LIZIZ;
            1hK requireActivity = requireActivity();
            n.LIZIZ(requireActivity, "");
            if (lgM.LIZ(requireActivity)) {
                LgM.LIZIZ.LIZIZ(getActivity());
            }
        }
    }

    public final SearchContainerFragment LIZ() {
        try {
            SearchContainerFragment LIZ = getChildFragmentManager().LIZ("Container");
            if (LIZ == null || !(LIZ instanceof SearchContainerFragment) || LIZ.isDetached()) {
                return null;
            }
            return LIZ;
        } catch (Exception e) {
            ALog.e("SearchResultFragment", e);
            1hK activity = getActivity();
            if (activity != null) {
                activity.finish();
            }
            return null;
        }
    }

    public final String LJJIIZ() {
        String str;
        C3321STt sTt = (C3321STt) Lea.LIZIZ(C3320STs.LIZ, LJJJJIZL());
        if (sTt == null || (str = sTt.getTabName()) == null) {
            str = "";
        }
        if (n.LIZ(str, C3321STt.HASHTAG.getTabName())) {
            str = "challenge";
        }
        if (str.length() > 0) {
            return str;
        }
        return C3321STt.TOP.getTabName();
    }

    public final 3ZQ LJJJIL() {
        Object obj;
        2ce<Boolean> showSearchFilterDot;
        ViewGroup viewGroup = this.LJJIIJ;
        if (viewGroup == null || !viewGroup.isClickable()) {
            return LJJJJJL();
        }
        SearchIntermediateViewModel searchIntermediateViewModel = this.LJJIIJZLJL;
        if (searchIntermediateViewModel == null || (showSearchFilterDot = searchIntermediateViewModel.getShowSearchFilterDot()) == null) {
            obj = null;
        } else {
            obj = showSearchFilterDot.getValue();
        }
        if (n.LIZ(obj, true)) {
            return LJJJJL();
        }
        return LJJJJJ();
    }

    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0042, code lost:
        if (X.SW5.LIZ() == false) goto L_0x0044;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private final boolean LJJJJLI() {
        /*
            r6 = this;
            X.SXF r0 = X.SXD.Companion
            r5 = r6
            X.SV6 r0 = r0.LJ(r5)
            r4 = 0
            if (r0 == 0) goto L_0x0054
            X.SW6 r0 = r0.getSearchCommonModel()
            if (r0 == 0) goto L_0x0054
            int r0 = r0.getBackPressFlag()
            java.lang.Integer r1 = java.lang.Integer.valueOf(r0)
        L_0x0018:
            r3 = 0
            r2 = 1
            if (r1 != 0) goto L_0x0045
        L_0x001c:
            X.1hK r0 = r6.requireActivity()
            java.lang.String r1 = ""
            kotlin.h.b.n.LIZIZ(r0, r1)
            boolean r0 = X.SW5.LIZIZ(r0)
            if (r0 != 0) goto L_0x0044
            boolean r0 = X.SW5.LIZ((X.0CH) r5)
            if (r0 == 0) goto L_0x0056
            X.1hK r0 = r6.requireActivity()
            kotlin.h.b.n.LIZIZ(r0, r1)
            boolean r0 = X.SW5.LIZJ(r0)
            if (r0 != 0) goto L_0x0056
            boolean r0 = X.SW5.LIZ()
            if (r0 != 0) goto L_0x0056
        L_0x0044:
            return r2
        L_0x0045:
            int r0 = r1.intValue()
            if (r0 != r2) goto L_0x004c
            return r3
        L_0x004c:
            int r1 = r1.intValue()
            r0 = 2
            if (r1 != r0) goto L_0x001c
            return r2
        L_0x0054:
            r1 = r4
            goto L_0x0018
        L_0x0056:
            boolean r0 = X.ST7.LIZ((X.SV0) r4)
            if (r0 == 0) goto L_0x005d
            return r2
        L_0x005d:
            return r3
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.SearchResultFragment.LJJJJLI():boolean");
    }

    public final void LJFF() {
        1hK requireActivity = requireActivity();
        n.LIZIZ(requireActivity, "");
        if (SW5.LIZIZ(requireActivity) || LJIILLIIL()) {
            super.LJFF();
        } else {
            requireActivity.finish();
        }
        LgM.LIZIZ.LIZ(requireActivity);
    }

    public final void LJIIJJI() {
        2ce<Word> firstGuessWord;
        super.LJJIJIIJIL();
        new OC9("SearchResultFragment#handleBackPressed").LIZ();
        KeyboardUtils.LIZJ(this.LIZIZ);
        if (!LIZ(MLO.PRESS_LEFT_BACK)) {
            1hK activity = getActivity();
            if (activity == null) {
                n.LIZIZ();
            }
            activity.finishAfterTransition();
            if (getActivity() == null || !SW5.LIZ(requireActivity())) {
                CqM.LIZ(new Eqr(false));
            }
            SX8.LIZ(2);
            SWS.LJFF.LIZ();
            SearchIntermediateViewModel searchIntermediateViewModel = this.LJIILL;
            if (searchIntermediateViewModel != null && (firstGuessWord = searchIntermediateViewModel.getFirstGuessWord()) != null) {
                firstGuessWord.setValue(new Word(LJIILIIL(), ""));
            }
        }
    }

    public void onResume() {
        super.onResume();
        8bl.LIZ(SVV.LIZ, 100);
        if (9Y3.LIZ(9Y3.LIZ(), true, "search_filter_entrance_animated", 0) > 0 && !D2W.LIZ.LIZIZ.getBoolean("has_shown_filter_animated", false)) {
            long LIZ = D2W.LIZ.LIZ("first_shown_filter_animated_time");
            if (LIZ != 0) {
                long currentTimeMillis = System.currentTimeMillis();
                if (currentTimeMillis - LIZ > 604800000 || currentTimeMillis - D2W.LIZ.LIZ("last_shown_filter_animated_time") <= 86400000) {
                    return;
                }
            }
            4ZZ r3 = this.LJJII;
            if (r3 != null) {
                r3.postDelayed(new D2T(this), 1000);
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:34:0x007b  */
    /* JADX WARNING: Removed duplicated region for block: B:37:0x0085  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LJJ() {
        /*
            r5 = this;
            super.LJJ()
            com.ss.android.ugc.aweme.discover.model.SearchIntermediateViewModel r0 = r5.LJJIIJZLJL
            r2 = 0
            if (r0 == 0) goto L_0x0011
            X.2ce r0 = r0.getSugRequestKeyword()
            if (r0 == 0) goto L_0x0011
            r0.setValue(r2)
        L_0x0011:
            X.SV0 r0 = r5.LJIJJ
            if (r0 == 0) goto L_0x0019
            java.lang.String r2 = r0.getSearchFrom()
        L_0x0019:
            boolean r0 = r5.LJIILLIIL()
            r4 = 0
            r3 = 1
            if (r0 == 0) goto L_0x008f
            X.SV0 r0 = r5.LJIJJ
            if (r0 != 0) goto L_0x0028
            kotlin.h.b.n.LIZIZ()
        L_0x0028:
            boolean r0 = r0.isOpenNewSearchContainer()
            if (r0 == 0) goto L_0x008f
            r1 = 1
        L_0x002f:
            java.lang.String r0 = "homepage_follow"
            boolean r0 = kotlin.h.b.n.LIZ(r2, r0)
            if (r0 != 0) goto L_0x008d
            java.lang.String r0 = "homepage_hot"
            boolean r0 = kotlin.h.b.n.LIZ(r2, r0)
            if (r0 != 0) goto L_0x008d
            java.lang.String r0 = "homepage_friends"
            boolean r0 = kotlin.h.b.n.LIZ(r2, r0)
            if (r0 != 0) goto L_0x008d
            java.lang.String r0 = "homepage_popular"
            boolean r0 = kotlin.h.b.n.LIZ(r2, r0)
            if (r0 != 0) goto L_0x008d
            java.lang.String r0 = "homepage_nearby"
            boolean r0 = kotlin.h.b.n.LIZ(r2, r0)
            if (r0 != 0) goto L_0x008d
            if (r1 != 0) goto L_0x008d
            r1 = 1
        L_0x005a:
            X.SW2 r0 = r5.LJIIJJI
            r0.LIZ((boolean) r1)
            r2 = 3
            r5.LIZIZ((int) r2)
            X.SWJ r1 = new X.SWJ
            java.lang.String r0 = r5.LJIIL()
            r1.<init>(r0)
            r5.LJI()
            com.ss.android.ugc.aweme.discover.model.SearchIntermediateViewModel r0 = r5.LJJIIJZLJL
            if (r0 == 0) goto L_0x0087
            boolean r0 = r0.hasOpenedSearch
            if (r0 != 0) goto L_0x0087
            android.widget.EditText r0 = r5.LIZIZ
            if (r0 == 0) goto L_0x007e
            r0.setCursorVisible(r3)
        L_0x007e:
            r5.LJIIZILJ()
            com.ss.android.ugc.aweme.discover.model.SearchIntermediateViewModel r0 = r5.LJJIIJZLJL
            if (r0 == 0) goto L_0x0087
            r0.keyboardVisibility = r3
        L_0x0087:
            X.SX8.LIZ(r2)
            X.SWS.LIZJ = r4
            return
        L_0x008d:
            r1 = 0
            goto L_0x005a
        L_0x008f:
            r1 = 0
            goto L_0x002f
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.discover.ui.SearchResultFragment.LJJ():void");
    }

    public final void LJIILL() {
        View view;
        ViewGroup viewGroup;
        ViewGroup viewGroup2;
        ViewGroup viewGroup3;
        View view2;
        ViewGroup viewGroup4;
        ViewGroup viewGroup5;
        4ZZ r0;
        4ZZ r02;
        boolean z;
        1Bn<String> LJ;
        1Bn<Cb6> LIZJ;
        1Bn<Cb6> LIZLLL;
        NextLiveData<EditText> LIZ;
        2ce<Object> defaultHintEvent;
        2ce<Word> firstGuessWord;
        2ce<Boolean> showSearchFilterDot;
        2ce<Boolean> enableSearchFilter;
        2ce<Integer> intermediateState;
        2ce<Boolean> dismissKeyboard;
        SW6 searchCommonModel;
        super.LJIILL();
        View view3 = getView();
        ViewGroup viewGroup6 = null;
        if (view3 != null) {
            view = view3.findViewById(16908335);
        } else {
            view = null;
        }
        this.LJJJJLI = view;
        View view4 = getView();
        if (view4 != null) {
            viewGroup = (ViewGroup) view4.findViewById(2131367451);
        } else {
            viewGroup = null;
        }
        this.LJJJJIZL = viewGroup;
        if (viewGroup == null) {
            n.LIZIZ();
        }
        ViewParent parent = viewGroup.getParent();
        Objects.requireNonNull(parent, "null cannot be cast to non-null type android.view.View");
        this.LJJJJI = (View) parent;
        View view5 = getView();
        if (view5 != null) {
            viewGroup2 = (ViewGroup) view5.findViewById(2131369886);
        } else {
            viewGroup2 = null;
        }
        this.LJJJJJ = viewGroup2;
        View view6 = getView();
        if (view6 != null) {
            viewGroup3 = (ViewGroup) view6.findViewById(2131369635);
        } else {
            viewGroup3 = null;
        }
        this.LJJIFFI = viewGroup3;
        View view7 = getView();
        if (view7 != null) {
            view2 = view7.findViewById(2131362574);
        } else {
            view2 = null;
        }
        this.LJJJJJL = view2;
        View view8 = getView();
        if (view8 != null) {
            viewGroup4 = (ViewGroup) view8.findViewById(2131364990);
        } else {
            viewGroup4 = null;
        }
        this.LJJI = viewGroup4;
        View view9 = getView();
        if (view9 != null) {
            viewGroup5 = (ViewGroup) view9.findViewById(2131371415);
        } else {
            viewGroup5 = null;
        }
        this.LJJJJL = viewGroup5;
        View view10 = getView();
        if (view10 != null) {
            r0 = (4ZZ) view10.findViewById(2131366623);
        } else {
            r0 = null;
        }
        this.LJJIII = r0;
        View view11 = getView();
        if (view11 != null) {
            r02 = (4ZZ) view11.findViewById(2131366625);
        } else {
            r02 = null;
        }
        this.LJJII = r02;
        View view12 = getView();
        if (view12 != null) {
            viewGroup6 = (ViewGroup) view12.findViewById(2131369887);
        }
        this.LJJIIJ = viewGroup6;
        if (viewGroup6 != null) {
            viewGroup6.setOnClickListener(new B0Z(this));
        }
        APJ.LIZ(this.LJIIIZ, 0.5f);
        SV6 LJ2 = SXD.Companion.LJ(getActivity());
        if (LJ2 == null || (searchCommonModel = LJ2.getSearchCommonModel()) == null) {
            z = true;
        } else {
            z = searchCommonModel.getShouldShowScanView();
        }
        if (z) {
            ImageView imageView = this.LJIIIZ;
            n.LIZIZ(imageView, "");
            imageView.setVisibility(0);
        } else {
            ViewGroup viewGroup7 = this.LJJI;
            if (viewGroup7 != null) {
                ViewGroup.LayoutParams layoutParams = viewGroup7.getLayoutParams();
                if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
                    ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin = (int) HeD.LIZIZ(getContext(), 16.0f);
                }
                viewGroup7.setLayoutParams(layoutParams);
            }
            ImageView imageView2 = this.LJIIIZ;
            n.LIZIZ(imageView2, "");
            imageView2.setVisibility(8);
        }
        SearchIntermediateViewModel searchIntermediateViewModel = this.LJJIIJZLJL;
        if (!(searchIntermediateViewModel == null || (dismissKeyboard = searchIntermediateViewModel.getDismissKeyboard()) == null)) {
            dismissKeyboard.observe(this, new B0h(this));
        }
        if (Ah9.LIZ) {
            SearchIntermediateViewModel searchIntermediateViewModel2 = this.LJJIIJZLJL;
            if (!(searchIntermediateViewModel2 == null || (intermediateState = searchIntermediateViewModel2.getIntermediateState()) == null)) {
                intermediateState.observe(this, new SWF(this));
            }
            SearchIntermediateViewModel searchIntermediateViewModel3 = this.LJJIIJZLJL;
            if (!(searchIntermediateViewModel3 == null || (enableSearchFilter = searchIntermediateViewModel3.getEnableSearchFilter()) == null)) {
                enableSearchFilter.observe(this, new B0g(this));
            }
            SearchIntermediateViewModel searchIntermediateViewModel4 = this.LJJIIJZLJL;
            if (!(searchIntermediateViewModel4 == null || (showSearchFilterDot = searchIntermediateViewModel4.getShowSearchFilterDot()) == null)) {
                showSearchFilterDot.observe(this, new B0f(this));
            }
        }
        SearchIntermediateViewModel searchIntermediateViewModel5 = this.LJJIIJZLJL;
        if (!(searchIntermediateViewModel5 == null || (firstGuessWord = searchIntermediateViewModel5.getFirstGuessWord()) == null)) {
            firstGuessWord.observe(this, new SW8(this));
        }
        SearchIntermediateViewModel searchIntermediateViewModel6 = this.LJJIIJZLJL;
        if (!(searchIntermediateViewModel6 == null || (defaultHintEvent = searchIntermediateViewModel6.getDefaultHintEvent()) == null)) {
            defaultHintEvent.observe(this, new C3355SVb(this));
        }
        SearchEditTextViewModel searchEditTextViewModel = this.LJJJJZ;
        if (!(searchEditTextViewModel == null || (LIZ = searchEditTextViewModel.LIZ()) == null)) {
            LIZ.setValue(this.LIZIZ);
        }
        ThemeViewModel themeViewModel = this.LJJIIZI;
        if (!(themeViewModel == null || (LIZLLL = themeViewModel.LIZLLL()) == null)) {
            LIZLLL.observe(this, new SW1(this));
        }
        ThemeViewModel themeViewModel2 = this.LJJIIZI;
        if (!(themeViewModel2 == null || (LIZJ = themeViewModel2.LIZJ()) == null)) {
            LIZJ.observe(this, new SW3(this));
        }
        ThemeViewModel themeViewModel3 = this.LJJIIZI;
        if (!(themeViewModel3 == null || (LJ = themeViewModel3.LJ()) == null)) {
            LJ.observe(this, new SWG(this));
        }
        1hK requireActivity = requireActivity();
        n.LIZIZ(requireActivity, "");
        if (n.LIZ("dark", LIZ(requireActivity).LIZ(ThemeViewModel.class).LIZ)) {
            LJI("dark");
        }
        C3403SWx sWx = GlobalDarkThemeController.LJFF;
        1hK requireActivity2 = requireActivity();
        n.LIZIZ(requireActivity2, "");
        M12.LIZ(requireActivity2);
        if (requireActivity2.isFinishing() || requireActivity2.isDestroyed()) {
            throw new IllegalStateException("bad activity status");
        }
        GlobalDarkThemeController globalDarkThemeController = sWx.LIZ().get(requireActivity2.hashCode());
        if (globalDarkThemeController == null) {
            globalDarkThemeController = new GlobalDarkThemeController(requireActivity2, (byte) 0);
            sWx.LIZ().put(requireActivity2.hashCode(), globalDarkThemeController);
        }
        if (SXY.LIZIZ()) {
            globalDarkThemeController.LIZ().observe(globalDarkThemeController.LIZLLL, globalDarkThemeController.LIZJ);
        }
        LJJJI();
    }

    public static 0Bx LIZ(1hK r2) {
        0Bx LIZ = 0By.LIZ(r2, (0Bv) null);
        if (2GD.LIZ) {
            0Bs.LIZ(LIZ, r2);
        }
        return LIZ;
    }

    public final void LIZ(SV0 sv0) {
        M12.LIZ(sv0);
        if (SearchStateViewModel.isSearchIntermediate(LJJII()) && !TextUtils.isEmpty(sv0.getKeyword())) {
            LIZJ(sv0);
            LIZIZ(sv0);
        }
    }

    public final void LIZIZ(View view) {
        if (this.LIZIZ != null) {
            this.LIZIZ.post(new SW4(this));
        }
    }

    @ISm
    public final void onInnerSearchEvent(C3292SSq sSq) {
        M12.LIZ(sSq);
        SearchStateViewModel searchStateViewModel = this.LJIILIIL;
        if (searchStateViewModel != null) {
            searchStateViewModel.setIsRefreshingData(true);
        }
        LIZIZ(sSq.LIZ);
    }

    @ISm
    public final void onSearchCorrectEvent(C3398SWs sWs) {
        M12.LIZ(sWs);
        SV0 sv0 = new SV0();
        sv0.setKeyword(sWs.LIZ);
        sv0.setNeedCorrect(0);
        sv0.setSearchFrom("correct_word");
        n.LIZIZ(sv0, "");
        LIZIZ(sv0);
    }

    private final void LIZIZ(MLO mlo) {
        boolean z;
        if (LJJII() != 2 || MJh.LIZ(mlo)) {
            z = true;
        } else {
            z = false;
        }
        LIZIZ(z);
        this.LJJJ = true;
        SearchIntermediateViewModel searchIntermediateViewModel = this.LJJIIJZLJL;
        if (searchIntermediateViewModel != null) {
            searchIntermediateViewModel.enterSearchMiddlePageByBack = true;
        }
        LJJ();
        this.LIZIZ.setText("");
        this.LIZIZ.setSelection(0);
        LIZ(z);
    }

    private final void LIZLLL(SV0 sv0) {
        SearchContainerFragment LIZ = SearchContainerFragment.LIZ(sv0);
        LIZ.LJIJJ = new SVZ(this);
        LIZ.LJIJJLI = new C3354SVa(this);
        0AP LIZ2 = getChildFragmentManager().LIZ();
        LIZ2.LIZIZ(2131365158, LIZ, "Container");
        LIZ2.LJ();
        SU9.LJ.LIZIZ();
    }

    private final String LJ(SV0 sv0) {
        2sG r3 = new 2sG();
        r3.element = sv0.getKeyword();
        if (!TextUtils.isEmpty(sv0.getRealSearchWord())) {
            r3.element = sv0.getRealSearchWord();
        }
        if (SVQ.LIZ((String) r3.element)) {
            return null;
        }
        0Gp.LIZ(new SSW(this, sv0, r3), 0Gp.LIZ, (0Gf) null);
        return (String) r3.element;
    }

    private final void LJFF(SV0 sv0) {
        String str;
        Ls2<String> ls2;
        SWL swl = new SWL();
        swl.LJIILL(sv0.getSearchFrom());
        SearchIntermediateViewModel searchIntermediateViewModel = this.LJJIIJZLJL;
        if (searchIntermediateViewModel == null || (ls2 = searchIntermediateViewModel.getIntermediateContainer) == null) {
            str = null;
        } else {
            str = (String) ls2.invoke();
        }
        swl.LJIJJ(str);
        swl.LJFF();
    }

    @ISm
    public final void onSetOnPageChangeListener(C3396SWq sWq) {
        SearchContainerFragment LIZ;
        M12.LIZ(sWq);
        if (this.LJFF && sWq.LIZIZ != null) {
            SearchContainerFragment LIZ2 = LIZ();
            if (LIZ2 != null) {
                0GV r1 = sWq.LIZIZ;
                LIZ2.LJIIJJI = null;
                if (LIZ2.LIZJ != null) {
                    LIZ2.LIZJ.removeOnPageChangeListener(r1);
                }
            }
            if (sWq.LIZ && (LIZ = LIZ()) != null) {
                LIZ.LIZ(sWq.LIZIZ);
            }
        }
    }

    @ISm
    public final void onShareSearchCompleteEvent(B6u b6u) {
        IIMService createIIMServicebyMonsterPlugin;
        M12.LIZ(b6u);
        if (aq_() && TextUtils.equals("search", b6u.LIZLLL) && (createIIMServicebyMonsterPlugin = IMService.createIIMServicebyMonsterPlugin(false)) != null && getActivity() != null && this.LJJJJIZL != null) {
            createIIMServicebyMonsterPlugin.showIMSnackbar(getActivity(), this.LJJJJIZL, b6u);
        }
    }

    public final void LIZ(View view) {
        M12.LIZ(view);
        super.LIZ(view);
        this.LIZ = view.findViewById(2131365257);
        this.LIZLLL = view.findViewById(2131369970);
        this.LJ = (TextView) view.findViewById(2131372294);
        this.LJIIIZ = (ImageView) view.findViewById(2131362573);
        this.LJIIJ = (FrameLayout) view.findViewById(2131365158);
        this.LJIIJJI = (SW2) view.findViewById(2131369934);
        this.LJIIJJI.LJI = 2131369934;
    }

    public final void LIZJ(SV0 sv0) {
        Integer num;
        NextLiveData nextLiveData;
        2ce<Integer> searchTabIndex;
        M12.LIZ(sv0);
        SearchIntermediateViewModel searchIntermediateViewModel = this.LJJIIJZLJL;
        if (searchIntermediateViewModel == null || (searchTabIndex = searchIntermediateViewModel.getSearchTabIndex()) == null || (num = (Integer) searchTabIndex.getValue()) == null) {
            num = -1;
        }
        n.LIZIZ(num, "");
        String LIZ = C3320STs.LIZ(num.intValue());
        SV5 searchEnterParam = sv0.getSearchEnterParam();
        if ((searchEnterParam == null || !searchEnterParam.getKeepTabPosition()) && !TextUtils.equals(LIZ, "general")) {
            SYI LIZLLL = SXD.Companion.LIZLLL(getActivity());
            if (LIZLLL != null) {
                LIZLLL.setLastShowingPageIndex(0);
            }
            SearchTabViewModel searchTabViewModel = SearchTabJumpCenter.INSTANCE.getSearchTabViewModel();
            if (searchTabViewModel != null && (nextLiveData = searchTabViewModel.tabInfo) != null) {
                nextLiveData.setValue(new 2jx("general"));
            }
        }
    }

    public final void LIZLLL(String str) {
        SearchStateViewModel searchStateViewModel = this.LJIILIIL;
        boolean z = true;
        if (searchStateViewModel != null) {
            searchStateViewModel.setIsRefreshingData(true);
        }
        EditText editText = this.LIZIZ;
        n.LIZIZ(editText, "");
        String obj = editText.getHint().toString();
        if (!TextUtils.isEmpty(str) || TextUtils.isEmpty(obj) || LIZ(obj)) {
            z = false;
        } else {
            SWH swh = new SWH();
            swh.LJIJI("click");
            swh.LJIILJJIL("default_search_keyword");
            swh.LJIJJ(str);
            swh.LJIJJLI("general_word");
            swh.LJFF();
            str = obj;
        }
        LIZ(str, z);
    }

    public final void LJ(boolean z) {
        if (z) {
            ViewGroup viewGroup = this.LJJIIJ;
            if (viewGroup != null) {
                viewGroup.setVisibility(0);
            }
            TextView textView = this.LJ;
            if (textView != null) {
                textView.setVisibility(8);
            }
        } else {
            ViewGroup viewGroup2 = this.LJJIIJ;
            if (viewGroup2 != null) {
                viewGroup2.setVisibility(8);
            }
            TextView textView2 = this.LJ;
            if (textView2 != null) {
                textView2.setVisibility(0);
            }
        }
        if (MJG.LIZIZ()) {
            ViewGroup viewGroup3 = this.LJJIIJ;
            if (viewGroup3 != null) {
                viewGroup3.setVisibility(8);
            }
            TextView textView3 = this.LJ;
            if (textView3 != null) {
                textView3.setVisibility(0);
            }
        }
    }

    public final void LJI(String str) {
        this.LJJIIZ = "dark".equals(str);
        1hK requireActivity = requireActivity();
        n.LIZIZ(requireActivity, "");
        int LIZ = SXY.LIZ(requireActivity, !this.LJJIIZ);
        C5082Szm szm = C5084Szo.LIZIZ;
        1hK activity = getActivity();
        if (activity == null) {
            n.LIZIZ();
        }
        n.LIZIZ(activity, "");
        C5084Szo LIZ2 = szm.LIZ(activity);
        LIZ2.LIZIZ(LIZ);
        LIZ2.LIZIZ(!this.LJJIIZ);
        LIZ2.LIZ.LIZJ();
        LIZJ(LIZ);
        View view = this.LJJJJI;
        if (view != null) {
            view.setBackgroundColor(LIZ);
        }
    }

    @ISm
    public final void onChangeBgColorEvent(C3395SWp sWp) {
        M12.LIZ(sWp);
        if (this.LJFF) {
            Window window = null;
            if (!sWp.LIZIZ) {
                ViewGroup viewGroup = this.LJJJJL;
                if (viewGroup != null) {
                    viewGroup.setBackground((Drawable) null);
                }
                View view = this.LIZ;
                if (view != null) {
                    view.setBackground((Drawable) null);
                }
                ViewGroup viewGroup2 = this.LJJJJJ;
                if (viewGroup2 != null) {
                    viewGroup2.setBackground((Drawable) null);
                }
                ViewGroup viewGroup3 = this.LJJJJIZL;
                if (viewGroup3 != null) {
                    viewGroup3.setBackground(sWp.LIZ);
                }
                1hK activity = getActivity();
                if (activity != null) {
                    window = activity.getWindow();
                }
                3KR.LIZ(window, 0);
                return;
            }
            Context context = getContext();
            if (context != null) {
                if (this.LJJJJLL == -1) {
                    this.LJJJJLL = 070.LIZJ(context, 2131099659);
                }
                ViewGroup viewGroup4 = this.LJJJJL;
                if (viewGroup4 != null) {
                    viewGroup4.setBackgroundColor(this.LJJJJLL);
                }
                View view2 = this.LIZ;
                if (view2 != null) {
                    view2.setBackgroundColor(this.LJJJJLL);
                }
                ViewGroup viewGroup5 = this.LJJJJJ;
                if (viewGroup5 != null) {
                    viewGroup5.setBackgroundColor(this.LJJJJLL);
                }
                ViewGroup viewGroup6 = this.LJJJJIZL;
                if (viewGroup6 != null) {
                    viewGroup6.setBackground((Drawable) null);
                }
                1hK activity2 = getActivity();
                if (activity2 != null) {
                    window = activity2.getWindow();
                }
                3KR.LIZ(window, this.LJJJJLL);
            }
        }
    }

    public final void LIZ(SWJ swj) {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        if (LJII() || LJIILLIIL()) {
            SearchIntermediateViewModel searchIntermediateViewModel = this.LJJIIJZLJL;
            if (searchIntermediateViewModel == null || !searchIntermediateViewModel.backFromSearchResult) {
                str = "search_bar_outer";
            } else {
                str = "search_bar_inner";
            }
            C3527Sah sah = new C3527Sah();
            SV5 LIZIZ = SearchEnterViewModel.LIZJ.LIZIZ(getActivity());
            String str6 = "";
            if (LIZIZ == null || (str2 = LIZIZ.getEnterSearchFrom()) == null) {
                str2 = str6;
            }
            sah.LJJIJIIJIL(str2);
            sah.LJJIII(LJIJ());
            sah.LIZLLL(0);
            sah.LJJI(str);
            if (swj == null || (str3 = swj.LIZ) == null) {
                str3 = str6;
            }
            sah.LJJIFFI(str3);
            if (swj == null || (str4 = swj.LIZIZ) == null) {
                str4 = str6;
            }
            sah.LJIIIIZZ(str4);
            if (!(swj == null || (str5 = swj.LIZJ) == null)) {
                str6 = str5;
            }
            sah.LIZLLL(str6);
            sah.LIZ((Integer) -1);
            Object obtainLogData = SearchEnterViewModel.LIZJ.LIZ(getActivity()).LIZIZ().obtainLogData("tab_name");
            if (obtainLogData != null) {
                sah.LIZ(obtainLogData);
            }
            sah.LJFF();
        }
        super.LIZ(swj);
    }

    public final void LIZIZ(SV0 sv0) {
        Integer num;
        boolean z;
        M12.LIZ(sv0);
        this.LJIJJ = sv0;
        String LJ = LJ(sv0);
        LJJJJZ();
        this.LJIILJJIL = LJ;
        if (TextUtils.isEmpty(this.LJIILJJIL)) {
            this.LIZIZ.setText("");
            return;
        }
        super.LIZIZ(sv0);
        8Zu.LIZ(8Zu.LIZ, new int[]{4, 1});
        String str = this.LJIILJJIL;
        n.LIZIZ(str, "");
        this.LJJJI = str;
        String keyword = sv0.getKeyword();
        LIZIZ(2);
        this.LIZIZ.setText(keyword);
        sv0.setKeyword(this.LJIILJJIL);
        SearchGlobalViewModel searchGlobalViewModel = this.LJJJJZI;
        if (searchGlobalViewModel != null) {
            num = Integer.valueOf(searchGlobalViewModel.LIZIZ());
        } else {
            num = null;
        }
        String str2 = this.LJIILJJIL;
        n.LIZIZ(str2, "");
        int LIZ = MOH.LIZ(str2, new LeH());
        if (num != null && num.intValue() == LIZ) {
            z = false;
        } else {
            z = true;
        }
        SearchGlobalViewModel searchGlobalViewModel2 = this.LJJJJZI;
        if (searchGlobalViewModel2 != null) {
            searchGlobalViewModel2.LIZIZ(LIZ);
        }
        if (LIZ() == null || z) {
            LIZLLL(sv0);
        } else {
            SearchContainerFragment LIZ2 = LIZ();
            if (LIZ2 == null) {
                n.LIZIZ();
            }
            LIZ2.LIZIZ(sv0);
            SV0 sv02 = this.LJIJJ;
            if (sv02 != null && sv02.isOpenNewSearchContainer()) {
                SearchContainerFragment LIZ3 = LIZ();
                if (LIZ3 == null) {
                    n.LIZIZ();
                }
                LIZ3.LIZ(0);
            }
        }
        LJJJJLL();
        4ZZ r0 = this.LIZJ;
        n.LIZIZ(r0, "");
        r0.setVisibility(0);
        KeyboardUtils.LIZJ(this.LIZIZ);
        LJFF(sv0);
        M12.LIZ("search_transfer_search");
        C3345SUr.LIZJ.LIZ();
        this.LJJJLZIJ = false;
        SV5 sv5 = SearchEnterViewModel.LIZJ.LIZ(getActivity()).LIZ;
        if (sv5 != null) {
            sv5.restEnterSearchPosition();
        }
        SearchIntermediateViewModel searchIntermediateViewModel = this.LJJIIJZLJL;
        if (searchIntermediateViewModel != null) {
            searchIntermediateViewModel.hasOpenedSearch = true;
        }
    }

    public final void LIZJ(int i) {
        ViewGroup viewGroup = this.LJJIFFI;
        if (viewGroup != null) {
            viewGroup.setBackgroundColor(i);
        }
        this.LJIIIZ.setImageResource(LIZJ());
        4ZZ r1 = this.LJJII;
        if (r1 != null) {
            r1.setTuxIcon(LJJJIL());
        }
        4ZZ r12 = this.LJJIII;
        if (r12 != null) {
            r12.setImageResource(LIZLLL());
        }
        if (MJG.LIZIZ()) {
            this.LIZJ.setTintColorRes(LJJIJL());
        } else {
            this.LIZJ.setTintColorRes(LJ());
        }
        1hK activity = getActivity();
        if (activity == null) {
            n.LIZIZ();
        }
        int LIZJ = 070.LIZJ(activity, LJJIJLIJ());
        1hK activity2 = getActivity();
        if (activity2 == null) {
            n.LIZIZ();
        }
        int LIZJ2 = 070.LIZJ(activity2, LJJIZ());
        EditText editText = this.LIZIZ;
        if (editText != null) {
            editText.setTextColor(LIZJ);
        }
        EditText editText2 = this.LIZIZ;
        if (editText2 != null) {
            editText2.setHintTextColor(LIZJ2);
        }
        ViewGroup viewGroup2 = this.LJJI;
        if (viewGroup2 != null) {
            viewGroup2.setBackgroundResource(LJJJ());
        }
        LJJJI();
        TextView textView = this.LJ;
        if (textView != null) {
            1hK activity3 = getActivity();
            if (activity3 == null) {
                n.LIZIZ();
            }
            textView.setTextColor(070.LIZJ(activity3, LJJIL()));
        }
    }

    public final void LIZLLL(boolean z) {
        81e LIZ;
        String schema;
        2ce<Boolean> showSearchFilterDot;
        Object obj = null;
        if (z) {
            ViewGroup viewGroup = this.LJJIIJ;
            if (viewGroup != null) {
                viewGroup.setClickable(true);
            }
            SearchIntermediateViewModel searchIntermediateViewModel = this.LJJIIJZLJL;
            if (!(searchIntermediateViewModel == null || (showSearchFilterDot = searchIntermediateViewModel.getShowSearchFilterDot()) == null)) {
                obj = showSearchFilterDot.getValue();
            }
            if (n.LIZ(obj, true)) {
                4ZZ r1 = this.LJJII;
                if (r1 != null) {
                    r1.setTuxIcon(LJJJJL());
                    return;
                }
                return;
            }
            4ZZ r12 = this.LJJII;
            if (r12 != null) {
                r12.setTuxIcon(LJJJJJ());
                return;
            }
            return;
        }
        SearchContainerFragment LIZ2 = LIZ();
        if (LIZ2 == null || (LIZ = 7V7.LIZ(C3320STs.LIZ(LIZ2.LJIIL))) == null || (schema = LIZ.getSchema()) == null || schema.length() == 0) {
            ViewGroup viewGroup2 = this.LJJIIJ;
            if (viewGroup2 != null) {
                viewGroup2.setClickable(false);
            }
            4ZZ r13 = this.LJJII;
            if (r13 != null) {
                r13.setTuxIcon(LJJJJJL());
            }
            SearchDialogFragment.LJIJI.LIZ(getActivity());
            return;
        }
        ViewGroup viewGroup3 = this.LJJIIJ;
        if (viewGroup3 != null) {
            viewGroup3.setClickable(true);
        }
        4ZZ r14 = this.LJJII;
        if (r14 != null) {
            r14.setTuxIcon(LJJJJJ());
        }
    }

    public void onCreate(Bundle bundle) {
        String str;
        super.onCreate(bundle);
        if (getArguments() != null) {
            Bundle arguments = getArguments();
            if (arguments == null) {
                n.LIZIZ();
            }
            Serializable serializable = arguments.getSerializable("searchParam");
            Objects.requireNonNull(serializable, "null cannot be cast to non-null type com.ss.android.ugc.aweme.search.model.SearchResultParam");
            this.LJIJJ = (SV0) serializable;
        }
        1hK activity = getActivity();
        if (activity != null) {
            this.LJJIIJZLJL = LIZ(activity).LIZ(SearchIntermediateViewModel.class);
            this.LJJJJZ = LIZ(activity).LIZ(SearchEditTextViewModel.class);
            this.LJJIIZI = LIZ(activity).LIZ(ThemeViewModel.class);
            this.LJJIJ = LIZ(activity).LIZ(SurveyViewModel.class);
            this.LJJJJZI = LIZ(activity).LIZ(SearchGlobalViewModel.class);
        }
        Object obj = Ldl.LIZ.LIZ().get(LdD.class);
        if (!(obj instanceof LdD)) {
            obj = null;
        }
        LdD ldD = (LdD) obj;
        if (ldD != null) {
            if (MOI.LIZ.LIZ() && MJq.LIZ.LIZ()) {
                str = "preset_search_queries";
            } else if (!MOI.LIZ.LIZIZ() || !MJp.LIZ.LIZ()) {
                str = "";
            } else {
                str = "preset_search_queries_double_to_single";
            }
            M12.LIZ(str);
            if (str.length() == 0 || (ldD.LIZJ.length() > 0 && (!n.LIZ(ldD.LIZJ, str)))) {
                ldD.LIZLLL();
            }
            ldD.LIZJ = str;
        }
    }

    public final boolean LIZ(MLO mlo) {
        M12.LIZ(mlo);
        if (LJJII() == 2) {
            new OC9("SearchResultFragment#handleBackPressed").LIZ();
        }
        if (getActivity() == null || this.LJIJJ == null) {
            return false;
        }
        LJJIII();
        int LJJII2 = LJJII();
        if (LJJII2 == 2) {
            LgM lgM = LgM.LIZIZ;
            1hK requireActivity = requireActivity();
            n.LIZIZ(requireActivity, "");
            if (lgM.LIZ(requireActivity) || !LJJJJLI()) {
                return false;
            }
            LIZIZ(mlo);
            return true;
        } else if (LJJII2 != 3 || !(!TextUtils.isEmpty(this.LIZIZ.getText().toString().trim()))) {
            return false;
        } else {
            LgM lgM2 = LgM.LIZIZ;
            1hK requireActivity2 = requireActivity();
            n.LIZIZ(requireActivity2, "");
            if (lgM2.LIZ(requireActivity2)) {
                this.LIZIZ.setText(this.LJJJI);
                LJJJJLL();
                return true;
            } else if (!LJJJJLI()) {
                return false;
            } else {
                LIZIZ(mlo);
                return true;
            }
        }
    }

    public final void LIZIZ(String str) {
        String LJJIIZ2;
        SV5 sv5 = SearchEnterViewModel.LIZJ.LIZ(getActivity()).LIZ;
        if (sv5 != null) {
            if (this.LJJJ) {
                SYQ syq = new SYQ();
                syq.LIZIZ(sv5.obtainLogData("is_from_video"));
                syq.LIZJ(SW5.LIZIZ());
                syq.LIZ(sv5.obtainLogData("tab_name"));
                syq.LJIILL("cancel");
                syq.LJIILJJIL("return");
                syq.LJFF();
                this.LJJJ = false;
                return;
            }
            int LJJII2 = LJJII();
            if (LJJII2 == 2) {
                LJJIIZ2 = LJJIIZ();
            } else if (LJJII2 != 3) {
                LJJIIZ2 = LJIJI();
            } else if (this.LJJIZ) {
                LJJIIZ2 = LJJIIZ();
            } else {
                LJJIIZ2 = LJIJI();
            }
            SYQ syq2 = new SYQ();
            syq2.LIZIZ(sv5.obtainLogData("is_from_video"));
            syq2.LIZJ(SW5.LIZIZ());
            syq2.LIZ(sv5.obtainLogData("tab_name"));
            syq2.LJIILL(str);
            syq2.LJIILJJIL(LJJIIZ2);
            syq2.LJFF();
        }
    }

    public final void LIZJ(String str) {
        String str2;
        int LJJJJIZL2 = LJJJJIZL();
        if (LJJJJIZL2 == C3320STs.LIZ()) {
            str2 = "general_search";
        } else if (LJJJJIZL2 == C3320STs.LIZIZ.LIZIZ()) {
            str2 = "search_user";
        } else if (LJJJJIZL2 == C3320STs.LIZIZ.LJFF()) {
            str2 = "search_tag";
        } else if (LJJJJIZL2 == C3320STs.LIZIZ.LIZLLL()) {
            str2 = "search_music";
        } else if (LJJJJIZL2 == C3320STs.LIZIZ.LIZJ()) {
            str2 = "search_video";
        } else {
            return;
        }
        C3518SaY saY = new C3518SaY();
        saY.LJIILL(str);
        saY.LJIILJJIL(str2);
        saY.LJFF();
        SVW.LIZ = System.currentTimeMillis();
    }

    public void onViewCreated(View view, Bundle bundle) {
        Window window;
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        TransitionSet transitionSet = new TransitionSet();
        Fade fade = new Fade();
        3bD r1 = new 3bD();
        r1.addTarget(2131369397);
        transitionSet.addTransition(r1);
        transitionSet.addTransition(fade);
        1hK activity = getActivity();
        if (!(activity == null || (window = activity.getWindow()) == null)) {
            window.setEnterTransition(transitionSet);
        }
        2kf.LIZIZ("SearchResultFragment", "initWindowTransition");
        Context context = view.getContext();
        n.LIZIZ(context, "");
        M12.LIZ(context);
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        View LIZ = 0HH.LIZ(LayoutInflater.from(requireActivity()), 2131561191, viewGroup, false);
        n.LIZIZ(LIZ, "");
        LIZ(LIZ);
        return LIZ;
    }
}
