QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 SearchFrame.java 源代码,内容仅作参考


package com.tencent.mtt.search.view.common;

import MTT.SmartBox_HotWordsItem;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.widget.LinearLayout;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.common.manifest.annotation.CreateMethod;
import com.tencent.common.manifest.annotation.EventReceiver;
import com.tencent.common.task.CancellationTokenSource;
import com.tencent.common.task.Continuation;
import com.tencent.common.task.QBTask;
import com.tencent.common.utils.QbModeUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.browser.WebEngine;
import com.tencent.mtt.browser.bra.addressbar.AddressBarController;
import com.tencent.mtt.browser.bra.addressbar.AddressBarDataSource;
import com.tencent.mtt.browser.engine.clipboard.ClipValue;
import com.tencent.mtt.browser.engine.clipboard.ClipboardManager;
import com.tencent.mtt.browser.hotword.HotWordManager;
import com.tencent.mtt.browser.hotword.facade.IHomePageHotwordsListener;
import com.tencent.mtt.browser.hotword.search.SearchHotwordManager;
import com.tencent.mtt.browser.inputmethod.facade.IClipboardManager;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.search.DirectFunnelReporter;
import com.tencent.mtt.search.ISearchUrlDispatcher;
import com.tencent.mtt.search.SearchUtils;
import com.tencent.mtt.search.data.SearchOpenData;
import com.tencent.mtt.search.data.entrance.SearchEntranceInfo;
import com.tencent.mtt.search.data.history.SearchHistoryManager;
import com.tencent.mtt.search.data.history.SearchInputHistory;
import com.tencent.mtt.search.directShare.SearchDirectShareDialog;
import com.tencent.mtt.search.hotwords.SearchHotwordInfo;
import com.tencent.mtt.search.network.MTT.SmartBox_Egg;
import com.tencent.mtt.search.network.MTT.SmartBox_ThirdPageWordItem;
import com.tencent.mtt.search.searchEngine.SearchEngineManager;
import com.tencent.mtt.search.searchEngine.urlloader.SearchUrlLoader;
import com.tencent.mtt.search.searchEngine.urlloader.SearchUrlLoaderConfig;
import com.tencent.mtt.search.statistics.SearchLog;
import com.tencent.mtt.search.statistics.SearchStartPagePerformanceMonitor;
import com.tencent.mtt.search.view.ISearchPage;
import com.tencent.mtt.search.view.ISearchWindow;
import com.tencent.mtt.search.view.SearchFrameBase;
import com.tencent.mtt.search.view.SearchWindow;
import com.tencent.mtt.search.view.common.cloudconfig.SearchCloudConfigManager;
import com.tencent.mtt.search.view.common.home.SearchHomeViewNew;
import com.tencent.mtt.search.view.common.skin.SearchFrameSkinManager;
import com.tencent.mtt.search.view.input.SearchInputBarController;
import com.tencent.mtt.search.view.input.SearchInputView;
import com.tencent.mtt.search.view.reactnative.SearchRNListView;
import com.tencent.mtt.search.view.reactnative.homepage.SearchHippyHomeManager;
import com.tencent.mtt.search.view.reactnative.homepage.SearchHippyHomeView;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.supportui.views.recyclerview.RecyclerViewBase;
import com.xiaomi.mipush.sdk.Constants;
import java.util.concurrent.Callable;
import java.util.regex.Pattern;
import qb.search.BuildConfig;

public class SearchFrame extends SearchFrameBase implements IHomePageHotwordsListener, RecyclerViewBase.OnScrollListener {
    private static boolean q = false;
    private static boolean w = true;
    String i;
    public boolean j;
    private SearchPageFactory k;
    private ISearchPage l;
    private LinearLayout.LayoutParams m;
    private Handler n;
    private String o;
    private int p;
    private ISearchUrlDispatcher r;
    private String s;
    private boolean t;
    private String u;
    private boolean v;
    private ISearchPage x;

