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

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


package com.tencent.mtt.browser.homepage.view;

import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.AccelerateInterpolator;
import android.widget.FrameLayout;
import com.facebook.common.util.UriUtil;
import com.tencent.common.boot.BootChainEvent;
import com.tencent.common.boot.BootTraceEvent;
import com.tencent.common.boot.BootTracer;
import com.tencent.common.boot.Loader;
import com.tencent.common.featuretoggle.FeatureToggle;
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.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.connect.share.QzonePublish;
import com.tencent.mm.ui.widget.dialog.MMTipsBar;
import com.tencent.mtt.AppInfoHolder;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.QbActivityBase;
import com.tencent.mtt.account.base.IAccount;
import com.tencent.mtt.animation.MockListItemHelper;
import com.tencent.mtt.base.account.AccountInfo;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.hometab.ICustomTabService;
import com.tencent.mtt.base.nativeframework.NativePage;
import com.tencent.mtt.base.privacy.PrivacyAPIRecordUtils;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.boot.base.IBoot;
import com.tencent.mtt.boot.browser.splash.facade.ISplashManager;
import com.tencent.mtt.browser.business.ad.IBusinessADService;
import com.tencent.mtt.browser.engine.AppBroadcastObserver;
import com.tencent.mtt.browser.engine.AppBroadcastReceiver;
import com.tencent.mtt.browser.feeds.FeedsProxy;
import com.tencent.mtt.browser.feeds.data.HomeExternalSetting;
import com.tencent.mtt.browser.feeds.facade.IFeedsService;
import com.tencent.mtt.browser.feeds.rn.view.FeedsHippyPager;
import com.tencent.mtt.browser.feeds.rn.view.FeedsReactEventHub;
import com.tencent.mtt.browser.feeds.rn.view.FeedsReactImageView;
import com.tencent.mtt.browser.feeds.rn.view.FeedsReactQBWaterfallView;
import com.tencent.mtt.browser.feeds.rn.view.FeedsReactViewPager;
import com.tencent.mtt.browser.feeds.rn.view.FeedsSnaper;
import com.tencent.mtt.browser.feeds.rn.view.IFeedsViewPager;
import com.tencent.mtt.browser.feeds.view.ISmoothScroll;
import com.tencent.mtt.browser.homepage.FeedsHomePage;
import com.tencent.mtt.browser.homepage.data.HomePushDataLoader;
import com.tencent.mtt.browser.homepage.view.ContentContainer;
import com.tencent.mtt.browser.homepage.view.feeds.hippy.FeedsRecyclerViewHelper;
import com.tencent.mtt.browser.push.facade.IServiceManager;
import com.tencent.mtt.browser.push.facade.PushMsg;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.window.IWebView;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.browser.window.home.IHome;
import com.tencent.mtt.browser.window.home.view.HomePage;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.costtimelite.CostTimeLite;
import com.tencent.mtt.external.circle.publishersdk.IPublisherSDKService;
import com.tencent.mtt.external.setting.facade.ISettingService;
import com.tencent.mtt.hippy.common.HippyArray;
import com.tencent.mtt.hippy.common.HippyMap;
import com.tencent.mtt.hippy.modules.Promise;
import com.tencent.mtt.hippy.qb.IHippyWindow;
import com.tencent.mtt.hippy.qb.ModuleParams;
import com.tencent.mtt.hippy.qb.QBHippyEngineAdapter;
import com.tencent.mtt.hippy.qb.QBHippyEngineManager;
import com.tencent.mtt.hippy.qb.QBHippyWindow;
import com.tencent.mtt.hippy.qb.extension.ITaidExtension;
import com.tencent.mtt.hippy.qb.modules.base.ICircleModule;
import com.tencent.mtt.hippy.qb.portal.HippyEventHubBase;
import com.tencent.mtt.hippy.qb.portal.HippyNativeContainer;
import com.tencent.mtt.hippy.qb.portal.eventdefine.FeedsHippyEventDefine;
import com.tencent.mtt.hippy.qb.portal.eventdefine.FeedsHippyEventDefineBase;
import com.tencent.mtt.hippy.qb.portal.eventdefine.HippyEventHubDefineBase;
import com.tencent.mtt.hippy.qb.views.hippyiframe.HippyIFrame;
import com.tencent.mtt.hippy.qb.views.hippyiframe.HippyIFrameController;
import com.tencent.mtt.hippy.qb.views.hippypager.HippyPagerSwitch;
import com.tencent.mtt.hippy.qb.views.listview.IQBRefreshDropdown;
import com.tencent.mtt.hippy.qb.views.recyclerview.header.INativeHeaderRefreshListener;
import com.tencent.mtt.hippy.qb.views.superbg.HippyQBSuperBgViewControllerNew;
import com.tencent.mtt.hippy.qb.views.superbg.HippyQBSuperBgViewNew;
import com.tencent.mtt.hippy.qb.views.tabhost.HippyQBTabHostController;
import com.tencent.mtt.hippy.qb.views.video.HippyQBVideoViewController;
import com.tencent.mtt.hippy.qb.views.video.HippyQBVideoViewWrapper;
import com.tencent.mtt.hippy.qb.views.waterfall.HippyQBWaterfallViewController;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebViewController;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebViewFixHippyScroll;
import com.tencent.mtt.hippy.uimanager.HippyCustomViewCreator;
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.qbinfo.QUAUtils;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.setting.BootFlagManager;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.welfare.facade.IPendantService;
import com.tencent.rmp.operation.stat.OperationStat;
import com.tencent.tkd.topicsdk.adapter.qbinterface.ISendEventCallback;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
import qb.hippybusiness.BuildConfig;

public class FeedsRNContainer extends QBFrameLayout implements AppBroadcastObserver, FeedsSnaper, HomePushDataLoader.IHomePushDataLoadListener, AdditionViewHost, ContentContainer.IContentModeChangeListener, ModuleParams.CusTomDemotionCallBack, HippyEventHubBase.IEventListener, INativeHeaderRefreshListener, ISendEventCallback {
    private static Handler E;
    public static Bitmap g;
    static boolean k;
    public static boolean l;
    private static int n = MttResources.s(36) + 1;
    private boolean A;
    private boolean B;
    private Handler C;
    private AdditionView D;
    private long F;
    private long G;
    private long H;
    private float I;
    private boolean J;
    private int K;
    private long L;
    private final IQBRefreshDropdown M;
    private int N;
    private UrlParams O;
    private MockListItemHelper P;
    private Paint Q;
    private boolean R;
    private int S;
    private boolean T;
    private boolean U;
    private long V;
    private boolean W;

    public ContentContainer f40463a;
    private IHippyFeedsListView aa;
    private boolean ab;
    private Paint ac;
    private HashMap<String, SnapStruct> ad;

    QBHippyWindow f40464b;

    public IFeedsViewPager f40465c;

    public boolean f40466d;
    FeedsReactEventHub e;
    public String f;
    public Bitmap h;
    public String i;
    boolean j;
    public boolean m;
    private int o;
    private boolean p;
    private HomePushDataLoader q;
    private ISmoothScroll.ScrollableView r;
    private Rect s;
    private FeedsScrollableWebViewWarper t;
    private int u;
    private IFeedsRNContainerDrawCallback v;
    private boolean w;
    private String x;
    private String y;
    private boolean z;

    public class FeedsHippyCustomViewCreator implements HippyCustomViewCreator {
        public FeedsHippyCustomViewCreator() {
        }

