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

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


package com.tencent.mtt.browser.homepage;

import android.animation.Animator;
import android.animation.ArgbEvaluator;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Picture;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.webkit.ValueCallback;
import android.widget.FrameLayout;
import androidx.core.internal.view.SupportMenu;
import com.tencent.common.boot.BootChainEvent;
import com.tencent.common.boot.BootTraceEvent;
import com.tencent.common.boot.BootTracer;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.http.IPostDataBuf;
import com.tencent.common.imagecache.imagepipeline.bitmaps.X5BitmapUtils;
import com.tencent.common.manifest.AppManifest;
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.QBTask;
import com.tencent.common.task.RoutineDaemon;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.ThreadUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mm.opensdk.modelmsg.WXVideoFileObject;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.QbActivityBase;
import com.tencent.mtt.R;
import com.tencent.mtt.animator.ViewPropertyAnimatorBase;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.nativeframework.SnapShotCanvas;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.PCGStatManager;
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.base.utils.DeviceUtilsF;
import com.tencent.mtt.base.webview.QBWebView;
import com.tencent.mtt.base.webview.extension.IskinSwitchListener;
import com.tencent.mtt.boot.base.IBoot;
import com.tencent.mtt.boot.facade.IBootService;
import com.tencent.mtt.browser.bra.addressbar.AddressBarController;
import com.tencent.mtt.browser.bra.addressbar.AddressBarDataSource;
import com.tencent.mtt.browser.bra.toolbar.NormalToolBarView;
import com.tencent.mtt.browser.feeds.FeedsProxy;
import com.tencent.mtt.browser.feeds.data.HomeDataCache;
import com.tencent.mtt.browser.feeds.data.HomeExternalSetting;
import com.tencent.mtt.browser.feeds.facade.IFeedsService;
import com.tencent.mtt.browser.feeds.view.IFeedsHomePageProxy;
import com.tencent.mtt.browser.homepage.HomepageTopOpHeaderDataManager;
import com.tencent.mtt.browser.homepage.facade.HomeFileUtils;
import com.tencent.mtt.browser.homepage.facade.IHomePage;
import com.tencent.mtt.browser.homepage.view.ContentContainer;
import com.tencent.mtt.browser.homepage.view.ContentExtendContainer;
import com.tencent.mtt.browser.homepage.view.FeedsRNContainer;
import com.tencent.mtt.browser.homepage.view.FeedsToolBarView;
import com.tencent.mtt.browser.homepage.view.FloatContainer;
import com.tencent.mtt.browser.homepage.view.HeaderDropdownStateManager;
import com.tencent.mtt.browser.homepage.view.HomePageDropDownGuidePage;
import com.tencent.mtt.browser.homepage.view.HomePageDropDownStrongAnimator;
import com.tencent.mtt.browser.homepage.view.HomePageTopHeaderContainer;
import com.tencent.mtt.browser.homepage.view.HomePageTopHeaderManager;
import com.tencent.mtt.browser.homepage.view.HomePageUnitTime;
import com.tencent.mtt.browser.homepage.view.HomepageTopOpDropdownView;
import com.tencent.mtt.browser.homepage.view.HomepageTopOpPlaceHolderView;
import com.tencent.mtt.browser.homepage.view.IContentExtendContainer;
import com.tencent.mtt.browser.homepage.view.IFeedsDropdownStateCallback;
import com.tencent.mtt.browser.homepage.view.TopContentContainer;
import com.tencent.mtt.browser.homepage.view.fastlink.FastLinkConsts;
import com.tencent.mtt.browser.homepage.view.fastlink.FastLinkWorkspaceBase;
import com.tencent.mtt.browser.homepage.view.fastlink.FastlinkBubbleManager;
import com.tencent.mtt.browser.homepage.view.fastlink.FastlinkDataCache;
import com.tencent.mtt.browser.homepage.view.miniprogram.MiniProgramPlaceHolderView;
import com.tencent.mtt.browser.homepage.view.notifybubble.IBubbleManager;
import com.tencent.mtt.browser.homepage.view.notifybubble.INotifyBubbleListener;
import com.tencent.mtt.browser.homepage.view.notifybubble.TopHeaderBubbleImpl;
import com.tencent.mtt.browser.homepage.view.notifybubble.scanbubble.ScanBubbleConfigManager;
import com.tencent.mtt.browser.homepage.view.notifybubble.voicebubble.VoiceBubbleConfigManager;
import com.tencent.mtt.browser.homepage.view.push.PushDialog;
import com.tencent.mtt.browser.homepage.view.search.SearchBarView;
import com.tencent.mtt.browser.homepage.view.search.SearchFuncPopManager;
import com.tencent.mtt.browser.homepage.view.weathers.WeatherViewPresenter;
import com.tencent.mtt.browser.push.facade.IPushDialogContentExtension;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.window.BrowserUIParams;
import com.tencent.mtt.browser.window.BrowserWindow;
import com.tencent.mtt.browser.window.FullScreenManager;
import com.tencent.mtt.browser.window.IPage;
import com.tencent.mtt.browser.window.IWebView;
import com.tencent.mtt.browser.window.IWebViewClient;
import com.tencent.mtt.browser.window.PageFrame;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.browser.window.data.PageInfo;
import com.tencent.mtt.browser.window.home.HomePageGrayHelper;
import com.tencent.mtt.browser.window.home.IHome;
import com.tencent.mtt.browser.window.home.tab.BBarHeightUtil;
import com.tencent.mtt.browser.window.home.view.HomePage;
import com.tencent.mtt.browser.window.templayer.IPageBussinessProxy;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.costtimelite.CostTimeLite;
import com.tencent.mtt.external.explorerone.facade.IExploreService;
import com.tencent.mtt.hippy.qb.portal.eventdefine.HippyEventHubDefineBase;
import com.tencent.mtt.hippy.qb.views.listview.IQBRefreshDropdown;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.operation.event.EventLog;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.search.facade.ISearchEngineService;
import com.tencent.mtt.search.facade.ISearchService;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.mtt.setting.BootFlagManager;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.supportui.views.recyclerview.RecyclerViewBase;
import com.tencent.mtt.view.common.QBViewResourceManager;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.wechatminiprogram.IWeChatMiniProgramService;
import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import qb.a.e;
import qb.a.g;
import qb.a.h;
import qb.homepage.BuildConfig;

public class FeedsHomePage extends QBFrameLayout implements ActivityHandler.ApplicationStateListener, IFeedsHomePageProxy, HomepageTopOpHeaderDataManager.OnStateChangeListener, IFeedsHomeCallback, IHomePage, ContentContainer.IContentModeChangeListener, HomePageDropDownGuidePage.OnGuideUpdateListener, IFeedsDropdownStateCallback, FastLinkWorkspaceBase.FastLinkEditListener, INotifyBubbleListener {
    private static final String BAIDU_URL = "https://m.baidu.com/";
    private static final String CAMERA_URL = "qb://camera";
    private static final int DEACTIVE_FROM_deactive = 2;
    private static final int DEACTIVE_FROM_onStop = 1;
    private static final int DEFAULT_TIME_INTERVAL = 48;
    private static final String KEY_LOCATION_TIPS_TIME_INTERVAL = "ANDROID_PUBLIC_PREFS_LOCATION_TIPS_TIME_INTERVAL";
    private static final String MTT_PROTOCOL_HOME_PUSH = "qb://home/push/";
    private static final String NOVEL_URL = "qb://ext/novel/shelf";
    private static final String READ_URL = "qb://ext/read";
    private static final String RN_URL = "qb://ext/rn";
    private static final int SEARCH_BAR_BLUD_COLOR_BG_ID = e.aK;
    private static final String SEARCH_URL = "qb://search";
    public static final String TAG = "FeedsHomePage";
    private static final long UNIT_MILL_ONE_HOUR = 3600000;
    private static final String VIDEO_URL = "qb://video/feedsvideo";
    private static final String WEATHER_URL = "qb://ext/weather";
    private static boolean mIsColdStart = true;
    private static boolean mIsColdStartFeedsDrawed = true;
    private static boolean mIsHotStart;
    private boolean enterNaviSite;
    private boolean feedsFirstDraw;
    private boolean isVoiceOrScanBubbleAlreadyShowed;
    private int mAddressBarBgColor;
    protected AddressBarDataSource mAddressBarDataSource;
    public ContentContainer mContentContainer;
    private byte mContentMode;
    private int mDefaultBottomPadding;
    HomePageDropDownGuideStateManager mDropDownGuideStateManager;
    IQBRefreshDropdown.State mDropDownState;
    HomePageDropDownGuidePage mDropDownWeakGuidePage;
    private String mDropdownJumpUrl;
    private final HeaderDropdownStateManager mDropdownStateManager;
    private DropdownType mDropdownType;
    private ContentExtendContainer mExtendContainer;
    private FeedsDropdownVibrator mFeedsDropdownVibrator;
    private FloatContainer mFloatContainer;
    private HomePageGrayHelper mHomePageGrayHelper;
    private HomepageTopOpDropdownView mHomeTopOpDropdownView;
    private HomepageTopOpHeaderDataManager mHomepageTopOpHeaderDataManager;
    private boolean mIsActive;
    private boolean mIsFastLinkEditMode;
    private MiniProgramPlaceHolderView mMiniPlaceHolderView;
    private boolean mNeedRestContentAndFloatState;
    private int mOrientation;
    private HomePageTopHeaderContainer mPageTopHeaderContainer;
    private View mPerView;
    private PushDialog mPushDialog;
    protected int mRequestCode;
    private int mResultCode;
    private Intent mResultIntent;
    boolean mRetunFromInfoContent;
    private boolean mShoudldShowVoiceSearchPanel;
    private String mSkinType;
    private int mStatusBarHeight;
    private boolean mStatusBarVisiable;
    final HomePageDropDownStrongAnimator mStrongAnimator;
    ViewGroup mStrongGuideLayer;
    private HomepageTopOpPlaceHolderView mTopOpPlaceHolderView;
    private int mTopOpPlaceHolderViewTopMargin;
    ViewGroup mWeakGuideLayer;
    private int statEntry;

    public static class AnonymousClass13 {

        static final int[] f39117a;

        static final int[] f39118b = new int[ActivityHandler.State.values().length];