    class AnonymousClass8 implements Runnable {

        final String f70515a;

        final SearchFrame f70516b;

        @Override
        public void run() {
            if (this.f70516b.s()) {
                SearchFrame searchFrame = this.f70516b;
                searchFrame.i = this.f70515a;
                searchFrame.f70467d.getInputController().a().setAutoScrollToSelectEndEnabled(false);
                this.f70516b.f70467d.getInputController().a().setText(this.f70515a);
                this.f70516b.f70467d.getInputController().a().selectAll();
                AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
                alphaAnimation.setDuration(200L);
                this.f70516b.f70467d.getInputController().a().startAnimation(alphaAnimation);
                StatManager.b().c("N24");
            }
        }
    }

    public SearchFrame(Context context, ISearchWindow iSearchWindow, SearchInputBarController.OnBackButtonClickListener onBackButtonClickListener) {
        super(context, iSearchWindow, 0);
        this.o = null;
        this.i = null;
        this.p = 0;
        this.j = false;
        this.s = null;
        this.t = false;
        this.v = true;
        this.x = null;
        this.n = new Handler(this);
        this.r = iSearchWindow.getSearchUrlDispatcher();
        ISearchUrlDispatcher iSearchUrlDispatcher = this.r;
        this.f70467d.setCanSwitchSearchEngine(iSearchUrlDispatcher == null || iSearchUrlDispatcher.r());
        this.k = new SearchPageFactory(this);
        this.k.b(context, this.r);
        HotWordManager.getInstance().addHomePageHotwordsListener(this);
        EventEmiter.getDefault().register("SearchConst.event_show_hotword", this);
        a();
        setBackgroundColor(SearchFrameSkinManager.a().b() ? MttResources.d(R.color.theme_search_frame_bg_color) : MttResources.c(R.color.theme_search_frame_bg_color));
    }

    public void a(View view, LinearLayout.LayoutParams layoutParams) {
        if (this.p != 1 || view == null) {
            return;
        }
        if (view.getParent() != null) {
            ((ViewGroup) view.getParent()).removeView(view);
        }
        b(view, layoutParams);
    }

    private void a(CancellationTokenSource cancellationTokenSource) {
        ISearchPage iSearchPage = this.l;
        if (iSearchPage != null) {
            iSearchPage.dr_();
            ISearchPage iSearchPage2 = this.l;
            if (iSearchPage2 instanceof SearchRNListView) {
                this.x = iSearchPage2;
                b(cancellationTokenSource);
            } else if (iSearchPage2 instanceof SearchHippyHomeView) {
                m();
            } else {
                removeView(iSearchPage2.getView());
            }
        }
    }

    public void a(CancellationTokenSource cancellationTokenSource, int i) {
        this.l = this.k.a(this.f70465b, i, this.r);
        ISearchPage iSearchPage = this.l;
        if (iSearchPage == null) {
            return;
        }
        try {
            if (this.x != null && iSearchPage.getView() == this.x.getView()) {
                removeView(this.l.getView());
                cancellationTokenSource.c();
                this.x = null;
            }
            this.l.b();
            if (this.m == null) {
                this.m = new LinearLayout.LayoutParams(-1, -1);
            }
            if (this.l instanceof SearchHippyHomeView) {
                l();
            } else {
                b(this.l.getView(), this.m);
            }
        } catch (Exception unused) {
        }
    }

    public void a(IClipboardManager iClipboardManager) {
        if (iClipboardManager != null) {
            String b2 = b(iClipboardManager);
            String string = PublicSettingManager.a().getString("last_showed_expressage_code", "");
            if (TextUtils.isEmpty(b2) || TextUtils.equals(b2, string)) {
                return;
            }
            this.s = b2;
            b(b2);
            PublicSettingManager.a().setString("last_showed_expressage_code", b2);
        }
    }