        private View a(Context context) {
            FeedsRNContainer feedsRNContainer;
            IFeedsViewPager iFeedsViewPager;
            if (HippyPagerSwitch.isNewHippyPagerOn()) {
                feedsRNContainer = FeedsRNContainer.this;
                iFeedsViewPager = new FeedsHippyPager(context, feedsRNContainer.f40463a) {
                    @Override
                    protected void dispatchDraw(Canvas canvas) {
                        super.dispatchDraw(canvas);
                        FeedsHippyCustomViewCreator.this.a();
                    }
                };
            } else {
                feedsRNContainer = FeedsRNContainer.this;
                iFeedsViewPager = new FeedsReactViewPager(context, feedsRNContainer.f40463a) {
                    @Override
                    protected void dispatchDraw(Canvas canvas) {
                        super.dispatchDraw(canvas);
                        FeedsHippyCustomViewCreator.this.a();
                    }
                };
            }
            feedsRNContainer.f40465c = iFeedsViewPager;
            EventLog.a("DGFDS", FeedsRNContainer.this.y, "构建Feeds的pager成功-4", "Feeds主体构建成功", "anyuanzhao", 1);
            return FeedsRNContainer.this.f40465c.getView();
        }

        private View a(String str, Context context, HippyMap hippyMap) {
            if (!TextUtils.equals("ListView", str)) {
                return null;
            }
            FeedsRNContainer.this.o();
            FeedsRNContainer feedsRNContainer = FeedsRNContainer.this;
            return FeedsHippyListCreator.a(context, hippyMap, feedsRNContainer, feedsRNContainer.M, new FeedsRecyclerViewHelper(FeedsRNContainer.this), FeedsRNContainer.this);
        }

        public void a() {
            if (FeedsRNContainer.this.p) {
                return;
            }
            PlatformStatUtils.a("LOADFEEDS_DRAW");
            PlatformStatUtils.a("FEEDS_LOAD", System.currentTimeMillis() - FeedsRNContainer.this.L);
            PlatformStatUtils.a("FEEDS_FULL_LOAD", FeedsRNContainer.this.G - FeedsRNContainer.this.L);
            PlatformStatUtils.a("FEEDS_FIRSTDRAW", System.currentTimeMillis() - FeedsRNContainer.this.L);
            PlatformStatUtils.a("FEEDS_HIPPY_FULL_LOAD", FeedsRNContainer.this.G - FeedsRNContainer.this.F);
            PlatformStatUtils.a("FEEDS_HIPPY_FIRSTDRAW", System.currentTimeMillis() - FeedsRNContainer.this.F);
            Logs.c("FEEDS_DRAW", Integer.toHexString(System.identityHashCode(FeedsRNContainer.this)) + " viewpager绘制, " + FeedsRNContainer.this.getChildCount() + Constants.ACCEPT_TIME_SEPARATOR_SP + Integer.toHexString(System.identityHashCode(this)));
            FeedsRNContainer.this.p = true;
            BootChainEvent.c("PageDraw.feeds");
            FeedsRNContainer.this.invalidate();
            if (FeedsRNContainer.this.f40464b != null) {
                HippyMap hippyMap = new HippyMap();
                hippyMap.pushString("primaryKey", String.valueOf(FeedsRNContainer.this.o));
                hippyMap.pushLong("beginloadTimestamp", FeedsRNContainer.this.F);
                hippyMap.pushLong("endloadTimestamp", FeedsRNContainer.this.H);
                hippyMap.pushLong("loadsucTimestamp", FeedsRNContainer.this.G);
                hippyMap.pushLong("firstDrawTimestamp", System.currentTimeMillis());
                FeedsRNContainer.this.f40464b.sendEvent("@feeds:timestamp", hippyMap);
            }
        }

        @Override
        public View createCustomView(String str, Context context, HippyMap hippyMap) {
            HippyMap map;
            String str2;
            int i;
            String str3;
            String str4;
            String str5;
            if (!FeedsRNContainer.this.z) {
                FeedsRNContainer.this.z = true;
                EventLog.a("DGFDS", FeedsRNContainer.this.y, "FeedsHippy开始渲染-3", "前端开始渲染", "anyuanzhao", 1);
                PlatformStatUtils.a("Feeds_Hippy_Load");
            }
            View a2 = a(str, context, hippyMap);
            if (a2 != null) {
                return a2;
            }
            if (TextUtils.equals(HippyQBVideoViewController.CLASS_NAME, str) || TextUtils.equals("TKDVideoView", str)) {
                HippyQBVideoViewWrapper hippyQBVideoViewWrapper = new HippyQBVideoViewWrapper(context);
                hippyQBVideoViewWrapper.setWhere(QBHippyEngineAdapter.FEEDS_BUNDLE_NAME);
                return hippyQBVideoViewWrapper;
            }
            if (TextUtils.equals(HippyQBSuperBgViewControllerNew.CLASS_NAME, str) || TextUtils.equals(HippyQBSuperBgViewControllerNew.CLASS_NAME_TKD, str)) {
                return new HippyQBSuperBgViewNew(context);
            }
            if (TextUtils.equals(HippyQBWaterfallViewController.CLASS_NAME, str) || TextUtils.equals(HippyQBWaterfallViewController.CLASS_NAME_TKD, str)) {
                HomePageFeedsReactQBWaterfallView homePageFeedsReactQBWaterfallView = new HomePageFeedsReactQBWaterfallView(FeedsRNContainer.this, context);
                homePageFeedsReactQBWaterfallView.setQBRefreshDropdownCallback(FeedsRNContainer.this.M);
                ((FeedsReactQBWaterfallView) homePageFeedsReactQBWaterfallView).F = true;
                return homePageFeedsReactQBWaterfallView;
            }
            String str6 = null;
            if (TextUtils.equals("ViewPager", str)) {
                if (hippyMap == null || !hippyMap.containsKey("shouldBindDoubleScroll")) {
                    str2 = FeedsRNContainer.this.y;
                    i = -1;
                    str3 = "DGFDS";
                    str4 = "构建Feeds的pager失败-4";
                    str5 = "没有shouldBindDoubleScroll这个参数";
                } else {
                    if (hippyMap.getBoolean("shouldBindDoubleScroll")) {
                        return a(context);
                    }
                    str2 = FeedsRNContainer.this.y;
                    i = -1;
                    str3 = "DGFDS";
                    str4 = "构建Feeds的pager失败-4";
                    str5 = "shouldBindDoubleScroll为false";
                }
                EventLog.a(str3, str2, str4, str5, "anyuanzhao", i);
                return null;
            }
            if (TextUtils.equals("Image", str)) {
                if (hippyMap.getString("src") != null && hippyMap.getString("src").startsWith(UriUtil.HTTP_SCHEME)) {
                    Object obj = hippyMap.get("reportData");
                    if (obj instanceof HippyMap) {
                        str6 = ((HippyMap) obj).getString("sourceFrom");
                    }
                }
                return new FeedsReactImageView(context, "1", (FeedsRNContainer.this.f40464b == null || FeedsRNContainer.this.f40464b.getHippyRootView() == null) ? "" : FeedsRNContainer.this.f40464b.getHippyRootView().getName(), str6);
            }
            if ((TextUtils.equals(HippyQBTabHostController.CLASS_NAME, str) || TextUtils.equals(HippyQBTabHostController.CLASS_NAME_TKD, str)) && (map = hippyMap.getMap("tabInfo")) != null && map.containsKey("tabHeight")) {
                int unused = FeedsRNContainer.n = MttResources.s(map.getInt("tabHeight"));
                if (FeedsRNContainer.this.f40463a != null) {
                    FeedsRNContainer.this.f40463a.setMaxTopOnScreen(FeedsRNContainer.n);
                }
            }
            if (TextUtils.equals(HippyQBWebViewController.CLASS_NAME, str) || TextUtils.equals(HippyQBWebViewController.CLASS_NAME_TKD, str)) {
                return (!FeatureToggle.a(BuildConfig.BUG_TOGGLE_93711851) || hippyMap == null) ? new HippyQBWebViewFixHippyScroll(context) : new HippyQBWebViewFixHippyScroll(context, hippyMap.getInt(HippyQBWebViewController.WEB_TYPE));
            }
            if (TextUtils.equals(HippyIFrameController.CLASS_NAME, str)) {
                return new HippyIFrame(context) {
                    @Override
                    protected HippyEventHubBase getEventHub() {
                        return new FeedsReactEventHub();
                    }

                    @Override
                    protected HippyCustomViewCreator getIFrameCustomViewCreator() {
                        return new FeedsHippyCustomViewCreator();
                    }
                };
            }
            return null;
        }
    }