        static {
            try {
                f39118b[ActivityHandler.State.background.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            f39117a = new int[IWebView.RatioRespect.values().length];
            try {
                f39117a[IWebView.RatioRespect.RESPECT_WIDTH.ordinal()] = 1;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f39117a[IWebView.RatioRespect.RESPECT_HEIGHT.ordinal()] = 2;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                f39117a[IWebView.RatioRespect.RESPECT_BOTH.ordinal()] = 3;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                f39117a[IWebView.RatioRespect.RESPECT_NONE.ordinal()] = 4;
            } catch (NoSuchFieldError unused5) {
            }
        }
    }

    public enum DropdownType {
        TYPE_NONE,
        TYPE_WE_APP,
        TYPE_HEADER_TOP_OP
    }

    public class FullScreenWrongTimeException extends RuntimeException {
        public FullScreenWrongTimeException(String str) {
            super(str);
        }
    }

    public FeedsHomePage(Context context) {
        this(context, null);
    }

    public FeedsHomePage(Context context, UrlParams urlParams) {
        super(context);
        this.mAddressBarDataSource = null;
        this.mContentContainer = null;
        this.mFloatContainer = null;
        this.mOrientation = 0;
        this.mIsActive = false;
        this.mIsFastLinkEditMode = false;
        this.mContentMode = (byte) 1;
        this.mStatusBarHeight = 0;
        this.mAddressBarBgColor = -1;
        this.enterNaviSite = false;
        this.mResultIntent = null;
        this.mRequestCode = -1;
        this.mResultCode = 0;
        this.mStatusBarVisiable = true;
        this.mSkinType = null;
        this.mShoudldShowVoiceSearchPanel = false;
        this.mHomePageGrayHelper = null;
        this.mPageTopHeaderContainer = null;
        this.mStrongAnimator = new HomePageDropDownStrongAnimator();
        this.isVoiceOrScanBubbleAlreadyShowed = false;
        this.mDefaultBottomPadding = 0;
        this.feedsFirstDraw = false;
        this.statEntry = -1;
        this.mRetunFromInfoContent = false;
        BootChainEvent.c("FeedsHomePage.init");
        BootTracer.b("INIT_FEEDSHOMEPAGE", BootTraceEvent.Type.BUSINESS);
        StatManager.b().c("ADRDEV003_FD-fhpInit");
        this.mDefaultBottomPadding = BBarHeightUtil.a();
        updateBottomPadding(this.mDefaultBottomPadding);
        this.mHomepageTopOpHeaderDataManager = HomepageTopOpHeaderDataManager.a();
        this.mHomepageTopOpHeaderDataManager.a(this);
        this.mHomepageTopOpHeaderDataManager.b();
        this.mDropdownStateManager = new HeaderDropdownStateManager(context);
        this.mDropdownStateManager.a(this);
        this.mDropdownStateManager.b(DeviceUtilsF.R());
        this.mDropdownStateManager.a(this.mContentMode);
        this.mDropdownStateManager.a((IFeedsDropdownStateCallback) this);
        this.mDropdownType = updateDropdownTypeAndRet();
        this.mDropdownStateManager.b(this.mDropdownType == DropdownType.TYPE_HEADER_TOP_OP);
        if (((IBoot) SDKContext.getInstance().getService(IBoot.class)).isNewInstall() && PublicSettingManager.a().getInt(IBoot.NEW_USER_FLAG, -1) == 1) {
            PublicSettingManager.a().setBoolean("FHP_IS_NEW_USER", true);
        }
        BootTraceEvent b2 = BootTracer.b("INIT_FEEDS_PROXY", BootTraceEvent.Type.BUSINESS);
        FeedsProxy.getInstance().b();
        b2.a();
        this.mAddressBarDataSource = new AddressBarDataSource();
        AddressBarDataSource addressBarDataSource = this.mAddressBarDataSource;
        addressBarDataSource.i = NormalToolBarView.class;
        addressBarDataSource.f35821b = getUrl();
        this.mStatusBarHeight = BaseSettings.a().n();
        this.mSkinType = SkinManager.p();
        changePadStatusBarBg();
        BootTraceEvent b3 = BootTracer.b("FEEDSHOMEPAGE_INITUI", BootTraceEvent.Type.BUSINESS);
        initUI(urlParams);
        b3.a();
        if (PublicSettingManager.a().getBoolean("key_home_clear_old_data_below_65", true)) {
            RoutineDaemon.a().a(new Runnable() {
                @Override
                public void run() {
                    HomeFileUtils.c();
                }
            }, 20000L);
        }
        ActivityHandler.b().a(this);
        attachPerformanceView();
        this.mHomePageGrayHelper = new HomePageGrayHelper(1);
        EventEmiter.getDefault().register("EVENT_KEY_HEAD_IMAGE_BG_UPDATE", this);
        this.mFeedsDropdownVibrator = new FeedsDropdownVibrator();
        List<View> headerGroupViewList = this.mFloatContainer.getHeaderGroupViewList();
        if (HomepageTopOpHeaderUtils.a()) {
            headerGroupViewList.add(TopContentContainer.a(getContext()));
        }
        this.mDropdownStateManager.a(headerGroupViewList);
        this.mDropDownGuideStateManager = HomePageDropDownGuideStateManager.getInstance();
        EventEmiter.getDefault().register("event.WindowComponentExtensionImp.onHomeClick", this);
        EventEmiter.getDefault().register("event.WindowComponentExtensionImp.onMultiWindowClick", this);
        BootTracer.b("INIT_FEEDSHOMEPAGE");
    }

    private void animateToLandingPage() {
        if (TextUtils.isEmpty(this.mDropdownJumpUrl)) {
            return;
        }
        reportTopOpDropdown();
        int ad = DeviceUtils.ad();
        hideFloatContainer();
        TopContentContainer existInstance = TopContentContainer.getExistInstance();
        if (existInstance != null) {
            existInstance.setVisibility(4);
        }
        updateHomePageBGColor(false);
        this.mNeedRestContentAndFloatState = true;
        final boolean e = SkinManager.s().e();
        final ArgbEvaluator argbEvaluator = new ArgbEvaluator();
        final View currentHomePageTabHost = getCurrentHomePageTabHost();
        this.mContentContainer.a(ad, 250L, new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(FeedsHomePage.this.mDropdownJumpUrl));
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }

            @Override
            public void onAnimationStart(Animator animator) {
                if (FeedsHomePage.this.mHomeTopOpDropdownView != null) {
                    FeedsHomePage.this.mHomeTopOpDropdownView.a();
                }
            }
        }, new ViewPropertyAnimatorBase.UpdateListener() {
            @Override
            public void a(float f) {
                View view = currentHomePageTabHost;
                if (view != null) {
                    view.setAlpha(1.0f - f);
                }
                if (e) {
                    int intValue = ((Integer) argbEvaluator.evaluate(f, -1, -1)).intValue();
                    FeedsHomePage.this.mExtendContainer.setBackgroundColor(intValue);
                    FeedsHomePage.this.setHomePageBGColor(intValue);
                }
            }
        });
    }

    private void animateToWeapp() {
        int ad = DeviceUtils.ad();
        hideFloatContainer();
        TopContentContainer existInstance = TopContentContainer.getExistInstance();
        if (existInstance != null) {
            existInstance.setVisibility(4);
        }
        updateHomePageBGColor(false);
        this.mNeedRestContentAndFloatState = true;
        final boolean e = SkinManager.s().e();
        final ArgbEvaluator argbEvaluator = new ArgbEvaluator();
        final View currentHomePageTabHost = getCurrentHomePageTabHost();
        this.mContentContainer.a(ad, 250L, new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                FeedsHomePage.this.launchPage();
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }

            @Override
            public void onAnimationStart(Animator animator) {
                if (FeedsHomePage.this.mMiniPlaceHolderView != null) {
                    FeedsHomePage.this.mMiniPlaceHolderView.a();
                }
            }
        }, new ViewPropertyAnimatorBase.UpdateListener() {
            @Override
            public void a(float f) {
                View view = currentHomePageTabHost;
                if (view != null) {
                    view.setAlpha(1.0f - f);
                }
                if (e) {
                    int intValue = ((Integer) argbEvaluator.evaluate(f, -13734175, -16173452)).intValue();
                    FeedsHomePage.this.mExtendContainer.setBackgroundColor(intValue);
                    FeedsHomePage.this.setHomePageBGColor(intValue);
                }
            }
        });
        this.mDropDownGuideStateManager.g();
    }

    private void attachHeaderTopOpDropdownView(IContentExtendContainer iContentExtendContainer) {
        this.mDropdownStateManager.a(new IQBRefreshDropdown.TipsText(MttResources.l(R.string.a_1), MttResources.s(11), MttResources.c(e.f85875d)));
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
        this.mHomeTopOpDropdownView = new HomepageTopOpDropdownView(getContext());
        iContentExtendContainer.a(this.mHomeTopOpDropdownView, layoutParams);
        iContentExtendContainer.setContainerEnabled(true);
        this.mDropdownStateManager.a(true);
    }

    private void attachMiniProgramView(IContentExtendContainer iContentExtendContainer) {
        this.mDropdownStateManager.a((IQBRefreshDropdown.TipsText) null);
        this.mMiniPlaceHolderView = new MiniProgramPlaceHolderView(getContext());
        DisplayMetrics e = MttResources.e();
        int s = MttResources.s(223);
        if (e != null) {
            s = Double.valueOf(e.heightPixels * 0.45d).intValue();
        }
        iContentExtendContainer.a(this.mMiniPlaceHolderView, new FrameLayout.LayoutParams(-1, s));
        iContentExtendContainer.a(new IContentExtendContainer.Callback() {
            @Override
            public void a(int i, int i2) {
                FeedsHomePage.this.mMiniPlaceHolderView.a(new BigDecimal(i / i2).setScale(2, 4).doubleValue());
            }

            @Override
            public void a(View view) {
            }

            @Override
            public boolean a(MotionEvent motionEvent) {
                return false;
            }

            @Override
            public void b(View view) {
            }

            @Override
            public void c(View view) {
            }
        });
        iContentExtendContainer.setContainerEnabled(true);
        setDropDownEnable();
    }

    private void changePadStatusBarBg() {
        this.mAddressBarBgColor = MttResources.c(e.aK);
        updateAddressBarBgColorIfHeadImageBgColorSet();
        invalidate();
    }

    private void checkDropdownAndReset() {
        if (this.mNeedRestContentAndFloatState) {
            resetContentContainerAndFloatContainerState(false);
            this.mNeedRestContentAndFloatState = false;
            this.mTopOpPlaceHolderView.a(false);
        }
    }

    private void clearAttachView(IContentExtendContainer iContentExtendContainer) {
        iContentExtendContainer.a();
        this.mDropdownStateManager.a(false);
    }

    private void disableComponent(ComponentName componentName) {
        PackageManager packageManager = ContextHolder.getAppContext().getPackageManager();
        if (packageManager != null) {
            packageManager.setComponentEnabledSetting(componentName, 2, 1);
        }
    }

    private void enableComponent(ComponentName componentName) {
        PackageManager packageManager = ContextHolder.getAppContext().getPackageManager();
        if (packageManager != null) {
            packageManager.setComponentEnabledSetting(componentName, 1, 1);
        }
    }

    private View getCurrentHomePageTabHost() {
        PageFrame s = WindowManager.a().s();
        if (s == null) {
            return null;
        }
        IWebView homePageInWindow = s.getHomePageInWindow();
        if (homePageInWindow instanceof IHome) {
            return ((IHome) homePageInWindow).getHomeTabHost().getView();
        }
        return null;
    }

    private String getMainUrl(String str) {
        int indexOf;
        return (TextUtils.isEmpty(str) || (indexOf = str.indexOf("?")) == -1) ? str : str.substring(0, indexOf);
    }

    private boolean handlePushUrl(String str) {
        View view;
        IPushDialogContentExtension.ContentType contentType;
        IPushDialogContentExtension iPushDialogContentExtension;
        View view2;
        View childAt;
        View childAt2;
        if (!TextUtils.isEmpty(str) && str.startsWith(MTT_PROTOCOL_HOME_PUSH)) {
            String replace = str.replace(MTT_PROTOCOL_HOME_PUSH, "qb://");
            IPushDialogContentExtension.ContentType contentType2 = IPushDialogContentExtension.ContentType.NOT_SUPPORT;
            IPushDialogContentExtension[] iPushDialogContentExtensionArr = (IPushDialogContentExtension[]) AppManifest.getInstance().queryExtensions(IPushDialogContentExtension.class);
            int length = iPushDialogContentExtensionArr.length;
            IPushDialogContentExtension.ContentType contentType3 = contentType2;
            int i = 0;
            while (true) {
                view = null;
                if (i >= length) {
                    contentType = contentType3;
                    iPushDialogContentExtension = null;
                    break;
                }
                iPushDialogContentExtension = iPushDialogContentExtensionArr[i];
                contentType = iPushDialogContentExtension.parseUrl(replace);
                if (IPushDialogContentExtension.ContentType.NOT_SUPPORT != contentType) {
                    break;
                }
                i++;
                contentType3 = contentType;
            }
            if (iPushDialogContentExtension != null) {
                if (IPushDialogContentExtension.ContentType.WEATHER != contentType) {
                    if (IPushDialogContentExtension.ContentType.TODAY == contentType) {
                        childAt = ((ViewGroup) ((ViewGroup) this.mFloatContainer.getChildAt(1)).getChildAt(0)).getChildAt(0);
                        childAt2 = this.mFloatContainer.getChildAt(1);
                    }
                    view2 = null;
                    this.mPushDialog = new PushDialog.Builder().a(replace).a(contentType).a(view).b(view2).a(iPushDialogContentExtension).a(new PushDialog.IEventDelegate() {
                        @Override
                        public void a() {
                            FeedsHomePage.this.mContentContainer.e();
                        }

                        @Override
                        public void b() {
                            FeedsHomePage.this.mContentContainer.d();
                            FeedsHomePage.this.mContentContainer.d(0, 0);
                        }
                    }).a();
                    this.mPushDialog.b();
                    return true;
                }
                childAt = ((ViewGroup) this.mFloatContainer.getChildAt(0)).getChildAt(1);
                childAt2 = this.mFloatContainer.getChildAt(0);
                View view3 = childAt2;
                view = childAt;
                view2 = view3;
                this.mPushDialog = new PushDialog.Builder().a(replace).a(contentType).a(view).b(view2).a(iPushDialogContentExtension).a(new PushDialog.IEventDelegate() {
                    @Override
                    public void a() {
                        FeedsHomePage.this.mContentContainer.e();
                    }

                    @Override
                    public void b() {
                        FeedsHomePage.this.mContentContainer.d();
                        FeedsHomePage.this.mContentContainer.d(0, 0);
                    }
                }).a();
                this.mPushDialog.b();
                return true;
            }
        }
        return false;
    }

    private void hideFloatContainer() {
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            floatContainer.setVisibility(8);
        }
    }

    private void initUI(UrlParams urlParams) {
        ContentContainer contentContainer;
        BootTraceEvent b2 = BootTracer.b("INIT_CONTENT_EXT_CONTAINER", BootTraceEvent.Type.BUSINESS);
        this.mExtendContainer = new ContentExtendContainer(getContext());
        b2.a();
        addView(this.mExtendContainer, new FrameLayout.LayoutParams(-1, -1));
        this.mExtendContainer.setVisibility(8);
        updateDropdownAttachView();
        this.mStrongGuideLayer = new FrameLayout(getContext());
        addView(this.mStrongGuideLayer, new ViewGroup.LayoutParams(-1, -2));
        this.mStrongGuideLayer.setVisibility(8);
        BootTraceEvent b3 = BootTracer.b("INIT_CONTENT_CONTAINER", BootTraceEvent.Type.BUSINESS);
        this.mContentContainer = new ContentContainer(getContext(), this.mDropdownStateManager, urlParams);
        b3.a();
        this.mContentContainer.setParent(this);
        addView(this.mContentContainer, new FrameLayout.LayoutParams(-1, -1));
        this.mContentContainer.a((FastLinkWorkspaceBase.FastLinkEditListener) this);
        this.mContentContainer.a((ContentContainer.IContentModeChangeListener) this);
        BootTraceEvent b4 = BootTracer.b("INIT_TOPHEAD_CONTAINER", BootTraceEvent.Type.BUSINESS);
        this.mPageTopHeaderContainer = new HomePageTopHeaderContainer(getContext(), HomePageTopHeaderManager.a());
        b4.a();
        int n = BaseSettings.a().n();
        addView(this.mPageTopHeaderContainer, new FrameLayout.LayoutParams(-1, SearchBarView.f40980a + n));
        this.mTopOpPlaceHolderView = new HomepageTopOpPlaceHolderView(getContext(), this.mHomepageTopOpHeaderDataManager);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, n + HomePageConst.K);
        layoutParams.topMargin = SearchBarView.f40980a - HomePageConst.K;
        addView(this.mTopOpPlaceHolderView, layoutParams);
        this.mTopOpPlaceHolderView.setVisibility(8);
        this.mTopOpPlaceHolderViewTopMargin = layoutParams.topMargin;
        this.mWeakGuideLayer = new FrameLayout(getContext());
        addView(this.mWeakGuideLayer, new ViewGroup.LayoutParams(-1, -2));
        this.mWeakGuideLayer.setVisibility(8);
        this.mFloatContainer = FloatContainer.a(getContext());
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null && !floatContainer.b() && this.mFloatContainer.a(this) && (contentContainer = this.mContentContainer) != null) {
            this.mFloatContainer.setContentContainer(contentContainer);
            this.mFloatContainer.a(this.mContentContainer.getOffsetY());
        }
        reLayoutContent(getContext().getResources().getConfiguration().orientation);
        this.mDropDownWeakGuidePage = new HomePageDropDownGuidePage(getContext());
        this.mDropDownWeakGuidePage.setVisibility(8);
    }

    public void launchPage() {
        launchPortalInner();
    }

    static String launchPortalInner() {
        String format = String.format("qb://miniprogram?module=miniprogress&component=miniprogress&coverToolbar=true&orientation=1&weatherInfo=%s", PublicSettingManager.a().getString("SINK_WEATHER_DATA", ""));
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(format));
        StatManager.b().c("XCX00002");
        return format;
    }

    private void prepareSnapShot(Bitmap bitmap) {
        int width;
        int height;
        if (!ThreadUtils.isMainThread()) {
            new Canvas(bitmap).drawColor(SkinManager.s().l() ? -16777216 : -1);
            return;
        }
        BrowserWindow x = WindowManager.a().x();
        if (FeatureToggle.a(BuildConfig.BUG_TOGGLE_94031739)) {
            measure(View.MeasureSpec.makeMeasureSpec(x.getWidth(), WXVideoFileObject.FILE_SIZE_LIMIT), View.MeasureSpec.makeMeasureSpec(x.getHeight(), WXVideoFileObject.FILE_SIZE_LIMIT));
            width = x.getWidth();
            height = x.getHeight();
        } else {
            measure(View.MeasureSpec.makeMeasureSpec(x.getWidth(), WXVideoFileObject.FILE_SIZE_LIMIT), View.MeasureSpec.makeMeasureSpec(x.getHeight() - (DeviceUtils.ai() ? 0 : BBarHeightUtil.a()), WXVideoFileObject.FILE_SIZE_LIMIT));
            width = x.getWidth();
            height = x.getHeight() - (DeviceUtils.ai() ? 0 : BBarHeightUtil.a());
        }
        layout(0, 0, width, height);
    }

    private void reLayoutContent(int i) {
        CostTimeLite.a("Boot", "FeedsHomePage.reLayoutContent");
        if (DeviceUtils.a()) {
            i = 1;
        }
        if (i != this.mOrientation) {
            this.mOrientation = i;
        }
        BaseSettings.a().n();
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.e(i);
        }
        if (this.mFloatContainer != null && FloatContainer.a(this.mContentContainer)) {
            this.mFloatContainer.d(i);
        }
        CostTimeLite.b("Boot", "FeedsHomePage.reLayoutContent");
    }

    private void reportTopOpDropdown() {
        HashMap hashMap = new HashMap();
        hashMap.put("action", "SecondFloor_link_exp");
        StatManager.b().b("SecondFloor_link", hashMap);
        HomepageTopOpHeaderDataManager homepageTopOpHeaderDataManager = this.mHomepageTopOpHeaderDataManager;
        homepageTopOpHeaderDataManager.d(homepageTopOpHeaderDataManager.f());
    }

    private void resetContentContainerAndFloatContainerState(boolean z) {
        resetFeedsContentLocation(z);
    }

    private void resetFeedsContentLocation(boolean z) {
        if (z) {
            resetWithAnimation();
        } else {
            resetWithoutAnimation();
        }
        View currentHomePageTabHost = getCurrentHomePageTabHost();
        if (currentHomePageTabHost != null && currentHomePageTabHost.getAlpha() != -1.0f) {
            currentHomePageTabHost.setAlpha(1.0f);
        }
        updateBottomPadding(this.mDefaultBottomPadding);
    }

    private void resetWithAnimation() {
        ArrayList<ViewPropertyAnimatorBase> arrayList = new ArrayList();
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            arrayList.add(contentContainer.getResetLocationAnimator());
        }
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            arrayList.add(floatContainer.getResetLocationAnimator());
        }
        final TopContentContainer existInstance = TopContentContainer.getExistInstance();
        if (existInstance != null) {
            arrayList.add(existInstance.getResetLocationAnimator());
        }
        for (ViewPropertyAnimatorBase viewPropertyAnimatorBase : arrayList) {
            if (viewPropertyAnimatorBase != null) {
                viewPropertyAnimatorBase.a(200L);
                viewPropertyAnimatorBase.b();
                postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        FeedsHomePage.this.setFeedContentBGCanDraw(true);
                        FeedsHomePage.this.mExtendContainer.setVisibility(8);
                        FeedsHomePage.this.updateHomePageBGColor(true);
                        FeedsHomePage.this.mPageTopHeaderContainer.a(false, true);
                        FeedsHomePage.this.mTopOpPlaceHolderView.a(false);
                        TopContentContainer topContentContainer = existInstance;
                        if (topContentContainer != null) {
                            topContentContainer.b();
                        }
                    }
                }, 200L);
            }
        }
    }

    private void resetWithoutAnimation() {
        setFeedContentBGCanDraw(true);
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.m();
        }
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            floatContainer.f();
        }
        this.mExtendContainer.setVisibility(8);
        updateHomePageBGColor(true);
        this.mPageTopHeaderContainer.a(false, true);
        this.mTopOpPlaceHolderView.a(false);
    }

    private void saveSnapshot() {
        View contentView;
        int width;
        int height;
        if (ActivityHandler.b().p()) {
            return;
        }
        clearBackGroundImage();
        File file = new File(FileUtils.e(), "snapshot");
        file.delete();
        File file2 = new File(FileUtils.e(), "snapshot_no_feeds");
        file2.delete();
        if (ActivityHandler.b().n() != null && (contentView = ActivityHandler.b().n().getContentView()) != null && (width = contentView.getWidth()) <= (height = contentView.getHeight()) && width >= 1 && height >= 1) {
            measure(View.MeasureSpec.makeMeasureSpec(width, WXVideoFileObject.FILE_SIZE_LIMIT), View.MeasureSpec.makeMeasureSpec(height, WXVideoFileObject.FILE_SIZE_LIMIT));
            boolean z = false;
            layout(0, 0, width, height);
            try {
                Bitmap createBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
                Bitmap createBitmap2 = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
                Canvas canvas = new Canvas(createBitmap);
                canvas.save();
                WindowManager.a().x().getBrowserBussinessProxy().a(canvas);
                Canvas canvas2 = new Canvas(createBitmap2);
                canvas2.save();
                WindowManager.a().x().getBrowserBussinessProxy().a(canvas2);
                prepareForSnapshotDraw();
                FeedsRNContainer.l = true;
                if (this.mContentContainer != null) {
                    this.mContentContainer.o();
                }
                draw(canvas);
                FeedsRNContainer.l = false;
                if (this.mContentContainer != null) {
                    this.mContentContainer.p();
                }
                draw(canvas2);
                restoreForSnapshotDraw();
                canvas.restore();
                canvas2.restore();
                IWebView u = WindowManager.a().u();
                if (u instanceof IHome) {
                    IHome iHome = (IHome) u;
                    View view = iHome.getHomeTabHost().getView();
                    if (view != null) {
                        iHome.a();
                        canvas.translate(0.0f, height - view.getHeight());
                        view.draw(canvas);
                        canvas2.translate(0.0f, height - view.getHeight());
                        view.draw(canvas2);
                    }
                }
                if (createBitmap != null) {
                    try {
                        z = X5BitmapUtils.a(file, createBitmap);
                    } catch (OutOfMemoryError unused) {
                    }
                    if (z) {
                        BootFlagManager.b(true);
                    }
                }
                if (createBitmap2 != null) {
                    X5BitmapUtils.a(file2, createBitmap2);
                }
            } catch (Exception | OutOfMemoryError unused2) {
            }
        }
    }

    private void setDropDownEnable() {
        this.mDropdownStateManager.a(((IWeChatMiniProgramService) SDKContext.getInstance().getService(IWeChatMiniProgramService.class)).checkWxAppEnable());
    }

    public void setHomePageBGColor(int i) {
        PageFrame s = WindowManager.a().s();
        if (s != null) {
            IWebView homePageInWindow = s.getHomePageInWindow();
            if (homePageInWindow instanceof HomePage) {
                ((HomePage) homePageInWindow).setBackgroundColor(i);
            }
        }
    }

    private boolean shouldAddTask(IBubbleManager iBubbleManager) {
        boolean z = false;
        if (iBubbleManager != null) {
            boolean e = iBubbleManager.e();
            boolean h = iBubbleManager.h();
            boolean c2 = iBubbleManager.c();
            String b2 = iBubbleManager.b();
            int a2 = iBubbleManager.a();
            EventLog.a("首页", "头部气泡", "判断是否应该添加气泡任务判断", "alreadyShown: " + h + " exceedMaxExp: " + e + " passLimitTime: " + c2 + " content: " + b2 + " frequency: " + a2, "superbochen", -1);
            if ((!h || !e) && ((!h || c2) && !TextUtils.isEmpty(b2) && a2 != 0)) {
                if (!TextUtils.isEmpty(b2) && c2 && !e) {
                    z = true;
                }
                EventLog.a("首页", "头部气泡", "是否展示气泡", "第二个判断条件:" + z, "superbochen", -1);
                return z;
            }
            EventLog.a("首页", "头部气泡", "不展示气泡", "第一个判断条件", "superbochen", -1);
        }
        return false;
    }

    private void showExtendContainer() {
        setFeedContentBGCanDraw(false);
        if (this.mContentContainer != null && SkinManager.s().e()) {
            this.mContentContainer.setFeedsContentBGColor(-1);
        }
        int parseColor = Color.parseColor("#2E6EE1");
        if (SkinManager.s().e()) {
            Integer headImageBackgroundColor = TopContentContainer.a(getContext()).getHeadImageBackgroundColor();
            if (headImageBackgroundColor != null) {
                parseColor = headImageBackgroundColor.intValue();
            }
        } else {
            parseColor = 0;
        }
        this.mExtendContainer.setBackgroundColor(parseColor);
        this.mExtendContainer.setAlpha(0.0f);
        this.mExtendContainer.setVisibility(0);
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            floatContainer.setVisibility(0);
        }
    }

    private void showExtendContainerOnTopOpDropdown() {
        if (this.mContentContainer != null && SkinManager.s().e()) {
            this.mContentContainer.setFeedsContentBGColor(-1);
        }
        float f = 0.0f;
        this.mExtendContainer.setAlpha(0.0f);
        this.mExtendContainer.setVisibility(0);
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            floatContainer.setVisibility(0);
        }
        TopContentContainer existInstance = TopContentContainer.getExistInstance();
        if (existInstance != null) {
            byte b2 = this.mContentMode;
            if (b2 == 2 || b2 == 3) {
                f = existInstance.getLastMoveOffsetY() - this.mTopOpPlaceHolderViewTopMargin;
                existInstance.c();
            }
            existInstance.a(f);
        }
    }

    private void updateAddressBarBgColorIfHeadImageBgColorSet() {
        Integer headImageBackgroundColor;
        if (!SkinManager.s().e() || (headImageBackgroundColor = TopContentContainer.a(getContext()).getHeadImageBackgroundColor()) == null) {
            return;
        }
        this.mAddressBarBgColor = headImageBackgroundColor.intValue();
    }

    private void updateBottomPadding(int i) {
        setPadding(0, 0, 0, i);
    }

    private void updateDropdownAttachView() {
        this.mExtendContainer.a();
        if (this.mDropdownType == DropdownType.TYPE_WE_APP) {
            attachMiniProgramView(this.mExtendContainer);
        } else if (this.mDropdownType == DropdownType.TYPE_HEADER_TOP_OP) {
            attachHeaderTopOpDropdownView(this.mExtendContainer);
        } else {
            clearAttachView(this.mExtendContainer);
        }
    }

    private void updateDropdownType() {
        DropdownType updateDropdownTypeAndRet = updateDropdownTypeAndRet();
        if (updateDropdownTypeAndRet != this.mDropdownType) {
            this.mDropdownType = updateDropdownTypeAndRet;
            this.mDropdownStateManager.b(this.mDropdownType == DropdownType.TYPE_HEADER_TOP_OP);
            updateDropdownAttachView();
        }
    }

    private DropdownType updateDropdownTypeAndRet() {
        DropdownType dropdownType = DropdownType.TYPE_NONE;
        boolean e = SkinManager.s().e();
        boolean z = PublicSettingManager.a().getBoolean("setting_key_load_image", true);
        TopContentContainer existInstance = TopContentContainer.getExistInstance();
        boolean o = existInstance != null ? existInstance.o() : false;
        if (e && z && this.mHomepageTopOpHeaderDataManager.e() && o) {
            dropdownType = DropdownType.TYPE_HEADER_TOP_OP;
        }
        this.mDropdownJumpUrl = null;
        HomepageTopOpHeaderData f = this.mHomepageTopOpHeaderDataManager.f();
        if (f != null && !TextUtils.isEmpty(f.f39179c)) {
            this.mDropdownJumpUrl = f.f39179c;
        }
        return dropdownType;
    }

    public void updateHomePageBGColor(boolean z) {
        PageFrame s = WindowManager.a().s();
        if (s != null) {
            IWebView homePageInWindow = s.getHomePageInWindow();
            if (homePageInWindow instanceof HomePage) {
                HomePage homePage = (HomePage) homePageInWindow;
                if (z) {
                    homePage.setBackgroundNormalIds(0, e.C);
                } else {
                    homePage.setBackgroundColor(SkinManager.s().e() ? Color.parseColor("#2E6EE1") : 0);
                }
            }
        }
    }

    @Override
    public void actionHome(byte b2) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            if (contentContainer.G()) {
                this.mContentContainer.b((RecyclerViewBase.OnScrollFinishListener) null);
            } else {
                this.mContentContainer.u();
            }
        }
    }

    @Override
    public void active() {
        boolean z;
        boolean z2;
        ContentContainer contentContainer;
        FloatContainer floatContainer;
        if (this.mIsActive) {
            return;
        }
        this.mHomepageTopOpHeaderDataManager.c();
        this.mPageTopHeaderContainer.a(this.mContentMode);
        this.mTopOpPlaceHolderView.a(this.mContentMode);
        updateDropdownType();
        StatManager.b().c("ADRDEV003_FD-fhpActive");
        HomePageProxy.getInstance().a((int) this.mContentMode);
        resetHeaderIfNeeded();
        IBoot iBoot = (IBoot) SDKContext.getInstance().getService(IBoot.class);
        if (iBoot != null && !iBoot.isRunning()) {
            iBoot.setNeedActiveHomePage(true);
            return;
        }
        ContentContainer contentContainer2 = this.mContentContainer;
        if (contentContainer2 != null) {
            contentContainer2.s();
        }
        enterHomePageScene(true);
        EventLog.a("Feeds", "active", "FHP", "mIsColdStart: " + mIsColdStart + "mIsHotStart: " + mIsHotStart, "roadwei", 1);
        QbActivityBase n = ActivityHandler.b().n();
        if (n != null) {
            this.mStatusBarVisiable = !DeviceUtils.b(n.getWindow());
            if (FullScreenManager.a().b(n.getWindow()) && !this.mStatusBarVisiable) {
                n.getWindow().clearFlags(1024);
                EventEmiter.getDefault().emit(new EventMessage("com.tencent.mtt.external.rqd.RQDManager.handleCatchException", Thread.currentThread(), new FullScreenWrongTimeException("find wrong time called full screen!!!!!"), ""));
            }
        }
        if (mIsColdStart) {
            mIsColdStart = false;
            mIsHotStart = false;
            ISearchEngineService iSearchEngineService = (ISearchEngineService) QBContext.getInstance().getService(ISearchEngineService.class);
            if (iSearchEngineService != null) {
                iSearchEngineService.onColdStart();
            }
            ISearchService iSearchService = (ISearchService) QBContext.getInstance().getService(ISearchService.class);
            if (iSearchService != null) {
                iSearchService.preLoadSearchHippyHomePage(getContext());
            }
            z = true;
        } else {
            if (mIsHotStart) {
                mIsHotStart = false;
                z = false;
                z2 = true;
                this.mIsActive = true;
                contentContainer = this.mContentContainer;
                if (contentContainer != null) {
                    contentContainer.a(z, z2, this.mRetunFromInfoContent);
                    this.mRetunFromInfoContent = false;
                }
                floatContainer = this.mFloatContainer;
                if (floatContainer != null) {
                    floatContainer.setContentMode(this.mContentMode);
                    this.mFloatContainer.a(z, z2);
                }
                if (this.mShoudldShowVoiceSearchPanel) {
                    this.mShoudldShowVoiceSearchPanel = false;
                    post(new Runnable() {
                        @Override
                        public void run() {
                            IExploreService iExploreService = (IExploreService) QBContext.getInstance().getService(IExploreService.class);
                            if (iExploreService != null) {
                                iExploreService.startExplore(ContextHolder.getAppContext(), 1);
                                StatManager.b().c("DIINT1_4");
                            }
                        }
                    });
                }
                if (z && this.mIsActive && this.feedsFirstDraw) {
                    onFeedsHomePageDrawEnd();
                }
                Logs.a("show", (Object) TAG);
                HomepageDebugUtils.a(TAG, "[active] mFloatContainer:" + this.mFloatContainer);
                if (this.mFloatContainer != null) {
                    HomepageDebugUtils.a(TAG, "[active] mFloatContainer getVisibility:" + String.valueOf(this.mFloatContainer.getVisibility()));
                    HomepageDebugUtils.a(TAG, "[active] mFloatContainer getWidth:" + this.mFloatContainer.getWidth() + ", getHeight:" + this.mFloatContainer.getHeight());
                    StringBuilder sb = new StringBuilder();
                    sb.append("[active] mFloatContainer getParent:");
                    sb.append(this.mFloatContainer.getParent());
                    HomepageDebugUtils.a(TAG, sb.toString());
                    HomepageDebugUtils.a(TAG, "[active] mFloatContainer mOffset:" + this.mFloatContainer.q);
                    HomepageDebugUtils.a(TAG, "[active] mFloatContainer mContentMode:" + ((int) this.mContentMode));
                    HomepageDebugUtils.a(TAG, "[active] mContentContainer:" + this.mContentContainer);
                    HomepageDebugUtils.a(TAG, "[active] isInContentContainer:" + FloatContainer.a(this.mContentContainer));
                }
                TopHeaderBubbleImpl.getInstance().a(this);
                if (ScanBubbleConfigManager.k().d()) {
                    this.isVoiceOrScanBubbleAlreadyShowed = true;
                    if (shouldAddTask(ScanBubbleConfigManager.k())) {
                        TopHeaderBubbleImpl.getInstance().addBubbleViewTask(1, WindowManager.a().m());
                    }
                }
                if (VoiceBubbleConfigManager.k().d()) {
                    this.isVoiceOrScanBubbleAlreadyShowed = true;
                    if (shouldAddTask(VoiceBubbleConfigManager.k())) {
                        TopHeaderBubbleImpl.getInstance().addBubbleViewTask(2, WindowManager.a().m());
                    }
                }
                if (!this.isVoiceOrScanBubbleAlreadyShowed) {
                    TopHeaderBubbleImpl.getInstance().showBubbleView();
                }
                PCGStatManager.a((View) this);
                this.mDropDownWeakGuidePage.setGuideUpdateListener(this);
                this.mDropDownGuideStateManager.a(this.mContentMode);
                this.mDropDownGuideStateManager.b(HomeExternalSetting.b());
                this.mDropDownGuideStateManager.a(this.mDropDownWeakGuidePage);
            }
            z = false;
        }
        z2 = false;
        this.mIsActive = true;
        contentContainer = this.mContentContainer;
        if (contentContainer != null) {
        }
        floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
        }
        if (this.mShoudldShowVoiceSearchPanel) {
        }
        if (z) {
            onFeedsHomePageDrawEnd();
        }
        Logs.a("show", (Object) TAG);
        HomepageDebugUtils.a(TAG, "[active] mFloatContainer:" + this.mFloatContainer);
        if (this.mFloatContainer != null) {
        }
        TopHeaderBubbleImpl.getInstance().a(this);
        if (ScanBubbleConfigManager.k().d()) {
        }
        if (VoiceBubbleConfigManager.k().d()) {
        }
        if (!this.isVoiceOrScanBubbleAlreadyShowed) {
        }
        PCGStatManager.a((View) this);
        this.mDropDownWeakGuidePage.setGuideUpdateListener(this);
        this.mDropDownGuideStateManager.a(this.mContentMode);
        this.mDropDownGuideStateManager.b(HomeExternalSetting.b());
        this.mDropDownGuideStateManager.a(this.mDropDownWeakGuidePage);
    }

    @Override
    public void addBubbleView(View view, FrameLayout.LayoutParams layoutParams) {
        if (view == null || layoutParams == null) {
            return;
        }
        addView(view, layoutParams);
    }

    @Override
    public void addWrapperView(ViewGroup viewGroup, FrameLayout.LayoutParams layoutParams) {
    }

    public void attachPerformanceView() {
        if (PublicSettingManager.a().getBoolean("performance_boot_can_op", false)) {
            this.mPerView = new View(getContext());
            this.mPerView.setBackgroundColor(SupportMenu.CATEGORY_MASK);
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(20, 20);
            layoutParams.gravity = 51;
            layoutParams.leftMargin = 0;
            layoutParams.topMargin = 0;
            addView(this.mPerView, layoutParams);
        }
    }

    @Override
    public void back(boolean z) {
    }

    @Override
    public boolean can(int i) {
        if (i != 4 && i != 5) {
            if (i == 7) {
                ContentContainer contentContainer = this.mContentContainer;
                if (contentContainer == null || !contentContainer.x()) {
                    return false;
                }
            } else if (i != 9) {
                if (i != 11) {
                    if (i != 12) {
                        return false;
                    }
                } else if (getWidth() <= 0 || getHeight() <= 0) {
                    return false;
                }
            }
        }
        return true;
    }

    @Override
    public void canEnterReadMode(ValueCallback<Boolean> valueCallback) {
    }

    @Override
    public boolean canGoBack() {
        return false;
    }

    @Override
    public boolean canGoForward() {
        return false;
    }

    @Override
    public boolean canHandleUrl(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("qb://home");
    }

    public int canShowFastlinkBubble() {
        if (this.enterNaviSite) {
            return 2;
        }
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            return contentContainer.i();
        }
        return -1;
    }

    @Override
    public void clearBackForwardListFromCur() {
    }

    public void clearBackGroundImage() {
        TopContentContainer existInstance = TopContentContainer.getExistInstance();
        if (existInstance != null) {
            existInstance.h();
        }
    }

    public void clearTopPushText() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.z();
        }
    }

    @Override
    public boolean coverToolbar() {
        return true;
    }

    @Override
    public void deactive() {
        realDeactive(2);
        FastlinkBubbleManager.f40779a = 0L;
        TopHeaderBubbleImpl.getInstance().c();
        this.mDropDownGuideStateManager.b(this.mDropDownWeakGuidePage);
    }

    @Override
    public void destroy() {
        onDestroy();
        this.mDropDownGuideStateManager.c(this.mDropDownWeakGuidePage);
    }

    public void detachPerformanceView() {
        View view = this.mPerView;
        if (view == null || view.getParent() == null) {
            return;
        }
        removeView(this.mPerView);
    }

    @Override
    public void dispatchDraw(Canvas canvas) {
        HomePageGrayHelper homePageGrayHelper = this.mHomePageGrayHelper;
        if (homePageGrayHelper != null) {
            homePageGrayHelper.a(canvas, getWidth(), getHeight());
        }
        super.dispatchDraw(canvas);
        if (DeviceUtils.aq() && !DeviceUtils.a()) {
            ContentContainer contentContainer = this.mContentContainer;
            int contentMode = contentContainer != null ? contentContainer.getContentMode() : -1;
            if (contentMode != 1) {
                if ((ActivityHandler.b().n().getWindow().getAttributes().flags & 1024) == 1024) {
                    return;
                }
                canvas.save();
                boolean z = (HomePageTopHeaderManager.a().b() || HomePageTopHeaderManager.a().c() || HomepageTopOpHeaderDataManager.a().d()) ? false : true;
                canvas.clipRect(0, 0, getMeasuredWidth(), this.mStatusBarHeight);
                if ((contentMode != 2 || !this.enterNaviSite) && z) {
                    canvas.drawColor(this.mAddressBarBgColor);
                }
                canvas.restore();
            }
            HomePageGrayHelper homePageGrayHelper2 = this.mHomePageGrayHelper;
            if (homePageGrayHelper2 != null) {
                homePageGrayHelper2.a(canvas);
            }
        }
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
        return this.mDropdownStateManager.a(motionEvent) || super.dispatchTouchEvent(motionEvent);
    }

    @Override
    public void enterHomePageScene(boolean z) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.setStatusBarColor(z);
        }
    }

    @Override
    public void enterReadMode(ValueCallback<Boolean> valueCallback, Runnable runnable) {
    }

    @Override
    public void exitReadMode() {
    }

    @Override
    public void forward() {
    }

    @Override
    public void fromPage(String str, boolean z, boolean z2) {
    }

    public int getAddressBarBgColor() {
        return this.mAddressBarBgColor;
    }

    @Override
    public AddressBarDataSource getAddressBarDataSource() {
        return this.mAddressBarDataSource;
    }

    @Override
    public int[] getAppFastlinkPos(int i) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            return contentContainer.h(i);
        }
        return null;
    }

    public ContentContainer getContentContainer() {
        return this.mContentContainer;
    }

    @Override
    public String getContentUrl() {
        return null;
    }

    @Override
    public Bundle getExtra() {
        return null;
    }

    @Override
    public int[] getFastlinkItemSize() {
        return new int[]{FastLinkConsts.f40667a, FastLinkConsts.f40667a};
    }

    @Override
    public IFeedsHomePageProxy.ViewPosition getFeedsContentPosition() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            return contentContainer.getFeedsContentTop();
        }
        return null;
    }

    public int getFeedsCurrentY() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            return contentContainer.getFeedsCurrentY();
        }
        return -1;
    }

    public int getFeedsDefaultTop() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            return contentContainer.getFeedsContentDefaultTop();
        }
        return -1;
    }

    @Override
    public IPage.INSTANT_TYPE getInstType() {
        return IPage.INSTANT_TYPE.DEFAULT_MULTI;
    }

    @Override
    public String getPageTitle() {
        return MttResources.l(R.string.bnm);
    }

    @Override
    public View getPageView() {
        return null;
    }

    @Override
    public QBWebView getQBWebView() {
        return null;
    }

    @Override
    @Deprecated
    public int getRequestCode() {
        return this.mRequestCode;
    }

    @Override
    public String getRestoreUrl() {
        return UrlUtils.addParamsToUrl("qb://home", "recover=1");
    }

    @Override
    @Deprecated
    public int getResultCode() {
        return this.mResultCode;
    }

    @Override
    @Deprecated
    public Intent getResultIntent() {
        return this.mResultIntent;
    }

    @Override
    public PageInfo getShareBundle() {
        String l = MttResources.l(h.U);
        String l2 = MttResources.l(h.V);
        String l3 = MttResources.l(h.W);
        PageInfo pageInfo = new PageInfo(0);
        pageInfo.a(l).d(l2).b(l3).b(10);
        pageInfo.a(MttResources.p(g.v));
        return pageInfo;
    }

    public int getSnapShortViewHeight() {
        return getHeight() - (this.mOrientation == 2 ? BrowserUIParams.a() : BrowserUIParams.b());
    }

    public int getSplitY() {
        FullScreenManager.a();
        int m = FullScreenManager.a((Window) null) ? BaseSettings.a().m() : 0;
        return this.mContentContainer != null ? TopContentContainer.getExistInstance().getHeight() + this.mContentContainer.getOffsetY() + m : TopContentContainer.getExistInstance().getHeight() + 0 + m;
    }

    public int getTopoffsetY() {
        if (this.mOrientation == 2) {
            return BrowserUIParams.a();
        }
        return 0;
    }

    @Override
    public String getUrl() {
        return UrlUtils.addParamsToUrl(UrlUtils.addParamsToUrl("qb://home", "recover=1"), "tabId=" + ((IFeedsService) QBContext.getInstance().getService(IFeedsService.class)).getCurrentTabId());
    }

    @Override
    public int getWebviewScrollY() {
        return 0;
    }

    @Override
    public ViewGroup getWrapperView() {
        return null;
    }

    public boolean hasMoreFastlink() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            return contentContainer.e;
        }
        return false;
    }

    @Override
    public boolean isActive() {
        return this.mIsActive;
    }

    @Override
    public boolean isBlankPage() {
        return false;
    }

    @Override
    public boolean isForcePortalScreen() {
        return false;
    }

    @Override
    public boolean isHomePage() {
        return true;
    }

    @Override
    public boolean isPage(IWebView.TYPE type) {
        return type == IWebView.TYPE.HOME;
    }

    @Override
    public boolean isSelectMode() {
        return false;
    }

    @Override
    public boolean isSwitchSkinByMyself() {
        return false;
    }

    @Override
    public void loadUrl(String str) {
        ContentContainer contentContainer;
        if (handlePushUrl(str)) {
            return;
        }
        this.mShoudldShowVoiceSearchPanel = !TextUtils.isEmpty(str) && str.contains("voicesearch=true");
        if (TextUtils.isEmpty(str) || !str.startsWith("qb://home") || (contentContainer = this.mContentContainer) == null) {
            return;
        }
        contentContainer.b(str);
    }

    @Override
    public void loadUrl(String str, Map<String, String> map) {
    }

    public void moveFeedsContent(int i) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.f(i);
        }
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            floatContainer.c(i);
        }
    }

    @Override
    public boolean needsGetureBackForwardAnimation(int i, boolean z) {
        return !this.mIsFastLinkEditMode && z;
    }

    @Override
    public void onApplicationState(ActivityHandler.State state) {
        if (AnonymousClass13.f39118b[state.ordinal()] != 1) {
            return;
        }
        mIsHotStart = true;
    }

    @Override
    protected void onAttachedToWindow() {
        try {
            super.onAttachedToWindow();
        } catch (Exception unused) {
        }
    }

    @Override
    protected void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        reLayoutContent(configuration.orientation);
    }

    @Override
    public void onContentModeChanged(byte b2, byte b3) {
        if (b2 == this.mContentMode) {
            return;
        }
        this.mContentMode = b2;
        this.mDropdownStateManager.a(b2);
        HomePageProxy.getInstance().a((int) this.mContentMode);
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            floatContainer.onContentModeChanged(b2, b3);
        }
        boolean z = false;
        if (this.mOrientation == 2 && (this.mContentMode == 3 || b3 == 3)) {
            z = true;
        }
        if (b3 == 3 || b2 == 3) {
            this.mAddressBarDataSource.i = b2 == 3 ? FeedsToolBarView.class : NormalToolBarView.class;
            if (this.mAddressBarDataSource.f != null) {
                this.mAddressBarDataSource.f.f35859c = b2 != 3 ? (byte) 6 : (byte) 3;
            }
            if (this.mOrientation != 2) {
                z = true;
            }
        }
        if (z) {
            BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        IPageBussinessProxy bussinessProxy = WindowManager.a().x().getBussinessProxy();
                        if (bussinessProxy != null) {
                            bussinessProxy.c((IWebView) null);
                        }
                    } catch (Exception e) {
                        Logs.a(FeedsHomePage.TAG, (Throwable) e);
                    }
                }
            });
        }
        this.mDropDownGuideStateManager.c(this.mContentMode);
        this.mPageTopHeaderContainer.a(this.mContentMode);
        this.mTopOpPlaceHolderView.a(this.mContentMode);
    }

    public void onDestroy() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.B();
        }
        if (this.mFloatContainer != null && FloatContainer.a(this.mContentContainer)) {
            this.mFloatContainer.e();
        }
        removeAllViews();
        EventLog.a("首页回调", HippyEventHubDefineBase.TYPE_ON_DESTROY, HippyEventHubDefineBase.TYPE_ON_DESTROY, HippyEventHubDefineBase.TYPE_ON_DESTROY, "roadwei", 1);
        ActivityHandler.b().b(this);
        EventEmiter.getDefault().unregister("EVENT_KEY_HEAD_IMAGE_BG_UPDATE", this);
        this.mDropdownStateManager.a();
        this.mHomepageTopOpHeaderDataManager.b(this);
        EventEmiter.getDefault().unregister("event.WindowComponentExtensionImp.onHomeClick", this);
        EventEmiter.getDefault().unregister("event.WindowComponentExtensionImp.onMultiWindowClick", this);
    }

    @Override
    public void onDropdownScrolled(int i, int i2) {
        TopContentContainer existInstance;
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            floatContainer.setAlpha(1.0f - (i / i2));
        }
        this.mTopOpPlaceHolderView.a(true);
        if (this.mDropdownType == DropdownType.TYPE_HEADER_TOP_OP) {
            TopContentContainer existInstance2 = TopContentContainer.getExistInstance();
            if (existInstance2 != null) {
                float f = i;
                existInstance2.a(((f / i2) * 0.55f) + 1.0f, f);
            }
            ContentContainer contentContainer = this.mContentContainer;
            if (contentContainer != null) {
                contentContainer.invalidate();
            }
        } else if (this.mContentMode == 1 && (existInstance = TopContentContainer.getExistInstance()) != null) {
            existInstance.setTopContentAlpha(1.0f - (i / i2));
        }
        ContentExtendContainer contentExtendContainer = this.mExtendContainer;
        if (contentExtendContainer != null) {
            contentExtendContainer.setAlpha(i / i2);
            this.mExtendContainer.a(i, i2);
        }
    }

    @Override
    public void onDropdownStateChanged(IQBRefreshDropdown.State state, boolean z) {
        if (state == IQBRefreshDropdown.State.DROP_DOWN) {
            updateBottomPadding(0);
            this.mPageTopHeaderContainer.a(true, true);
            this.mDropDownGuideStateManager.f();
            if (this.mDropdownType == DropdownType.TYPE_HEADER_TOP_OP) {
                showExtendContainerOnTopOpDropdown();
            } else {
                showExtendContainer();
            }
        } else if (state == IQBRefreshDropdown.State.DOWN_LOCK) {
            hideFloatContainer();
            this.mFeedsDropdownVibrator.a(getContext());
        } else if (state == IQBRefreshDropdown.State.FULL_DOWN) {
            if (this.mDropdownType == DropdownType.TYPE_HEADER_TOP_OP) {
                animateToLandingPage();
            } else {
                animateToWeapp();
            }
            this.mFeedsDropdownVibrator.b();
        } else if (state == IQBRefreshDropdown.State.NONE) {
            resetContentContainerAndFloatContainerState(z);
            this.mFeedsDropdownVibrator.b();
            this.mDropDownGuideStateManager.b();
        }
        this.mDropDownState = state;
    }

    @Override
    public void onEnterIntoMultiwindow() {
        deactive();
    }

    @Override
    public void onFastLinkEditModeChanged(boolean z) {
        if (this.mOrientation == 2) {
            this.mAddressBarDataSource.b(z ? 4 : 3);
        }
        this.mIsFastLinkEditMode = z;
    }

    @Override
    public void onFastLinkEditModeChangedBefore() {
    }

    @Override
    public void onFastLinkPopupMenuChanged(boolean z) {
    }

    public void onFeedsFirstDraw() {
        this.feedsFirstDraw = true;
        if (this.mIsActive && this.feedsFirstDraw) {
            onFeedsHomePageDrawEnd();
        }
    }

    public void onFeedsHomePageDrawEnd() {
        ISearchService iSearchService;
        if (mIsColdStartFeedsDrawed && (iSearchService = (ISearchService) QBContext.getInstance().getService(ISearchService.class)) != null && iSearchService.onFeedsHomePageDrawEnd(getContext())) {
            mIsColdStartFeedsDrawed = false;
        }
    }

    @Override
    public void onGuideEnd(HomePageDropDownGuidePage.GuideType guideType) {
        ViewGroup viewGroup;
        if (guideType == HomePageDropDownGuidePage.GuideType.TYPE_STRONG) {
            setFeedContentBGCanDraw(true);
            this.mFloatContainer.setTranslationY(0.0f);
            this.mFloatContainer.setAlpha(1.0f);
            this.mFloatContainer.setScaleX(1.0f);
            this.mFloatContainer.setScaleY(1.0f);
            this.mContentContainer.setTranslationY(0.0f);
            viewGroup = this.mStrongGuideLayer;
        } else if (guideType != HomePageDropDownGuidePage.GuideType.TYPE_WEAK) {
            return;
        } else {
            viewGroup = this.mWeakGuideLayer;
        }
        viewGroup.setVisibility(8);
    }

    @Override
    public void onGuidePrepare(HomePageDropDownGuidePage.GuideType guideType, View view) {
        ViewGroup viewGroup;
        if (guideType == HomePageDropDownGuidePage.GuideType.TYPE_STRONG) {
            this.mStrongGuideLayer.setVisibility(0);
            this.mStrongGuideLayer.removeAllViews();
            if (view == null) {
                return;
            }
            view.setVisibility(8);
            viewGroup = this.mStrongGuideLayer;
        } else {
            if (guideType != HomePageDropDownGuidePage.GuideType.TYPE_WEAK) {
                return;
            }
            this.mWeakGuideLayer.setVisibility(0);
            this.mWeakGuideLayer.removeAllViews();
            if (view == null) {
                return;
            }
            view.setVisibility(8);
            viewGroup = this.mWeakGuideLayer;
        }
        viewGroup.addView(view);
    }

    @Override
    public void onGuideStart(HomePageDropDownGuidePage.GuideType guideType) {
        if (guideType == HomePageDropDownGuidePage.GuideType.TYPE_STRONG) {
            this.mStrongAnimator.a();
            setFeedContentBGCanDraw(false);
            if (this.mContentContainer == null || !SkinManager.s().e()) {
                return;
            }
            this.mContentContainer.setFeedsContentBGColor(-1);
        }
    }

    @Override
    public void onGuideUpdate(HomePageDropDownGuidePage.GuideType guideType, long j, long j2) {
        if (guideType == HomePageDropDownGuidePage.GuideType.TYPE_STRONG) {
            this.mStrongAnimator.a(j, j2);
            this.mFloatContainer.setTranslationY(this.mStrongAnimator.d());
            this.mFloatContainer.setAlpha(this.mStrongAnimator.b());
            this.mFloatContainer.setScaleX(this.mStrongAnimator.c());
            this.mFloatContainer.setScaleY(this.mStrongAnimator.c());
            this.mContentContainer.setTranslationY(this.mStrongAnimator.d());
        }
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = "event.WindowComponentExtensionImp.onHomeClick")
    public void onHomeClickEvent(EventMessage eventMessage) {
        if (FeatureToggle.a(BuildConfig.BUG_TOGGLE_HOMEPAGE_92026469)) {
            checkDropdownAndReset();
        }
    }

    @Override
    public void onImageLoadConfigChanged() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.n();
        }
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        ContentContainer contentContainer;
        PushDialog pushDialog = this.mPushDialog;
        boolean a2 = (pushDialog == null || 4 != i) ? false : pushDialog.a(true);
        if (!a2 && this.mFloatContainer != null && FloatContainer.a(this.mContentContainer) && keyEvent != null) {
            a2 = this.mFloatContainer.onKeyDown(i, keyEvent);
        }
        if (!a2 && (contentContainer = this.mContentContainer) != null && keyEvent != null) {
            a2 = contentContainer.onKeyDown(i, keyEvent);
        }
        return (a2 || keyEvent == null) ? a2 : super.onKeyDown(i, keyEvent);
    }

    @Override
    public boolean onKeyUp(int i, KeyEvent keyEvent) {
        if (i != 4 || !SearchFuncPopManager.a().b()) {
            return false;
        }
        SearchFuncPopManager.a().a(true);
        return true;
    }

    @Override
    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
    }

    @Override
    public void onLeaveFromMultiwindow() {
        AddressBarController.a().q().a(this.mAddressBarDataSource);
        active();
    }

    @Override
    public boolean onLeftRightSwipeTouchEvent(MotionEvent motionEvent) {
        this.mExtendContainer.a(motionEvent);
        return false;
    }

    @Override
    protected void onMeasure(int i, int i2) {
        reLayoutContent(getContext().getResources().getConfiguration().orientation);
        super.onMeasure(i, i2);
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = "event.WindowComponentExtensionImp.onMultiWindowClick")
    public void onMultiClickEvent(EventMessage eventMessage) {
        if (FeatureToggle.a(BuildConfig.BUG_TOGGLE_HOMEPAGE_92026469)) {
            checkDropdownAndReset();
        }
    }

    @Override
    public void onResult(int i, int i2, Intent intent) {
        if (i2 == 100) {
            this.mRetunFromInfoContent = true;
        }
    }

    public void onSettingsChanged(byte b2) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.a(b2);
        }
        if (TopContentContainer.getExistInstance() != null) {
            TopContentContainer.getExistInstance().a();
        }
    }

    @Override
    public void onSkinChangeFinished() {
    }

    @Override
    public void onSkinChanged() {
        changePadStatusBarBg();
        switchSkin();
    }

    @Override
    public void onStart() {
        preActive();
        active();
        if (this.mContentContainer != null) {
            HomePageUnitTime.a(this.statEntry);
            this.mContentContainer.r();
        }
    }

    @Override
    public void onStateChanged() {
        postInvalidate();
    }

    @Override
    public void onStatusBarVisible(boolean z) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.c(z);
        }
        this.mStatusBarVisiable = z;
        HomePageTopHeaderContainer homePageTopHeaderContainer = this.mPageTopHeaderContainer;
        if (homePageTopHeaderContainer != null) {
            homePageTopHeaderContainer.a();
        }
        HomepageTopOpPlaceHolderView homepageTopOpPlaceHolderView = this.mTopOpPlaceHolderView;
        if (homepageTopOpPlaceHolderView != null) {
            homepageTopOpPlaceHolderView.a();
        }
        TopContentContainer.a(getContext()).n();
        FloatContainer.getExistInstance().h();
    }

    @Override
    public void onStop() {
        preDeactive();
        realDeactive(1);
        if (this.mContentContainer != null) {
            HomePageUnitTime.b(this.statEntry);
        }
    }

    @Override
    public void onTopHeaderOpDrawn() {
        updateDropdownType();
    }

    @Override
    public void onTrimMemory(int i) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.i(i);
        }
    }

    @Override
    public void onWebColorChanged() {
    }

    @Override
    public boolean pageDown(boolean z) {
        return false;
    }

    @Override
    public boolean pageUp(boolean z) {
        return false;
    }

    @Override
    public void pauseAudio() {
    }

    @Override
    public void playAudio() {
    }

    @Override
    public void postUrl(String str, IPostDataBuf iPostDataBuf) {
    }

    @Override
    public void preActive() {
        Logs.c(TAG, "[preActive] mIsActive:" + this.mIsActive + " " + toString());
        checkDropdownAndReset();
    }

    @Override
    public void preDeactive() {
        Logs.c(TAG, "start preDeactive " + this.mIsActive + " " + toString());
    }

    public void prepareForSnapshotDraw() {
        QBViewResourceManager qBViewResourceManager = getQBViewResourceManager();
        if (qBViewResourceManager != null) {
            qBViewResourceManager.r();
        }
        setDrawingCacheEnabled(false);
        setChildrenDrawingCacheEnabled(false);
    }

    @Override
    public void pruneMemory() {
    }

    void realDeactive(int i) {
        PushDialog pushDialog;
        ((IBoot) SDKContext.getInstance().getService(IBoot.class)).setNeedActiveHomePage(false);
        if (2 == i && (pushDialog = this.mPushDialog) != null) {
            pushDialog.a(false);
        }
        if (this.mIsActive) {
            enterHomePageScene(false);
            this.mIsActive = false;
            HomePageProxy.getInstance().a(-1);
            if ((FullScreenManager.a().e(null) & 256) != 0) {
                FullScreenManager.a().b(null, 256);
            }
            ContentContainer contentContainer = this.mContentContainer;
            if (contentContainer != null) {
                contentContainer.t();
                if (this.mContentContainer.G()) {
                    this.mContentContainer.g(0);
                }
            }
            if (this.mFloatContainer == null || !FloatContainer.a(this.mContentContainer)) {
                return;
            }
            this.mFloatContainer.g();
            this.mFloatContainer.a();
        }
    }

    @Override
    public void refreshSkin() {
    }

    @Override
    public void reload() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.v();
            if (this.mContentMode == 1 && this.mFloatContainer != null && FloatContainer.a(this.mContentContainer)) {
                WeatherViewPresenter.a().d();
            }
        }
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer != null) {
            floatContainer.i();
        }
    }

    public void reloadWhenLeave() {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.w();
        }
    }

    @Override
    public void removeBubbleView(final View view) {
        post(new Runnable() {
            @Override
            public void run() {
                FeedsHomePage.this.removeView(view);
            }
        });
    }

    @Override
    public void removeSelectionView() {
    }

    public void removeSnapShot() {
        if (TextUtils.equals(this.mSkinType, SkinManager.p())) {
            return;
        }
        QBTask.a((Callable) new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                File file = new File(FileUtils.e(), "snapshot");
                if (file.exists()) {
                    try {
                        file.delete();
                    } catch (Exception unused) {
                    }
                }
                File file2 = new File(FileUtils.e(), "snapshot_no_feeds");
                if (!file2.exists()) {
                    return null;
                }
                try {
                    file2.delete();
                    return null;
                } catch (Exception unused2) {
                    return null;
                }
            }
        });
    }

    @Override
    public void resetHeaderIfNeeded() {
        ContentContainer contentContainer;
        FloatContainer floatContainer = this.mFloatContainer;
        if (floatContainer == null || !floatContainer.a(this) || (contentContainer = this.mContentContainer) == null) {
            return;
        }
        this.mFloatContainer.setContentContainer(contentContainer);
        this.mFloatContainer.a(this.mContentContainer.getOffsetY());
    }

    public void restoreForSnapshotDraw() {
        QBViewResourceManager qBViewResourceManager = getQBViewResourceManager();
        if (qBViewResourceManager != null) {
            qBViewResourceManager.s();
        }
    }

    @Override
    public void restoreState(String str, Bundle bundle) {
    }

    @Override
    public void rmSkinChangeListener() {
    }

    @Override
    public void setContentMode(byte b2) {
        onContentModeChanged(b2, this.mContentMode);
    }

    @Override
    public void setExtra(Bundle bundle) {
    }

    public void setFeedContentBGCanDraw(boolean z) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.setFeedContentBGCanDraw(z);
            this.mContentContainer.invalidate();
        }
    }

    @Override
    public void setPadding(int i, int i2, int i3, int i4) {
        super.setPadding(i, i2, i3, i4);
    }

    @Override
    @Deprecated
    public void setRequestCode(int i) {
        this.mRequestCode = i;
    }

    @Override
    public void setResult(int i, Intent intent) {
        this.mResultCode = i;
        this.mResultIntent = intent;
    }

    @Override
    public void setSkinChangeListener(IskinSwitchListener iskinSwitchListener) {
    }

    public void setStatEntry(int i) {
        this.statEntry = i;
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.setStatEntry(i);
        }
    }

    @Override
    public void setVisibility(int i) {
        super.setVisibility(i);
    }

    @Override
    public void setWebViewClient(IWebViewClient iWebViewClient) {
    }

    @Override
    public void shutdown() {
        System.currentTimeMillis();
        detachPerformanceView();
        HomeDataCache.a().f();
        FastlinkDataCache.a().h();
        if (((IBootService) QBContext.getInstance().getService(IBootService.class)).isHighEnd() && BaseSettings.a().f71375d == BaseSettings.TempState.UNSET) {
            FeedsProxy.getInstance().a(true);
            ContentContainer contentContainer = this.mContentContainer;
            if (contentContainer != null) {
                contentContainer.b(true);
            }
            if (this.mFloatContainer != null && FloatContainer.a(this.mContentContainer)) {
                this.mFloatContainer.a(true);
            }
            saveSnapshot();
        } else {
            FeedsProxy.getInstance().a(false);
            ContentContainer contentContainer2 = this.mContentContainer;
            if (contentContainer2 != null) {
                contentContainer2.b(false);
            }
        }
        HomeDataCache.a().e();
        FastlinkDataCache.a().g();
        FeedsProxy.getInstance().d();
    }

    @Override
    public Picture snapshotVisible(int i, int i2, IWebView.RatioRespect ratioRespect, int i3) {
        if (i2 == 0) {
            i2 = getHeight();
        }
        Picture picture = new Picture();
        snapshotVisibleOnCanvas(picture.beginRecording(getWidth(), i2), i2, i3);
        picture.endRecording();
        return picture;
    }

    public void snapshotVisibleOnCanvas(Canvas canvas, int i, int i2) {
        snapshotVisibleOnCanvas(canvas, i, i2, false);
    }

    void snapshotVisibleOnCanvas(Canvas canvas, int i, int i2, boolean z) {
        ContentContainer contentContainer;
        prepareForSnapshotDraw();
        boolean z2 = this.mOrientation != 2;
        int h = (((i2 & 1) == 0) || z2) ? 0 : AddressBarController.h();
        canvas.save();
        canvas.translate(0.0f, -h);
        WindowManager.a().x().getBrowserBussinessProxy().a(canvas);
        boolean z3 = z && DeviceUtils.K() >= 26;
        if (z3) {
            TopContentContainer.getExistInstance().setDrawFlagForSpecialDevice(true);
        }
        ContentContainer contentContainer2 = this.mContentContainer;
        if (contentContainer2 != null) {
            contentContainer2.setDrawSnap(true);
        }
        draw(canvas);
        ContentContainer contentContainer3 = this.mContentContainer;
        if (contentContainer3 != null) {
            contentContainer3.setDrawSnap(false);
        }
        if (z3) {
            TopContentContainer.getExistInstance().setDrawFlagForSpecialDevice(false);
        }
        if (!hasMoreFastlink() && z2 && this.mFloatContainer != null && (contentContainer = this.mContentContainer) != null && !FloatContainer.a(contentContainer)) {
            this.mFloatContainer.a(canvas, this.mContentMode, this.mContentContainer.getOffsetY());
        }
        canvas.restore();
        restoreForSnapshotDraw();
        IWebView u = WindowManager.a().u();
        if (u instanceof IHome) {
            IHome iHome = (IHome) u;
            View view = iHome.getHomeTabHost().getView();
            if (view != null) {
                iHome.a();
                canvas.save();
                canvas.translate(0.0f, getHeight() - (BBarHeightUtil.a() * 2));
                view.draw(canvas);
                canvas.restore();
                iHome.b();
            }
        }
    }

    @Override
    public Bitmap snapshotVisibleUsingBitmap(int i, int i2, IWebView.RatioRespect ratioRespect, int i3) {
        float f;
        int i4;
        float f2;
        Bitmap createBitmap;
        int width = getWidth();
        int height = getHeight();
        int i5 = AnonymousClass13.f39117a[ratioRespect.ordinal()];
        try {
            if (i5 == 1) {
                f = i / width;
                if (f != 0.0f) {
                    i4 = (int) (i2 / f);
                    f2 = f;
                    if (i2 == 0) {
                    }
                    if (i == 0) {
                    }
                    createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
                    if (createBitmap == null) {
                    }
                }
            } else {
                if (i5 != 2) {
                    if (i5 != 3) {
                        f = 1.0f;
                        i4 = i2;
                        f2 = 1.0f;
                    } else {
                        f = i / width;
                        f2 = i2 / height;
                        i4 = i2;
                    }
                    if (i2 == 0) {
                        i2 = height;
                    }
                    if (i == 0) {
                        i = width;
                    }
                    createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
                    if (createBitmap == null) {
                        return null;
                    }
                    SnapShotCanvas snapShotCanvas = new SnapShotCanvas(createBitmap);
                    snapShotCanvas.scale(f, f2);
                    snapshotVisibleOnCanvas(snapShotCanvas, i4, i3);
                    return createBitmap;
                }
                f = i2 / height;
            }
            createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
            if (createBitmap == null) {
            }
        } catch (Throwable unused) {
            return null;
        }
        i4 = i2;
        f2 = f;
        if (i2 == 0) {
        }
        if (i == 0) {
        }
    }

    @Override
    public void snapshotVisibleUsingBitmap(Bitmap bitmap, IWebView.RatioRespect ratioRespect, int i) {
        float f;
        float f2;
        if (bitmap == null || bitmap.isRecycled()) {
            return;
        }
        if (getWidth() * getHeight() == 0) {
            prepareSnapShot(bitmap);
        }
        int width = getWidth();
        int height = getHeight();
        int width2 = bitmap.getWidth();
        int height2 = bitmap.getHeight();
        int i2 = AnonymousClass13.f39117a[ratioRespect.ordinal()];
        boolean z = true;
        try {
            if (i2 == 1) {
                f = width2 / width;
                if (f != 0.0f) {
                    height2 = (int) (height2 / f);
                }
            } else {
                if (i2 != 2) {
                    if (i2 != 3) {
                        f = 1.0f;
                        f2 = 1.0f;
                    } else {
                        f = width2 / width;
                        f2 = height2 / height;
                    }
                    SnapShotCanvas snapShotCanvas = new SnapShotCanvas(bitmap);
                    snapShotCanvas.scale(f, f2);
                    if (bitmap.getConfig() == Bitmap.Config.RGB_565) {
                        z = false;
                    }
                    snapshotVisibleOnCanvas(snapShotCanvas, height2, i, z);
                    return;
                }
                f = height2 / height;
            }
            SnapShotCanvas snapShotCanvas2 = new SnapShotCanvas(bitmap);
            snapShotCanvas2.scale(f, f2);
            if (bitmap.getConfig() == Bitmap.Config.RGB_565) {
            }
            snapshotVisibleOnCanvas(snapShotCanvas2, height2, i, z);
            return;
        } catch (Throwable unused) {
            return;
        }
        f2 = f;
    }

    @Override
    public Picture snapshotWholePage(int i, int i2, IWebView.RatioRespect ratioRespect, int i3) {
        return null;
    }

    @Override
    public Bitmap snapshotWholePageUsingBitmap(int i, int i2, IWebView.RatioRespect ratioRespect, int i3) {
        return snapshotVisibleUsingBitmap(i, i2, ratioRespect, i3);
    }

    @Override
    public IWebView.STATUS_BAR statusBarType() {
        ContentContainer contentContainer = this.mContentContainer;
        return contentContainer != null ? contentContainer.getStatus() : SkinManager.s().o() == 2 ? IWebView.STATUS_BAR.NO_SHOW_DARK : IWebView.STATUS_BAR.NO_SHOW_LIGHT;
    }

    @Override
    public void stopLoading() {
    }

    @Override
    public void switchSkin() {
        HomePageTopHeaderContainer homePageTopHeaderContainer;
        super.switchSkin();
        if (FeatureToggle.a(com.tencent.library.BuildConfig.FEATURE_TOGGLE_868853613) && (homePageTopHeaderContainer = this.mPageTopHeaderContainer) != null) {
            homePageTopHeaderContainer.a(this.mContentMode);
        }
        this.mAddressBarBgColor = MttResources.c(e.aK);
        updateAddressBarBgColorIfHeadImageBgColorSet();
        removeSnapShot();
    }

    @Override
    public void toPage(String str) {
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.a(str);
        }
        if (this.mContentMode != 3) {
            String mainUrl = getMainUrl(str);
            if (WEATHER_URL.equals(mainUrl) || CAMERA_URL.equals(mainUrl) || SEARCH_URL.equals(mainUrl) || RN_URL.equals(mainUrl) || READ_URL.equals(mainUrl) || BAIDU_URL.equals(mainUrl) || VIDEO_URL.equals(mainUrl) || NOVEL_URL.equals(mainUrl)) {
                PlatformStatUtils.a("FEEDSLEAVE_" + mainUrl);
            }
        }
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = "EVENT_KEY_HEAD_IMAGE_BG_UPDATE")
    public void updateBackColor(EventMessage eventMessage) {
        updateAddressBarBgColorIfHeadImageBgColorSet();
        ContentContainer contentContainer = this.mContentContainer;
        if (contentContainer != null) {
            contentContainer.setStatusBarColor(false);
        }
        invalidate();
    }

    public void updateFeedsMode(int i) {
        this.mDropdownStateManager.c(i);
        this.mDropDownGuideStateManager.d(i);
    }
}