    private void a(SmartBox_Egg smartBox_Egg) {
        if (smartBox_Egg == null || smartBox_Egg.iId < 0) {
            SearchLog.a("右键点击", "触发关键词搜索逻辑", "关键词为:" + this.f70467d.getText(), 1);
            this.r.a(this.f70467d.getText(), -1, "1_07_00_01");
            return;
        }
        SearchLog.a("右键点击", "触发彩蛋搜索逻辑", "关键词为:" + this.f70467d.getText(), 1);
        this.r.a(this.f70467d.getText(), smartBox_Egg.iId, "1_07_00_01");
    }

    static boolean a(int i, int i2) {
        return i == 1 && i2 == 2;
    }

    private boolean a(SmartBox_HotWordsItem smartBox_HotWordsItem) {
        return (smartBox_HotWordsItem == null || TextUtils.isEmpty(smartBox_HotWordsItem.sShowTitle)) ? false : true;
    }

    private boolean a(boolean z, boolean z2) {
        return (z || z2) && this.p == 2;
    }

    private String b(SmartBox_HotWordsItem smartBox_HotWordsItem) {
        return (smartBox_HotWordsItem == null || smartBox_HotWordsItem.mRichInfo == null) ? "" : smartBox_HotWordsItem.mRichInfo.get("search_label");
    }

    private String b(IClipboardManager iClipboardManager) {
        ClipValue lastClipValue = ClipboardManager.getInstance().getLastClipValue();
        if (TextUtils.isEmpty(lastClipValue.key)) {
            return "";
        }
        if (System.currentTimeMillis() - lastClipValue.time > Constants.ASSEMBLE_PUSH_NETWORK_INTERVAL) {
            return null;
        }
        return Pattern.matches("^[0-9a-zA-Z\\\\-\\\\_]{10,18}", lastClipValue.key) ? lastClipValue.key : "";
    }