    public static class FeedsStopRecord implements ActivityHandler.ActivityStateListener {

        static volatile FeedsStopRecord f40482a;

        public static boolean f40483b;

        public static FeedsStopRecord a() {
            if (f40482a == null) {
                synchronized (FeedsStopRecord.class) {
                    if (f40482a == null) {
                        f40482a = new FeedsStopRecord();
                    }
                }
            }
            return f40482a;
        }

        @Override
        public void onActivityState(QbActivityBase qbActivityBase, ActivityHandler.LifeCycle lifeCycle) {
            if (lifeCycle.equals(ActivityHandler.LifeCycle.onStop)) {
                f40483b = true;
            }
        }
    }

    public class SnapStruct {

        String f40484a;

        int f40485b;

        int f40486c;

        int f40487d;
        int e;

        SnapStruct(String str, int i, int i2, int i3, int i4) {
            this.f40484a = str;
            this.f40485b = i;
            this.f40486c = i2;
            this.f40487d = i3;
            this.e = i4;
        }
    }

    static {
        d();
        k = false;
        l = false;
    }

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

    public FeedsRNContainer(Context context, IQBRefreshDropdown iQBRefreshDropdown, UrlParams urlParams) {
        super(context);
        this.f40464b = null;
        this.o = 0;
        this.p = false;
        this.f40466d = false;
        this.s = new Rect();
        this.u = 0;
        this.w = false;
        this.y = "";
        this.z = false;
        this.A = false;
        this.B = false;
        this.I = 0.0f;
        this.J = false;
        this.K = 15;
        this.P = new MockListItemHelper(this);
        this.j = false;
        this.Q = new Paint();
        this.R = false;
        this.S = 255;
        this.T = true;
        this.U = false;
        this.V = -1L;
        this.m = false;
        this.W = false;
        this.ab = false;
        this.ac = new Paint();
        this.ad = new HashMap<>();
        BootChainEvent.c("FeedsRNContainer.init");
        Logs.a("FEEDSSNAP", new String[]{"FEEDS_DRAW", "FEEDS_CHANNEL_BG"});
        Logs.a("INFOCONTENT", new String[]{"INFO_LOADPAGE", "hippy_infocontent"});
        this.O = urlParams;
        this.M = iQBRefreshDropdown;
        this.y = SimpleDateFormat.getDateTimeInstance().format(new Date()).toString();
        EventLog.a("DGFDS", this.y, "feeds框架构造函数-1", "", "anyuanzhao", 1);
        this.o = hashCode();
        this.L = System.currentTimeMillis();
        a(urlParams);
        this.q = new HomePushDataLoader(this, 1);
        this.q.a(3000L);
        this.C = new Handler(Looper.getMainLooper()) {
            @Override
            public void handleMessage(Message message) {
                int i = message.what;
                if (i != 5) {
                    if (i != 7) {
                        return;
                    }
                    if (FeedsRNContainer.this.D != null) {
                        FeedsRNContainer.this.c();
                    }
                    NativePage homePage = FeedsRNContainer.this.getHomePage();
                    if (homePage != null) {
                        FeedsRNContainer feedsRNContainer = FeedsRNContainer.this;
                        feedsRNContainer.D = new AdditionView(feedsRNContainer.getContext(), FeedsRNContainer.this, null, "commentpage", "commentpage", (HippyMap) message.obj);
                        ((HomePage) homePage).addView(FeedsRNContainer.this.D, new FrameLayout.LayoutParams(-1, -1));
                        return;
                    }
                    return;
                }
                HippyMap hippyMap = (HippyMap) ((Object[]) message.obj)[1];
                String string = hippyMap.getString("url");
                Bundle bundle = new Bundle(9);
                bundle.putString("url", string);
                if (hippyMap.containsKey(ICircleModule.CIRCLE_ARGUMENTS)) {
                    HippyMap map = hippyMap.getMap(ICircleModule.CIRCLE_ARGUMENTS);
                    for (String str : map.keySet()) {
                        bundle.putString(str, map.get(str).toString());
                    }
                }
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(string).a(bundle).d(true).c(0).b(1));
            }
        };
        if (E == null) {
            E = new Handler(BrowserExecutorSupplier.getBusinessLooper("feedssnap"));
        }
        EventEmiter.getDefault().register("com.tencent.mtt.browser.push.event.RED_DOT_RECEIVED", this);
        EventEmiter.getDefault().register(ISplashManager.SPLASH_AMS_ONESHOT_EVENT, this);
        EventEmiter.getDefault().register(ISplashManager.SPLASH_HAS_END, this);
        ActivityHandler.b().a(FeedsStopRecord.a());
    }

    private static HippyArray a(List list) {
        HippyArray hippyArray = new HippyArray();
        for (Object obj : list) {
            if (obj instanceof HashMap) {
                hippyArray.pushMap(b((HashMap<String, Object>) obj));
            } else {
                if (obj instanceof List) {
                    obj = a((List) obj);
                }
                hippyArray.pushObject(obj);
            }
        }
        return hippyArray;
    }

    private void a(Bitmap bitmap) {
        View contentView;
        int height;
        View view;
        if (bitmap == null || ActivityHandler.b().n() == null || (contentView = ActivityHandler.b().n().getContentView()) == null || (height = contentView.getHeight()) < 1) {
            return;
        }
        int i = PublicSettingManager.a().getInt("FEED_TOP", -1);
        try {
            final Bitmap a2 = X5BitmapUtils.a(new File(FileUtils.e(), "snapshot_no_feeds"));
            if (a2 != null && !a2.isRecycled() && i > 0) {
                Canvas canvas = new Canvas(a2);
                canvas.save();
                canvas.translate(0.0f, i);
                canvas.drawBitmap(bitmap, 0.0f, 0.0f, this.ac);
                canvas.restore();
                IWebView u = WindowManager.a().u();
                if ((u instanceof IHome) && (view = ((IHome) u).getHomeTabHost().getView()) != null) {
                    canvas.translate(0.0f, height - view.getHeight());
                    view.draw(canvas);
                }
            }
            E.post(new Runnable() {
                @Override
                public void run() {
                    Bitmap bitmap2;
                    if (a2 != null) {
                        boolean z = false;
                        File file = new File(FileUtils.e(), "snapshot");
                        file.delete();
                        try {
                            try {
                                z = X5BitmapUtils.a(file, a2);
                                bitmap2 = a2;
                            } catch (Exception unused) {
                            }
                        } catch (OutOfMemoryError unused2) {
                            bitmap2 = a2;
                        } catch (Throwable th) {
                            try {
                                a2.recycle();
                            } catch (Exception unused3) {
                            }
                            throw th;
                        }
                        bitmap2.recycle();
                        if (z) {
                            BootFlagManager.b(true);
                        }
                    }
                }
            });
        } catch (Throwable unused) {
        }
    }

    public void a(PlatformStatUtils.PageOpenStep pageOpenStep) {
        UrlParams urlParams = this.O;
        if (urlParams == null || TextUtils.isEmpty(urlParams.a())) {
            return;
        }
        PlatformStatUtils.PageOpenStruct pageOpenStruct = new PlatformStatUtils.PageOpenStruct();
        pageOpenStruct.a(this.O.a());
        pageOpenStruct.b(pageOpenStep.name());
        pageOpenStruct.c(this.O.f46351a);
        pageOpenStruct.d("home");
        pageOpenStruct.a(System.currentTimeMillis());
        PlatformStatUtils.a(pageOpenStruct);
    }

    private void a(FeedsReactImageView feedsReactImageView) {
        if (feedsReactImageView.f38106c) {
            return;
        }
        int[] iArr = new int[2];
        getLocationInWindow(iArr);
        int[] iArr2 = new int[2];
        feedsReactImageView.getLocationInWindow(iArr2);
        String hexString = Integer.toHexString(System.identityHashCode(feedsReactImageView));
        if (feedsReactImageView.getUrl().startsWith("data:image/png;base64")) {
            return;
        }
        this.ad.put(hexString, new SnapStruct(feedsReactImageView.getUrl(), iArr2[0] - iArr[0], iArr2[1] - iArr[1], feedsReactImageView.getWidth(), feedsReactImageView.getHeight()));
    }

    private void a(UrlParams urlParams) {
        long j;
        String str;
        if (this.f40464b != null) {
            return;
        }
        a(PlatformStatUtils.PageOpenStep.BUSINESS_LOAD);
        BootChainEvent.c("FeedsRNContainer.startCreateReactView");
        PlatformStatUtils.a("Feeds_Hippy_Init");
        BootTracer.b("FEEDSRN_CREATE_REACTVIEW", BootTraceEvent.Type.BUSINESS);
        boolean isFeedsRecommendEnabled = ((ISettingService) QBContext.getInstance().getService(ISettingService.class)).isFeedsRecommendEnabled();
        this.e = new FeedsReactEventHub();
        Bundle bundle = new Bundle(9);
        bundle.putString("url", urlParams != null ? urlParams.f46351a : "");
        bundle.putString("active", this.j ? "1" : "0");
        bundle.putString("tabId", "1");
        bundle.putInt("destroyIFrameWhenRemove", 1);
        bundle.putInt("hippyIFrame", 1);
        bundle.putInt("delayInitPage", 1);
        bundle.putBoolean("isFeedsRecommendEnabled", isFeedsRecommendEnabled);
        bundle.putString("updateMode", String.valueOf(HomeExternalSetting.a()));
        int b2 = HomeExternalSetting.b();
        boolean checkTabShowing = ((ICustomTabService) QBContext.getInstance().getService(ICustomTabService.class)).checkTabShowing(112);
        if (b2 == 4 && checkTabShowing) {
            b2 = 0;
        }
        bundle.putString("feedsType", String.valueOf(b2));
        bundle.putString("abilities", this.e.c());
        bundle.putString("guid", AppInfoHolder.getAppInfoByID(AppInfoHolder.AppInfoID.APP_INFO_GUID));
        bundle.putString("qua2", AppInfoHolder.getAppInfoByID(AppInfoHolder.AppInfoID.APP_INFO_QUA2_3));
        bundle.putInt("refreshStyleVer", ((IFeedsService) QBContext.getInstance().getService(IFeedsService.class)).getFeedsHeaderStyle());
        long j2 = -1;
        try {
            PackageInfo packageInfo = ContextHolder.getAppContext().getPackageManager().getPackageInfo(ContextHolder.getAppContext().getPackageName(), 0);
            j = packageInfo.firstInstallTime;
            try {
                j2 = packageInfo.lastUpdateTime;
            } catch (PackageManager.NameNotFoundException unused) {
            }
        } catch (PackageManager.NameNotFoundException unused2) {
            j = -1;
        }
        if (((IBoot) SDKContext.getInstance().getService(IBoot.class)).isNewInstall() && ((IBoot) SDKContext.getInstance().getService(IBoot.class)).isFirstBoot()) {
            bundle.putInt("startUpType", 1);
            bundle.putLong("firstInstallTime", j);
            bundle.putLong("lastUpdateTime", j2);
            str = "Feeds_InstallType_new";
        } else if (((IBoot) SDKContext.getInstance().getService(IBoot.class)).isNewInstall() || !((IBoot) SDKContext.getInstance().getService(IBoot.class)).isFirstBoot()) {
            bundle.putInt("startUpType", 3);
            bundle.putLong("firstInstallTime", j);
            bundle.putLong("lastUpdateTime", j2);
            str = "Feeds_InstallType_common";
        } else {
            bundle.putInt("startUpType", 2);
            bundle.putLong("firstInstallTime", j);
            bundle.putLong("lastUpdateTime", j2);
            str = "Feeds_InstallType_back";
        }
        PlatformStatUtils.a(str);
        bundle.putString("primaryKey", String.valueOf(this.o));
        JSONObject aDDeviceInfo = ((IBusinessADService) QBContext.getInstance().getService(IBusinessADService.class)).getADDeviceInfo(0, false);
        if (aDDeviceInfo != null && !TextUtils.equals(aDDeviceInfo.toString(), "{}")) {
            bundle.putString("ams_sdk_info", aDDeviceInfo.toString());
        }
        HashMap<String, String> turingTicket = ((ITaidExtension) AppManifest.getInstance().queryExtension(ITaidExtension.class, null)).getTuringTicket();
        if (turingTicket.containsKey("turingTicket")) {
            bundle.putString("turingTicket", turingTicket.get("turingTicket"));
        }
        String feedsVideoPath = ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).getFeedsVideoPath();
        String feedsLinkJsonData = ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).getFeedsLinkJsonData();
        Bundle bundle2 = new Bundle();
        Bundle feedsStatBundle = ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).getFeedsStatBundle();
        String feedsVideoId = ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).getFeedsVideoId();
        long feedsEndTimestamp = ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).getFeedsEndTimestamp();
        bundle2.putString(QzonePublish.PUBLISH_TO_QZONE_VIDEO_PATH, feedsVideoPath);
        bundle2.putBundle("rmpStatUrl", feedsStatBundle);
        bundle2.putString("feedsJsonData", feedsLinkJsonData);
        bundle2.putString("feedsEndStamp", String.valueOf(feedsEndTimestamp));
        if (!TextUtils.isEmpty(feedsLinkJsonData) && !TextUtils.isEmpty(feedsVideoPath)) {
            bundle.putBundle("topViewData", bundle2);
        }
        bundle.putInt("terminalRenderOneshot", 1);
        if (TextUtils.isEmpty(feedsVideoPath)) {
            OperationStat.a(14, feedsVideoId, com.tencent.connect.common.Constants.VIA_SHARE_TYPE_INFO, 32, "344", false, QUAUtils.a());
        }
        if (TextUtils.isEmpty(feedsLinkJsonData)) {
            OperationStat.a(14, feedsVideoId, com.tencent.connect.common.Constants.VIA_SHARE_TYPE_INFO, 32, "345", false, QUAUtils.a());
        }
        Activity a2 = (getContext() == null || !(getContext() instanceof Activity)) ? ActivityHandler.b().a() : (Activity) getContext();
        CostTimeLite.a("Boot", "FeedsRN.ModuleParamsBuilder");
        ModuleParams.Builder builder = new ModuleParams.Builder();
        builder.setTraceId(urlParams != null ? urlParams.a() : "");
        ModuleParams build = builder.setModuleName(QBHippyEngineAdapter.FEEDS_BUNDLE_NAME).setComponentName(FeedsHomePage.TAG).setActivity(a2).setProps(bundle).setCustomViewCreator(new FeedsHippyCustomViewCreator()).setCusTomDemotionCallBack(this).setHippyBusinessLoadListener(new IHippyWindow.HippyBusinessLoadListener() {
            @Override
            public void onBusinessBundleLoadBegin() {
                PlatformStatUtils.a("LOADFEEDS_BEGIN");
                FeedsRNContainer.this.F = System.currentTimeMillis();
            }

            @Override
            public void onBusinessBundleLoadEnd() {
                PlatformStatUtils.a("LOADFEEDS_END");
                FeedsRNContainer.this.H = System.currentTimeMillis();
            }

            @Override
            public void onBusinessBundleLoadSuc() {
                FeedsRNContainer.this.a(PlatformStatUtils.PageOpenStep.BUSINESS_UITREECOMPLETED);
                PlatformStatUtils.a("LOADFEEDS_SUC");
                FeedsRNContainer.this.G = System.currentTimeMillis();
            }
        }).build();
        ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).reportLoadJsBundle(false);
        BootTraceEvent b3 = BootTracer.b("FEEDSRNCONTAINER_LOADMODULE", BootTraceEvent.Type.BUSINESS);
        this.f40464b = (QBHippyWindow) QBHippyEngineManager.getInstance().loadModule(build, new IHippyWindow.IHippyRootViewInitFinished() {
            @Override
            public void hippyRootViewFinished(int i) {
                ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).reportLoadJsBundle(true);
                ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).reportStartLoadFeeds();
            }
        });
        b3.a();
        CostTimeLite.b("Boot", "FeedsRN.ModuleParamsBuilder");
        this.e.setQBHippyWindow(this.f40464b);
        this.e.registerListener(this);
        FeedsProxy.getInstance().a(this.e);
        this.e.registNativeMethod(QBHippyEngineAdapter.FEEDS_BUNDLE_NAME);
        if (this.f40464b != null) {
            BootChainEvent.c("FeedsRNContainer.addToRootView");
            EventLog.a("DGFDS", this.y, "构建HippyRoot-2", "构建Feeds的native框", "anyuanzhao", 1);
            addView(this.f40464b, new ViewGroup.LayoutParams(-1, -1));
            i();
        } else {
            EventLog.a("DGFDS", this.y, "构建HippyRoot失败-2", "构建Feeds的native框失败", "anyuanzhao", -1);
        }
        AccountInfo currentUserInfo = ((IAccount) QBContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
        if (currentUserInfo != null && currentUserInfo.isLogined()) {
            PrivacyAPIRecordUtils.a();
        }
        BootTracer.b("FEEDSRN_CREATE_REACTVIEW");
    }

    private static HippyMap b(HashMap<String, Object> hashMap) {
        HippyMap hippyMap = new HippyMap();
        for (String str : hashMap.keySet()) {
            Object obj = hashMap.get(str);
            if (obj instanceof HashMap) {
                hippyMap.pushMap(str, b((HashMap<String, Object>) obj));
            } else if (obj instanceof List) {
                hippyMap.pushArray(str, a((List) obj));
            } else {
                hippyMap.pushObject(str, obj);
            }
        }
        return hippyMap;
    }

    private String b(int i) {
        if (i == 0) {
            return "homepage";
        }
        if (i == 1) {
            return "tab";
        }
        if (i != 2) {
            return null;
        }
        return "startup";
    }

    static boolean d() {
        BootTraceEvent b2 = BootTracer.b("FEEDSRNCONTAINER_DECIDE_SNAP", BootTraceEvent.Type.BUSINESS);
        if (SkinManager.s().q().equals(PublicSettingManager.a().getString("snap_skin_type", ""))) {
            g = X5BitmapUtils.a(new File(FileUtils.e(), "snapshot_hippy_feeds"));
            b2.a();
            return true;
        }
        g = null;
        new File(FileUtils.e(), "snapshot_hippy_feeds").delete();
        b2.a();
        return false;
    }

    static boolean d(String str) {
        if (k) {
            return false;
        }
        k = true;
        return !str.contains("&REF=qb");
    }

    public NativePage getHomePage() {
        ViewParent parent = getParent();
        while (parent != null && !(parent instanceof HomePage)) {
            parent = parent.getParent();
        }
        if (parent != null) {
            return (NativePage) parent;
        }
        return null;
    }

    public static Loader getPreloadTask() {
        return new Loader() {
            @Override
            public void load() {
            }
        };
    }

    private boolean n() {
        Bitmap bitmap = g;
        return bitmap != null && bitmap.getWidth() == getWidth();
    }

    public void o() {
        this.w = true;
        if (TextUtils.isEmpty(this.x)) {
            return;
        }
        BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
            @Override
            public void run() {
                Bundle bundle = new Bundle();
                bundle.putString("url", FeedsRNContainer.this.x);
                if (FeedsRNContainer.this.e != null) {
                    FeedsRNContainer.this.e.b(FeedsRNContainer.this.getHashCode(), "1", FeedsHippyEventDefineBase.TYPE_ON_LOAD_URL, null, bundle);
                }
                FeedsRNContainer.this.x = "";
            }
        });
    }

    private boolean p() {
        Bitmap bitmap = g;
        if (bitmap == null || bitmap.getWidth() != getWidth()) {
            g = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_4444);
        }
        Canvas canvas = new Canvas(g);
        canvas.drawColor(0, PorterDuff.Mode.CLEAR);
        if (SkinManager.s().e() || SkinManager.s().l()) {
            WindowManager.a().x().getBrowserBussinessProxy().a(canvas);
        }
        setDrawSnap(true);
        draw(canvas);
        setDrawSnap(false);
        E.post(new Runnable() {
            @Override
            public void run() {
                File file = new File(FileUtils.e(), "snapshot_hippy_feeds");
                file.delete();
                try {
                    X5BitmapUtils.a(file, FeedsRNContainer.g);
                } catch (OutOfMemoryError unused) {
                }
                PublicSettingManager.a().setString("snap_skin_type", SkinManager.s().q());
            }
        });
        a(g);
        return true;
    }

    public IFeedsViewPager a(View view) {
        Object parent;
        if (view == null || (parent = view.getParent()) == null) {
            return null;
        }
        if (parent instanceof IFeedsViewPager) {
            return (IFeedsViewPager) parent;
        }
        if (parent instanceof View) {
            return a((View) parent);
        }
        return null;
    }

    public void a(Bundle bundle) {
        this.e.b(bundle);
    }

    @Override
    public void a(SparseArray<PushMsg> sparseArray, boolean z) {
        if (sparseArray == null || sparseArray.size() == 0) {
            return;
        }
        Bundle bundle = new Bundle();
        String[] strArr = new String[sparseArray.size()];
        for (int i = 0; i < sparseArray.size(); i++) {
            PushMsg valueAt = sparseArray.valueAt(i);
            if (valueAt != null) {
                strArr[i] = String.valueOf(valueAt.f43994c);
                ((IServiceManager) QBContext.getInstance().getService(IServiceManager.class)).deletePushMsg(valueAt);
            }
        }
        bundle.putStringArray("RedHotTabs", strArr);
        this.e.b(this.o, "1", FeedsHippyEventDefine.TYPE_ON_RED_POINT_TABS, null, bundle);
    }

    public void a(MotionEvent motionEvent) {
        if (motionEvent.getActionMasked() == 0) {
            this.I = motionEvent.getY();
            this.J = true;
            return;
        }
        if (motionEvent.getActionMasked() == 2) {
            if (!this.J || motionEvent.getY() <= n || this.I - motionEvent.getY() <= this.K) {
                return;
            } else {
                ((IPendantService) QBContext.getInstance().getService(IPendantService.class)).shirkVideoForFollowU();
            }
        }
        this.J = false;
    }

    @Override
    public void a(PushMsg pushMsg) {
    }

    @Override
    public void a(String str) {
        IHippyFeedsListView iHippyFeedsListView;
        this.ad.remove(str);
        if (this.ad.size() == 0) {
            this.U = true;
            invalidate();
        }
        if (this.ad.size() == 0 && (iHippyFeedsListView = this.aa) != null && iHippyFeedsListView.getOffsetY() == 0) {
            this.aa = null;
            a(false, (IHippyFeedsListView) null);
        }
    }

    @Override
    public void a(String str, HippyMap hippyMap) {
        QBHippyWindow qBHippyWindow = this.f40464b;
        if (qBHippyWindow != null) {
            qBHippyWindow.sendEvent(str, hippyMap);
        }
    }

    @Override
    public void a(HashMap<String, String> hashMap) {
    }

    public void a(boolean z) {
        EventLog.a("DGFDS", this.y, "FeedsRnContainer", "startup: " + z, "roadwei", 1);
        this.j = true;
        AppBroadcastReceiver.a().a(this);
        FeedsScrollableWebViewWarper feedsScrollableWebViewWarper = this.t;
        if (feedsScrollableWebViewWarper != null) {
            feedsScrollableWebViewWarper.b();
        } else {
            int i = z ? 2 : 0;
            Bundle bundle = new Bundle(1);
            bundle.putBoolean("hasStop", FeedsStopRecord.f40483b);
            bundle.putBoolean("thirdcall", d(QUAUtils.a()));
            this.e.a(this.o, "1", HippyEventHubDefineBase.TYPE_ON_ACTIVE, b(i), bundle);
            FeedsStopRecord.f40483b = false;
        }
        AdditionView additionView = this.D;
        if (additionView != null) {
            additionView.f();
        }
        ((IPublisherSDKService) QBContext.getInstance().getService(IPublisherSDKService.class)).addSendEventCallback(this);
        HippyNativeContainer.postClearPreloadInstance();
    }

    public void a(boolean z, IHippyFeedsListView iHippyFeedsListView) {
        try {
            if (!z) {
                Logs.c("FEEDS_DRAW", "record snap from delay");
                this.W = false;
                this.m = false;
                p();
                return;
            }
            this.ad.clear();
            b((View) this);
            if (this.ad.size() != 0) {
                this.aa = iHippyFeedsListView;
                this.W = true;
                this.m = true;
                Logs.c("FEEDS_DRAW", "not record snap from feeds");
                return;
            }
            Logs.c("FEEDS_DRAW", "record snap from feeds");
            this.U = true;
            this.W = false;
            this.m = false;
            p();
        } catch (Throwable unused) {
        }
    }

    @Override
    public boolean a() {
        return this.W;
    }

    public void b(Bundle bundle) {
        if (this.e != null) {
            this.e.b(getHashCode(), bundle.getString("tabId"), bundle.getString("opt"), null, bundle);
        }
    }

    public void b(View view) {
        if (view instanceof FeedsReactImageView) {
            a((FeedsReactImageView) view);
            return;
        }
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            int childCount = viewGroup.getChildCount();
            for (int i = 0; i < childCount; i++) {
                View childAt = viewGroup.getChildAt(i);
                if (childAt instanceof FeedsReactImageView) {
                    a((FeedsReactImageView) childAt);
                } else if (childAt instanceof ViewGroup) {
                    b(childAt);
                }
            }
        }
    }

    public void b(String str) {
        this.f = str;
        if (this.w) {
            Bundle bundle = new Bundle();
            bundle.putString("url", str);
            this.e.b(getHashCode(), "1", FeedsHippyEventDefineBase.TYPE_ON_LOAD_URL, null, bundle);
        } else {
            this.x = str;
        }
        EventLog.a("拉新承接", "获取数据", "Feeds加载url", str, "anyuanzhao", 1);
    }

    public void b(boolean z) {
        removeAllViews();
    }

    @Override
    public boolean b() {
        return this.T;
    }

    @Override
    public void c() {
        AdditionView additionView = this.D;
        if (additionView != null && additionView.getParent() != null) {
            ((ViewGroup) this.D.getParent()).removeView(this.D);
        }
        AdditionView additionView2 = this.D;
        if (additionView2 != null) {
            additionView2.h();
        }
        this.D = null;
    }

    public void c(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("toPageUrl", str);
        this.e.a(this.o, "1", HippyEventHubDefineBase.TYPE_ON_TOPAGE, "homepage", bundle);
    }

    @Override
    public void dispatchDraw(Canvas canvas) {
        StringBuilder sb;
        StringBuilder sb2;
        String str;
        IFeedsViewPager iFeedsViewPager;
        String str2;
        StringBuilder sb3;
        String str3;
        Bitmap bitmap;
        final String hexString = Integer.toHexString(System.identityHashCode(this));
        super.dispatchDraw(canvas);
        if (!this.B) {
            this.B = true;
            EventEmiter.getDefault().emit(new EventMessage("BOOT_FEEDS_FIRST_DRAW", 0, 0, Long.valueOf(System.currentTimeMillis()), new String[]{QBHippyEngineAdapter.FEEDS_BUNDLE_NAME}));
            UrlParams urlParams = this.O;
            BootTracer.d(urlParams == null ? "" : urlParams.f46351a, "tab_feeds");
        }
        if (l) {
            if (!n()) {
                sb = new StringBuilder();
                sb.append(hexString);
                str2 = " 将Feeds截图到首页截图上-画灰块,";
                sb.append(str2);
                sb.append(this.ab);
                Logs.c("FEEDS_DRAW", sb.toString());
                this.P.a(canvas, true);
                return;
            }
            Logs.c("FEEDS_DRAW", hexString + " 将Feeds截图到首页截图上-画截图," + this.ab);
            this.Q.setAlpha(255);
            bitmap = g;
            canvas.drawBitmap(bitmap, 0.0f, 0.0f, this.Q);
        }
        if (this.t != null) {
            this.T = false;
            if (this.A) {
                return;
            }
            this.A = true;
            ContentContainer contentContainer = this.f40463a;
            if (contentContainer != null) {
                contentContainer.j();
            }
            UrlParams urlParams2 = this.O;
            BootTracer.c(urlParams2 != null ? urlParams2.f46351a : "", "tab_feeds");
            return;
        }
        if (getChildCount() == 0 || (iFeedsViewPager = this.f40465c) == null || iFeedsViewPager.getView().getWidth() == 0) {
            if (!n()) {
                sb = new StringBuilder();
                sb.append(hexString);
                sb.append(" Feeds还没有准备好-画灰块,");
                sb.append(this.ab);
                sb.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
                sb.append(canvas);
                Logs.c("FEEDS_DRAW", sb.toString());
                this.P.a(canvas, true);
                return;
            }
            this.h = g;
            this.R = true;
            sb2 = new StringBuilder();
            sb2.append(hexString);
            str = " Feeds还没有准备好-画截图,";
        } else {
            if (this.p) {
                if (this.f40466d) {
                    if (this.U) {
                        this.T = false;
                        if (!this.A) {
                            this.A = true;
                            Logs.c("FEEDS_DRAW", hexString + " 画真实内容," + this.ab);
                            ContentContainer contentContainer2 = this.f40463a;
                            if (contentContainer2 != null) {
                                contentContainer2.j();
                            }
                            UrlParams urlParams3 = this.O;
                            BootTracer.c(urlParams3 != null ? urlParams3.f46351a : "", "tab_feeds");
                        }
                        if (this.ab) {
                            return;
                        }
                        if (!SkinManager.s().e() && !SkinManager.s().l()) {
                            this.R = false;
                            this.S = 0;
                            this.h = null;
                            return;
                        }
                        if (this.R) {
                            this.R = false;
                            ObjectAnimator ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(this, PropertyValuesHolder.ofInt("snapshotAlpha", 255, 0));
                            ofPropertyValuesHolder.setInterpolator(new AccelerateInterpolator());
                            ofPropertyValuesHolder.setDuration(100L);
                            ofPropertyValuesHolder.start();
                            postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    if (FeedsRNContainer.this.h != null) {
                                        FeedsRNContainer.this.R = false;
                                        FeedsRNContainer.this.S = 0;
                                        FeedsRNContainer feedsRNContainer = FeedsRNContainer.this;
                                        feedsRNContainer.h = null;
                                        feedsRNContainer.invalidate();
                                    }
                                }
                            }, 150L);
                        }
                        if (this.S == 0) {
                            this.h = null;
                        }
                        if (this.h != null) {
                            this.Q.setAlpha(this.S);
                            bitmap = this.h;
                            canvas.drawBitmap(bitmap, 0.0f, 0.0f, this.Q);
                        }
                        return;
                    }
                    this.C.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (FeedsRNContainer.this.U) {
                                return;
                            }
                            Logs.c("FEEDS_DRAW", hexString + " Feeds已经准备好-pager画了第一帧,list画了第一帧,图还没准备好-画截图,超时" + FeedsRNContainer.this.ab + ",没有画出来的图的数量:" + FeedsRNContainer.this.ad.size() + Constants.ACCEPT_TIME_SEPARATOR_SP + Integer.toHexString(System.identityHashCode(FeedsRNContainer.this.h)));
                            FeedsRNContainer.this.U = true;
                            FeedsRNContainer.this.invalidate();
                        }
                    }, 150L);
                    if (!n()) {
                        sb3 = new StringBuilder();
                        sb3.append(hexString);
                        str3 = " Feeds已经准备好-pager画了第一帧,list画了第一帧,图还没准备好-前端自行画灰块,";
                        sb3.append(str3);
                        sb3.append(this.ab);
                        Logs.c("FEEDS_DRAW", sb3.toString());
                        return;
                    }
                    this.h = g;
                    this.R = true;
                    sb2 = new StringBuilder();
                    sb2.append(hexString);
                    str = " Feeds已经准备好-pager画了第一帧,list画了第一帧,图还没准备好-画截图,";
                } else {
                    if (!n()) {
                        sb3 = new StringBuilder();
                        sb3.append(hexString);
                        str3 = " Feeds已经准备好-pager画了第一帧,list还没画-前端自行画灰块,";
                        sb3.append(str3);
                        sb3.append(this.ab);
                        Logs.c("FEEDS_DRAW", sb3.toString());
                        return;
                    }
                    this.h = g;
                    this.R = true;
                    sb2 = new StringBuilder();
                    sb2.append(hexString);
                    str = " Feeds已经准备好-pager画了第一帧,list还没画-画截图,";
                }
                bitmap = g;
                canvas.drawBitmap(bitmap, 0.0f, 0.0f, this.Q);
            }
            if (!n()) {
                sb = new StringBuilder();
                sb.append(hexString);
                str2 = " Feeds已经准备好-pager还没有画第一帧-画灰块,";
                sb.append(str2);
                sb.append(this.ab);
                Logs.c("FEEDS_DRAW", sb.toString());
                this.P.a(canvas, true);
                return;
            }
            this.h = g;
            this.R = true;
            sb2 = new StringBuilder();
            sb2.append(hexString);
            str = " Feeds已经准备好-pager还没有画第一帧-画截图,";
        }
        sb2.append(str);
        sb2.append(this.ab);
        sb2.append(Constants.ACCEPT_TIME_SEPARATOR_SP);
        sb2.append(Integer.toHexString(System.identityHashCode(this.h)));
        Logs.c("FEEDS_DRAW", sb2.toString());
        bitmap = g;
        canvas.drawBitmap(bitmap, 0.0f, 0.0f, this.Q);
    }

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

    public void e() {
        this.e.a(this.o, "1", FeedsHippyEventDefineBase.TYPE_ON_CLEARCACHE, null, null);
    }

    public void f() {
        FeedsScrollableWebViewWarper feedsScrollableWebViewWarper = this.t;
        if (feedsScrollableWebViewWarper != null) {
            feedsScrollableWebViewWarper.c();
        } else {
            this.e.a(this.o, "1", "reload", null, null);
            PlatformStatUtils.a("FEEDSCARDEXP_RELOAD");
        }
    }

    public void g() {
        FeedsScrollableWebViewWarper feedsScrollableWebViewWarper = this.t;
        if (feedsScrollableWebViewWarper != null) {
            feedsScrollableWebViewWarper.c();
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("reloadType", 1);
        this.e.a(this.o, "1", "reload", null, bundle);
    }

    @Override
    public View getCusTomDemotionView() {
        EventLog.a("DGFDS", this.y, "Feeds加载失败,用H5-3", "可能是内核加载失败", "anyuanzhao", -1);
        if (this.t == null) {
            this.t = new FeedsScrollableWebViewWarper(getContext(), this.f40463a) {
                @Override
                protected void onAttachedToWindow() {
                    super.onAttachedToWindow();
                    if (FeedsRNContainer.this.f40463a != null) {
                        FeedsRNContainer.this.f40463a.setScrollableView(FeedsRNContainer.this.t);
                    }
                }
            };
        }
        this.t.a("https://qbrnweb.html5.qq.com");
        return this.t;
    }

    public int getDefaultTop() {
        return this.N;
    }

    public int getFeedsHashCode() {
        return this.o;
    }

    public int getHashCode() {
        return this.o;
    }

    public void h() {
        QBHippyWindow qBHippyWindow = this.f40464b;
        if (qBHippyWindow != null) {
            qBHippyWindow.onNoPicModeChanged();
        }
        FeedsScrollableWebViewWarper feedsScrollableWebViewWarper = this.t;
        if (feedsScrollableWebViewWarper != null) {
            feedsScrollableWebViewWarper.e();
        }
    }

    public void i() {
        this.e.a(this.o, "1", FeedsHippyEventDefineBase.TYPE_ON_INSTANTIATED, null, null);
    }

    public void j() {
        IFeedsViewPager iFeedsViewPager = this.f40465c;
        if (iFeedsViewPager != null) {
            iFeedsViewPager.aA_();
        }
        FeedsScrollableWebViewWarper feedsScrollableWebViewWarper = this.t;
        if (feedsScrollableWebViewWarper != null) {
            feedsScrollableWebViewWarper.scrollToTop();
        }
    }

    public void k() {
        if (this.j) {
            this.j = false;
            FeedsScrollableWebViewWarper feedsScrollableWebViewWarper = this.t;
            if (feedsScrollableWebViewWarper != null) {
                feedsScrollableWebViewWarper.d();
            } else {
                this.e.a(this.o, "1", HippyEventHubDefineBase.TYPE_ON_DEACTIVE, "homepage", null);
            }
            AppBroadcastReceiver.a().b(this);
            AdditionView additionView = this.D;
            if (additionView != null) {
                additionView.g();
            }
        }
    }

    public void l() {
        this.e.a(this.o, "1", HippyEventHubDefineBase.TYPE_ON_DESTROY, null, null);
        FeedsProxy.getInstance().b(this.e);
        this.e.unregisterListener(this);
        QBHippyEngineManager.getInstance().destroyModule(this.f40464b);
        AppBroadcastReceiver.a().b(this);
        EventEmiter.getDefault().unregister("com.tencent.mtt.browser.push.event.RED_DOT_RECEIVED", this);
        EventEmiter.getDefault().unregister(ISplashManager.SPLASH_AMS_ONESHOT_EVENT, this);
        EventEmiter.getDefault().unregister(ISplashManager.SPLASH_HAS_END, this);
        HomePushDataLoader homePushDataLoader = this.q;
        if (homePushDataLoader != null) {
            homePushDataLoader.a();
        }
        ContentContainer contentContainer = this.f40463a;
        if (contentContainer != null) {
            contentContainer.b(this);
        }
        FeedsScrollableWebViewWarper feedsScrollableWebViewWarper = this.t;
        if (feedsScrollableWebViewWarper != null && feedsScrollableWebViewWarper.f40490c != null) {
            this.t.f40490c.destroy();
        }
        AdditionView additionView = this.D;
        if (additionView != null) {
            additionView.h();
        }
        this.aa = null;
        ((IPublisherSDKService) QBContext.getInstance().getService(IPublisherSDKService.class)).removeSendEventCallback(this);
    }

    @Override
    public void onAboutToRefresh() {
        ContentContainer contentContainer = this.f40463a;
        if (contentContainer != null) {
            if (contentContainer.getContentMode() == 3) {
                StatManager.b().c("ZCOMM022");
                PlatformStatUtils.a("FEEDSCARDEXP_PULL_TOP");
                return;
            }
            PlatformStatUtils.a("FEEDSCARDEXP_PULL_NONTOP");
            PlatformStatUtils.a("FEEDSTOPSRC_REFRESH");
            this.i = "refresh";
            StatManager.b().c("CYFEEDSTOPPULL");
            StatManager.b().c("ADRDEV003_FD-onAboutToRefresh");
            StatManager.b().c("ADRDEV003_FD-scrollToFeedsModeSum");
            this.f40463a.d(800);
            StatManager.b().c("ZCOMM021");
        }
    }

    @Override
    public void onBroadcastReceiver(Intent intent) {
        if (TextUtils.equals(intent.getAction(), "android.intent.action.SCREEN_OFF")) {
            this.e.a(this.o, "1", FeedsHippyEventDefineBase.TYPE_ON_SCREEN_OFF, null, null);
        }
    }

    @Override
    public void onContentModeChanged(byte b2, byte b3) {
        int i = b2 == 3 ? 1 : 0;
        if (this.u == 0 && i == 1) {
            StatManager.b().c("CYFEEDSTOPTOTOP");
            StatManager.b().c("ADRDEV003_FD-FCNotifyTop");
        }
        if (this.u == 1 && i == 0) {
            StatManager.b().c("CYFEEDSTOPLEAVETOP");
            StatManager.b().c("ADRDEV003_FD-FCNotifyCancelTop");
        }
        if (this.u != i) {
            Bundle bundle = new Bundle();
            bundle.putInt("bFeedsState", i);
            if (i == 1) {
                bundle.putString("topFrom", this.i);
            }
            this.e.b(this.o, "1", FeedsHippyEventDefine.TYPE_ON_FEEDS_STATE_CHANGE, null, bundle);
            this.u = i;
        }
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        AdditionView additionView;
        if (i != 4 || (additionView = this.D) == null) {
            return false;
        }
        if (additionView.c()) {
            return true;
        }
        c();
        return true;
    }

    @Override
    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        ContentContainer contentContainer;
        int i5;
        ContentContainer contentContainer2;
        Rect rect;
        super.onLayout(z, i, i2, i3, i4);
        if (this.f40463a != null) {
            IFeedsViewPager iFeedsViewPager = this.f40465c;
            if (iFeedsViewPager == null || indexOfChild(iFeedsViewPager.getView()) < 0) {
                if (this.t != null) {
                    contentContainer = this.f40463a;
                    i5 = 0;
                } else {
                    contentContainer = this.f40463a;
                    i5 = n;
                }
                contentContainer.setMaxTopOnScreen(i5);
            } else {
                this.f40465c.getCurrentItem();
                this.r = this.f40465c.getPage();
                ISmoothScroll.ScrollableView scrollableView = this.r;
                try {
                    if (scrollableView != null) {
                        scrollableView.getDrawingRect(this.s);
                        offsetDescendantRectToMyCoords(this.r.getDelegate(), this.s);
                        contentContainer2 = this.f40463a;
                        rect = this.s;
                    } else {
                        this.f40465c.getView().getDrawingRect(this.s);
                        offsetDescendantRectToMyCoords(this.f40465c.getView(), this.s);
                        contentContainer2 = this.f40463a;
                        rect = this.s;
                    }
                    contentContainer2.setMaxTopOnScreen(rect.top);
                } catch (IllegalArgumentException unused) {
                }
            }
        }
        this.N = i2;
    }

    @Override
    public boolean onReactEvent(String str, HippyMap hippyMap, Promise promise) {
        if (hippyMap.containsKey(ICircleModule.CIRCLE_ARGUMENTS)) {
            if (!TextUtils.equals(String.valueOf(this.o), hippyMap.getMap(ICircleModule.CIRCLE_ARGUMENTS).getString("primaryKey"))) {
                return true;
            }
        }
        if (hippyMap.containsKey("primaryKey")) {
            if (!TextUtils.equals(String.valueOf(this.o), hippyMap.getString("primaryKey"))) {
                return true;
            }
        }
        if (!HippyEventHubDefineBase.ABILITY_CALL_COMMENT.name.equalsIgnoreCase(str)) {
            if (HippyEventHubDefineBase.ABILITY_CLOSE_COMMENT_MODAL.name.equalsIgnoreCase(str)) {
                this.C.post(new Runnable() {
                    @Override
                    public void run() {
                        FeedsRNContainer.this.c();
                    }
                });
                return true;
            }
            if (!HippyEventHubDefineBase.ABILITY_COMMENTLIST_SEND_MSG.name.equalsIgnoreCase(str)) {
                return false;
            }
            a(HippyEventHubDefineBase.EVENT_COMMON_LIST_SEND_MSG, hippyMap);
            try {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("success", true);
                promise.resolve(jSONObject);
            } catch (JSONException unused) {
            }
            return true;
        }
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis - this.V < MMTipsBar.DURATION_SHORT) {
            return true;
        }
        this.V = currentTimeMillis;
        Message obtainMessage = this.C.obtainMessage(7);
        obtainMessage.obj = hippyMap;
        obtainMessage.sendToTarget();
        try {
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("success", true);
            promise.resolve(jSONObject2);
        } catch (JSONException unused2) {
        }
        return true;
    }

    @Override
    public void onSendEvent(String str, HashMap<String, Object> hashMap) {
        a(str, b(hashMap));
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = ISplashManager.SPLASH_AMS_ONESHOT_EVENT)
    public void onSplashAmsOneShotEvent(EventMessage eventMessage) {
        if (eventMessage.args == null || eventMessage.args.length != 2) {
            return;
        }
        String str = String.class.isInstance(eventMessage.args[0]) ? (String) eventMessage.args[0] : null;
        Bundle bundle = Bundle.class.isInstance(eventMessage.args[1]) ? (Bundle) eventMessage.args[1] : new Bundle();
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.e.a(this.o, "1", str, bundle);
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = ISplashManager.SPLASH_HAS_END)
    public void onSplashEnd(EventMessage eventMessage) {
        Logs.c("disco", "onSplashEnd type=" + ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).getSplashType());
        if (14 == ((ISplashManager) QBContext.getInstance().getService(ISplashManager.class)).getSplashType()) {
            Bundle bundle = new Bundle();
            bundle.putInt("splashend", 1);
            this.f40464b.sendEvent(FeedsHippyEventDefine.EVENT_SPLASH_AD_END, bundle);
        }
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = "com.tencent.mtt.browser.push.event.RED_DOT_RECEIVED")
    public void receivePushNotify(EventMessage eventMessage) {
        HippyMap hippyMap = new HippyMap();
        hippyMap.pushString("json", FeedsProxy.a(((IServiceManager) QBContext.getInstance().getService(IServiceManager.class)).getAllRedDotInfoMultiTask(2)));
        this.e.a(hippyMap);
    }

    public void setContainer(ContentContainer contentContainer) {
        this.f40463a = contentContainer;
        this.f40463a.a(this);
        this.A = false;
    }

    @Override
    public void setContentMode(byte b2) {
    }

    public void setDrawSnap(boolean z) {
        this.ab = z;
    }

    public void setFeedsDrawCallback(IFeedsRNContainerDrawCallback iFeedsRNContainerDrawCallback) {
        this.v = iFeedsRNContainerDrawCallback;
    }

    public void setSnapshotAlpha(int i) {
        this.S = i;
        invalidate();
    }

    public void setTopSrc(String str) {
        this.i = str;
    }

    @Override
    public void switchSkin() {
        QBHippyWindow qBHippyWindow = this.f40464b;
        if (qBHippyWindow != null) {
            qBHippyWindow.onSkinChanged();
        }
        FeedsScrollableWebViewWarper feedsScrollableWebViewWarper = this.t;
        if (feedsScrollableWebViewWarper != null) {
            feedsScrollableWebViewWarper.switchSkin();
        }
        g = null;
        FileUtils.d(new File(FileUtils.e(), "snapshot_hippy_feeds"));
    }
}