    private void b(int i) {
        int i2 = this.p;
        if (i == i2) {
            return;
        }
        if (a(i2, i) && PublicSettingManager.a().getBoolean("ADR_ENABLE_BACK_SEARCH_PAGE", false) && this.f70466c != null) {
            this.f70466c.setBackStrategy(SearchWindow.BackStrategy.BACK_TO_SEARCHHOME_WITHOUT_INPUT);
        }
        this.p = i;
        final CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
        a(cancellationTokenSource);
        if (1 == i && SearchHippyHomeManager.getInstance().c()) {
            QBTask.b((Callable) new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    SearchFrame.this.a(cancellationTokenSource, 1);
                    return null;
                }
            });
        } else {
            a(cancellationTokenSource, i);
        }
    }

    private void b(View view, LinearLayout.LayoutParams layoutParams) {
        addView(view, layoutParams);
        if (!this.v || this.f70466c == null) {
            return;
        }
        SearchUrlLoader.a().a(this.f70466c);
        this.v = false;
    }

    private void b(CancellationTokenSource cancellationTokenSource) {
        QBTask.a((Object) null).b(new Continuation<Object, QBTask<Void>>() {
            @Override
            public QBTask<Void> then(QBTask<Object> qBTask) throws Exception {
                if (SearchFrame.this.x instanceof SearchRNListView) {
                    ((SearchRNListView) SearchFrame.this.x).d();
                }
                return QBTask.a(100L);
            }
        }, 6).a(new Continuation<Void, Object>() {
            @Override
            public Object then(QBTask<Void> qBTask) throws Exception {
                try {
                    SearchFrame.this.removeView(SearchFrame.this.x.getView());
                    SearchFrame.this.x = null;
                } catch (Exception unused) {
                }
                return null;
            }
        }, 6, cancellationTokenSource.b());
    }

    private boolean b(String str, String str2) {
        return this.r != null && (this.f70466c.getType() == 0 || this.f70466c.getType() == 2 || this.f70466c.getType() == 95) && TextUtils.isEmpty(str) && TextUtils.isEmpty(str2);
    }

    private void c(String str, String str2) {
        this.r.e(str);
        this.r.f(str2);
    }

    private boolean c(int i) {
        return i == 2 || i == 1;
    }

    private boolean c(int i, int i2, boolean z) {
        return ((i2 == 3 && i == 0) || (i == 0 && z)) && s();
    }

    private void d(String str) {
        int i;
        if (TextUtils.isEmpty(this.o) && TextUtils.isEmpty(this.i)) {
            if (TextUtils.isEmpty(this.e)) {
                i = 4;
            } else {
                if (TextUtils.isEmpty(this.s) || !TextUtils.equals(this.s, this.e)) {
                    SearchLog.b(this.e, "此次直达是用户自己输入的请求", "", 1);
                    this.f70466c.getDataManager().a(str, 0, getSearchDirectEnHanceMode(), this.f70466c.getActionIndex(), this.f70466c.getPreUrl(), this.f);
                } else {
                    SearchLog.b(this.e, "此次直达是由剪切板调起的请求", "", 1);
                    this.f70466c.getDataManager().a(str, 0, 14, this.f70466c.getActionIndex(), this.f70466c.getPreUrl(), this.f);
                    this.s = null;
                }
                i = 5;
            }
            DirectFunnelReporter.a(i);
        } else {
            SearchLog.b(this.e, "当前不是List视图,本次请求失败", "", -1);
        }
        k();
        try {
            if (this.j && this.f70466c.getType() == 3 && TextUtils.isEmpty(str)) {
                StatManager.b().c("BPDZ04");
                this.j = false;
            }
            this.j = true;
        } catch (Exception unused) {
        }
        this.f70466c.c();
    }

    private void d(String str, String str2) {
        if (f(str2)) {
            return;
        }
        this.f70467d.getInputController().a().a(str, str2);
        this.f70467d.f70679a.e();
    }

    private boolean e(String str) {
        return (this.f70467d == null || TextUtils.isEmpty(str) || SearchUtils.b(str) != 2) ? false : true;
    }

    private boolean f(String str) {
        return TextUtils.isEmpty(str) || this.f70467d == null || this.f70467d.getInputController() == null || this.f70467d.getInputController().a() == null;
    }

    private AddressBarDataSource getAddressBarDataSource() {
        if (WindowManager.a() == null || WindowManager.a().s() == null) {
            return null;
        }
        return WindowManager.a().s().getBussinessProxy().getCurrentBarDataSource();
    }

    private SmartBox_HotWordsItem getCurHotwordItem() {
        ISearchUrlDispatcher iSearchUrlDispatcher = this.r;
        if (iSearchUrlDispatcher == null || iSearchUrlDispatcher.t() == null || this.r.t().b()) {
            return null;
        }
        return this.r.t().e();
    }

    private String getCurrentUrl() {
        String urlFromDataSource = getUrlFromDataSource();
        getCurHotwordItem();
        ISearchUrlDispatcher iSearchUrlDispatcher = this.r;
        if (b(urlFromDataSource, (iSearchUrlDispatcher == null || TextUtils.isEmpty(iSearchUrlDispatcher.j())) ? "" : this.r.j())) {
            QBTask.c(new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    SearchFrame.this.a((IClipboardManager) QBContext.getInstance().getService(IClipboardManager.class));
                    return null;
                }
            });
        }
        return urlFromDataSource;
    }

    private SmartBox_HotWordsItem getFirstHotwordItem() {
        SmartBox_HotWordsItem smartBox_HotWordsItem;
        SearchHotwordInfo h = SearchHotwordManager.a().h();
        if (h == null || h.d() == null || h.d().size() <= 0 || (smartBox_HotWordsItem = h.d().get(0)) == null || TextUtils.isEmpty(smartBox_HotWordsItem.sShowTitle)) {
            return null;
        }
        return smartBox_HotWordsItem;
    }

    private String getUrlFromDataSource() {
        if (!this.f70466c.a()) {
            return "";
        }
        AddressBarDataSource addressBarDataSource = getAddressBarDataSource();
        String str = (addressBarDataSource == null || !addressBarDataSource.g) ? "" : addressBarDataSource.f35820a;
        if (!TextUtils.isEmpty(str)) {
            if (str.startsWith("qb://home") || UrlUtils.isDataBase64Url(str) || str.startsWith("qb://search") || str.startsWith("qb://tab")) {
                return "";
            }
            if (str.startsWith("qb://ext/voice")) {
                return str.replace("qb://ext/voice", "");
            }
        }
        return str;
    }

    private void k() {
        int i;
        if (!TextUtils.isEmpty(this.o)) {
            i = 3;
            this.o = null;
        } else if (TextUtils.isEmpty(this.i)) {
            i = !TextUtils.isEmpty(this.e) ? 2 : 1;
        } else {
            i = 4;
            this.i = null;
        }
        b(i);
    }

    private void l() {
        final View view = this.l.getView();
        final LinearLayout.LayoutParams layoutParams = this.m;
        if (!w) {
            QBTask.a(50L).a((Continuation<Void, TContinuationResult>) new Continuation<Void, Object>() {
                @Override
                public Object then(QBTask<Void> qBTask) throws Exception {
                    SearchFrame.this.a(view, layoutParams);
                    return null;
                }
            }, 6);
        } else {
            a(view, layoutParams);
            w = false;
        }
    }

    private void m() {
        final View view = this.l.getView();
        QBTask.a(150L).a((Continuation<Void, TContinuationResult>) new Continuation<Void, Object>() {
            @Override
            public Object then(QBTask<Void> qBTask) throws Exception {
                View view2 = view;
                if (view2 == null) {
                    return null;
                }
                SearchFrame.this.removeView(view2);
                return null;
            }
        }, 6);
    }

    private boolean n() {
        AddressBarDataSource addressBarDataSource;
        if (!this.f70466c.a() || (addressBarDataSource = getAddressBarDataSource()) == null) {
            return false;
        }
        return addressBarDataSource.g;
    }

    private void o() {
        SmartBox_ThirdPageWordItem smartBox_ThirdPageWordItem;
        if ((this.f70466c.getType() != 3 && this.f70466c.getType() != 96) || this.r.x() == null || this.r.x().size() <= 0 || (smartBox_ThirdPageWordItem = this.r.x().get(0)) == null || TextUtils.isEmpty(smartBox_ThirdPageWordItem.sWord)) {
            return;
        }
        this.f70467d.getInputController().a().setHint(smartBox_ThirdPageWordItem.sWord);
        this.f70467d.getInputController().e();
    }

    private void p() {
        SearchInputView searchInputView;
        boolean z;
        if (this.f70467d != null) {
            if ((getCurrentPage() instanceof SearchHomeViewNew) || (getCurrentPage() instanceof SearchRNListView)) {
                searchInputView = this.f70467d;
                z = false;
            } else {
                searchInputView = this.f70467d;
                z = true;
            }
            searchInputView.a(z, 50);
        }
    }

    private void q() {
        QBTask.c(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                WebEngine.e().g(SearchEngineManager.getInstance().getEngineUrl());
                String string = PublicSettingManager.a().getString("ANDROID_KD_TENCENT_SERACH_DOMAIN", "https://so.html5.qq.com/");
                if (TextUtils.isEmpty(string)) {
                    return null;
                }
                WebEngine.e().g(string);
                return null;
            }
        });
    }

    private void r() {
        QBTask.a(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                SearchDirectShareDialog.a();
                return null;
            }
        }, 5);
    }

    public boolean s() {
        return (this.f70467d == null || this.f70467d.getInputController() == null || this.f70467d.getInputController().a() == null) ? false : true;
    }

    private void t() {
        if (Looper.getMainLooper() == Looper.myLooper()) {
            u();
        } else {
            QBTask.b((Callable) new Callable<Object>() {
                @Override
                public Object call() throws Exception {
                    SearchFrame.this.u();
                    return null;
                }
            });
        }
    }

    public void u() {
        SmartBox_HotWordsItem firstHotwordItem = getFirstHotwordItem();
        if (HotWordManager.getInstance().isHotwordShow() && v() && a(firstHotwordItem)) {
            c(firstHotwordItem.sShowTitle, firstHotwordItem.sUrl);
            d(b(firstHotwordItem), firstHotwordItem.sShowTitle);
        } else {
            if (SearchUtils.a(this.r)) {
                return;
            }
            c("", "");
            d("", SearchInputBarController.d());
        }
    }

    private boolean v() {
        if (!FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_869367367)) {
            return SearchUtils.g(this.r.c(), this.r.d());
        }
        if (this.r.y() != null) {
            return this.r.y().a();
        }
        return false;
    }

    @Override
    public void a() {
        if (this.f70466c.getSearchOpenData().j) {
            return;
        }
        SearchUtils.i("HIPPY_PAGE_START");
        r();
        String currentUrl = getCurrentUrl();
        boolean g = this.f70466c.g();
        boolean b2 = this.f70466c.getSearchOpenData().b(SearchOpenData.f70129d);
        q();
        if (g && this.f70466c.getType() != 5) {
            o();
            getCurHotwordItem();
            ISearchUrlDispatcher iSearchUrlDispatcher = this.r;
            if (iSearchUrlDispatcher != null && !TextUtils.isEmpty(iSearchUrlDispatcher.j())) {
                this.u = this.r.j();
            }
            if (!TextUtils.isEmpty(this.u)) {
                this.f70467d.setTextAndFocusEnd(this.u);
                this.r.m();
                if (this.r.l()) {
                    SearchStartPagePerformanceMonitor.a().b(false);
                } else {
                    this.f70467d.a(false, 50);
                }
                this.f70466c.setFirstShow(false);
                k();
                return;
            }
            if (!b2 && !n()) {
                this.o = currentUrl;
            }
            boolean z = this.f70466c.getChannel() == 4;
            boolean z2 = this.f70466c.getChannel() == 3;
            boolean z3 = this.f70466c.getChannel() == 5;
            if (!b2 && !TextUtils.isEmpty(currentUrl) && (z || z2)) {
                this.e = currentUrl;
                this.f70467d.setTextAndFocusEnd(currentUrl);
            }
            if ((z3 || z2) && !TextUtils.isEmpty(this.o)) {
                this.o = null;
            }
        }
        this.r.c("");
        if (e(currentUrl)) {
            this.f70467d.a(false, 50);
            k();
            this.f70466c.setFirstShow(false);
        } else {
            p();
            this.f70466c.setFirstShow(false);
            k();
        }
    }

    public void a(int i, int i2, String str, String str2, int i3) {
        SearchEntranceInfo searchEntranceInfo = this.f70466c.getCurrentFrame().getSearchEntranceInfo();
        int i4 = searchEntranceInfo == null ? 0 : searchEntranceInfo.f70137b;
        String lastKeyword = this.f70466c.getCurrentFrame().getLastKeyword();
        if (i2 == 6) {
            String str3 = "action=click&entry=" + i4 + "&source=" + this.r.g() + "&c_type=" + i + "&u_type=" + i2 + "&r_word=" + lastKeyword;
            if (FeatureToggle.a(qb.framework.BuildConfig.FEATURE_TOGGLE_868503181)) {
                StringBuilder sb = new StringBuilder();
                sb.append(str3);
                sb.append("&incognito=");
                sb.append(QbModeUtils.a() ? "1" : "0");
                str3 = sb.toString();
            }
            SearchUtils.a(str3, 6);
        }
    }

    @Override
    public void a(String str) {
        super.a(str);
        DirectFunnelReporter.a(1);
        if (TextUtils.isEmpty(str)) {
            if (this.f70466c != null) {
                this.f70466c.setBackStrategy(SearchWindow.BackStrategy.BACK_TO_LAST_FRAME);
            }
            str = "";
        }
        SearchLog.b(str, "开始", "", 1);
        this.e = str;
        d(str);
    }

    @Override
    public void a(String str, String str2) {
        c(str, str2);
        d(null, str);
    }

    @Override
    public void a(boolean z) {
        if (z) {
            t();
        }
    }

    @Override
    public boolean a(MotionEvent motionEvent) {
        if (this.p == 1) {
            boolean ai = DeviceUtils.ai();
            float y = motionEvent.getY();
            if (ai) {
                if (y < AddressBarController.h() + (MttResources.g(R.dimen.a16) / 2)) {
                    return false;
                }
            } else if (y < AddressBarController.h() + MttResources.g(R.dimen.a16)) {
                return false;
            }
        }
        return true;
    }

    @Override
    public void b() {
        this.r.c("");
        if (this.f70467d != null) {
            SearchUtils.a(this.f70467d.getContext());
        }
        if (this.f70467d != null) {
            this.f70467d.setOnRightButtonClickListener(null);
        }
        SearchPageFactory searchPageFactory = this.k;
        if (searchPageFactory != null) {
            searchPageFactory.b();
        }
        ISearchPage iSearchPage = this.l;
        if (iSearchPage != null) {
            iSearchPage.e();
        }
        HotWordManager.getInstance().deleteHomePageHotwordsListener(this);
        EventEmiter.getDefault().unregister("SearchConst.event_show_hotword", this);
    }

    @Override
    protected void b(int i, int i2, boolean z) {
        int i3;
        int i4;
        String text;
        SearchLog.a("右键点击", "按钮点击", "", 1);
        if (c(i, i2, z)) {
            String charSequence = this.f70467d.getInputController().a().getHint().toString();
            if (SearchInputBarController.a(charSequence, this.r)) {
                this.r.a(charSequence, -1, "1_01_01_01");
                return;
            }
        }
        if (!c(i)) {
            SearchLog.a("右键点击", "不符合处理条件,点击被中断", "", 1);
            return;
        }
        boolean z2 = i == 2;
        PlatformStatUtils.a("Search_RightBtnClick");
        if (!z2) {
            SearchLog.a("右键点击", "触发打开链接逻辑", "链接地址为:" + this.f70467d.getText(), 1);
            SearchUrlLoaderConfig searchUrlLoaderConfig = new SearchUrlLoaderConfig();
            searchUrlLoaderConfig.b("1_07_00_01");
            this.r.a(false, this.f70467d.getText(), 4, 0, searchUrlLoaderConfig);
            j();
            i3 = 0;
            i4 = 10;
            text = this.f70467d.getText();
        } else {
            if (a(PublicSettingManager.a().getBoolean("key_search_direct_enhance_mode_new", false), this.r.k().equals("1"))) {
                SearchLog.a("右键点击", "不知道这里是在干嘛,好像是在请求直达", "mViewMode == SearchPageFactory.VIEW_MODE_LIST", 1);
                String text2 = this.f70467d.getText();
                DirectFunnelReporter.a(TextUtils.isEmpty(text2) ? 12 : 11);
                this.f70466c.getDataManager().a(text2, 0, 10, System.currentTimeMillis());
                SearchUtils.a(getInputView().getContext());
                DirectFunnelReporter.a(10);
                return;
            }
            a(getDataManager().a(this.f70467d.getText()));
            if (this.r.n().e()) {
                StatManager.b().c("BPZD12");
            }
            i3 = 0;
            i4 = 6;
            text = null;
        }
        a(i3, i4, text, null, i2);
        if (6 == this.f70466c.getType()) {
            StatManager.b().c("BPZD12");
        }
    }

    void b(final String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.n.post(new Runnable() {
            @Override
            public void run() {
                if (SearchFrame.this.s()) {
                    SearchFrame.this.f70467d.getInputController().a().setAutoScrollToSelectEndEnabled(false);
                    SearchFrame.this.f70467d.getInputController().a().setText(str);
                    SearchFrame.this.f70467d.getInputController().a().selectAll();
                    AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
                    alphaAnimation.setDuration(200L);
                    SearchFrame.this.f70467d.getInputController().a().startAnimation(alphaAnimation);
                }
            }
        });
    }

    @Override
    public boolean b(MotionEvent motionEvent) {
        ISearchPage iSearchPage = this.l;
        if (iSearchPage instanceof SearchRNListView) {
            return ((SearchRNListView) iSearchPage).f();
        }
        if (iSearchPage instanceof SearchHippyHomeView) {
            return false;
        }
        return q;
    }

    @Override
    public void c() {
        ISearchPage iSearchPage = this.l;
        if (iSearchPage != null) {
            iSearchPage.dq_();
        }
    }

    @Override
    public void c(String str) {
        if (!TextUtils.isEmpty(str) && Pattern.matches("^[0-9a-zA-Z\\\\-\\\\_]{10,18}", str)) {
            this.s = str;
        }
    }

    @Override
    public void d() {
        this.k.a();
    }

    @Override
    public void e() {
        super.e();
        ISearchPage iSearchPage = this.l;
        if (iSearchPage != null) {
            iSearchPage.b();
        }
    }

    @Override
    public void f() {
        super.f();
        ISearchPage iSearchPage = this.l;
        if (iSearchPage != null) {
            iSearchPage.dr_();
        }
    }

    @Override
    public void g() {
        if (SearchCloudConfigManager.a().b().a()) {
            super.g();
        } else {
            a(2);
        }
        ISearchUrlDispatcher iSearchUrlDispatcher = this.r;
        if (iSearchUrlDispatcher == null || iSearchUrlDispatcher.n() == null || !this.r.n().e()) {
            return;
        }
        StatManager.b().c("BPZD13");
    }

    @Override
    public ISearchPage getCurrentPage() {
        return this.l;
    }

    @Override
    public String getLastKeyword() {
        return this.e;
    }

    @Override
    public View getNativeListView() {
        this.k.a();
        return this.k.b(this.f70465b, 2, this.r).getView();
    }

    @Override
    public RecyclerViewBase.OnScrollListener getOnScrollerListener() {
        return this;
    }

    @Override
    public SearchEntranceInfo getSearchEntranceInfo() {
        return null;
    }

    @Override
    public int getViewMode() {
        return this.p;
    }

    @Override
    public boolean handleMessage(Message message) {
        return false;
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = "SearchConst.event_show_hotword")
    public void handleShowHotword(EventMessage eventMessage) {
        t();
    }

    @Override
    protected void i() {
    }

    public void j() {
        if (this.f70467d == null || PublicSettingManager.a().e()) {
            return;
        }
        SearchInputHistory searchInputHistory = new SearchInputHistory(this.f70467d.getText(), this.f70467d.getText(), "", 0, "");
        searchInputHistory.y = this.f70467d.getText();
        searchInputHistory.z = 3;
        SearchHistoryManager.a().b(searchInputHistory);
        SearchLog.a("搜索历史改造", "输入query和联想词", "输入链接咯", 1);
    }

    @Override
    public void onScrollStateChanged(int i, int i2) {
    }

    @Override
    public void onScrolled(int i, int i2) {
        q = i2 <= 0;
    }

    public void setHotWordDirect(boolean z) {
        this.t = z;
    }

    @Override
    public void switchSkin() {
        super.switchSkin();
        SearchPageFactory searchPageFactory = this.k;
        if (searchPageFactory != null) {
            searchPageFactory.c();
        }
    }
}