QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 FeedsChannelTabPage.java 源代码,内容仅作参考
package com.tencent.mtt.browser.homepage.view;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
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.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window;
import android.view.animation.AccelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.tencent.common.IImageCallBack;
import com.tencent.common.boot.BootChainEvent;
import com.tencent.common.boot.BootTracer;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.fresco.pipeline.ImageHub;
import com.tencent.common.imagecache.imagepipeline.bitmaps.X5BitmapUtils;
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.manifest.annotation.EventThreadMode;
import com.tencent.common.task.QBTask;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.map.geolocation.util.DateUtils;
import com.tencent.mm.ui.widget.dialog.MMTipsBar;
import com.tencent.mtt.AppInfoHolder;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
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.account.facade.INewMessageCenter;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
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.interfaces.IUnitTimeHelper;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.webview.QBWebView;
import com.tencent.mtt.base.webview.common.QBWebViewClient;
import com.tencent.mtt.boot.base.IBoot;
import com.tencent.mtt.browser.StatusBarColorManager;
import com.tencent.mtt.browser.engine.AppBroadcastObserver;
import com.tencent.mtt.browser.engine.AppBroadcastReceiver;
import com.tencent.mtt.browser.feeds.data.HomeExternalSetting;
import com.tencent.mtt.browser.feeds.facade.IFeedsService;
import com.tencent.mtt.browser.feeds.rn.view.FeedsChannelReactEventHub;
import com.tencent.mtt.browser.feeds.rn.view.FeedsHippyPager;
import com.tencent.mtt.browser.feeds.rn.view.FeedsNovelHippyEventHub;
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.IFeedsViewPager;
import com.tencent.mtt.browser.feeds.view.IFeedsPageView;
import com.tencent.mtt.browser.feeds.view.ISmoothScroll;
import com.tencent.mtt.browser.homepage.view.search.SearchBarView;
import com.tencent.mtt.browser.homepage.view.tabpage.TabPageStyleConfig;
import com.tencent.mtt.browser.homepage.view.tabpage.TabPageTopAreaContainerFactory;
import com.tencent.mtt.browser.homepage.view.tabpage.toparea.OnTabPageTopAreaHeightChangeListener;
import com.tencent.mtt.browser.homepage.view.tabpage.toparea.TabPageTopAreaContainer;
import com.tencent.mtt.browser.jsextension.open.IOpenJsApis;
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.data.WindowInfo;
import com.tencent.mtt.browser.window.home.ITabPage;
import com.tencent.mtt.browser.window.home.tab.BBarHeightUtil;
import com.tencent.mtt.browser.window.home.view.FrameTabPage;
import com.tencent.mtt.browser.window.home.view.HomePage;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.external.circle.publishersdk.IPublisherSDKService;
import com.tencent.mtt.external.setting.base.ImageLoadManager;
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.dom.node.NodeProps;
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.QBHippyEngineManager;
import com.tencent.mtt.hippy.qb.QBHippyWindow;
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.portal.eventdefine.HippyPageEventDefine;
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.listpager.HippyQBViewListPager;
import com.tencent.mtt.hippy.qb.views.listpager.HippyQBViewListPagerController;
import com.tencent.mtt.hippy.qb.views.modal.HippyQBModalOnViewHostView;
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.view.HippyQBViewGroup;
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.hippy.views.modal.HippyModalHostManager;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.lottie.LottieAnimationView;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.operation.event.EventLog;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.rmpbusiness.report.TraceEventCallback;
import com.tencent.tkd.topicsdk.adapter.qbinterface.ISendEventCallback;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Callable;
import org.json.JSONException;
import org.json.JSONObject;
import qb.a.g;
import qb.hippybusiness.BuildConfig;
public class FeedsChannelTabPage extends FrameTabPage implements ActivityHandler.ApplicationStateListener, AppBroadcastObserver, AdditionViewHost, OnTabPageTopAreaHeightChangeListener, IHippyWindow.HippyLoadCustomListener, ModuleParams.CusTomDemotionCallBack, HippyEventHubBase.IEventListener, ISendEventCallback {
private static Handler G = null;
public static HashMap<String, Bitmap> h = new HashMap<>();
private static boolean q = true;
private static boolean r;
private AdditionView A;
private String B;
private boolean C;
private long D;
private long E;
private boolean F;
private Paint H;
private final Rect I;
private final RectF J;
private boolean K;
private boolean L;
private long M;
private boolean N;
private MockListItemHelper O;
private TabPageTopAreaContainer P;
private UrlParams Q;
private final TabPageStyleConfig R;
private int S;
private long T;
private IFeedsRNContainerDrawCallback U;
View f40418a;
FeedsChannelReactEventHub f40419b;
View f40420c;
Handler f40421d;
public String e;
public String f;
public String g;
Bitmap i;
boolean j;
boolean k;
boolean l;
SwitchImageView m;
boolean n;
Window o;
boolean p;
private boolean s;
private int t;
private QBWebView u;
private boolean v;
private String w;
private boolean x;
private IFeedsViewPager y;
private boolean z;
static class AnonymousClass16 {
static final int[] f40439a = new int[ActivityHandler.State.values().length];
static {
try {
f40439a[ActivityHandler.State.background.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
}
}
public static class FeedsHippyCustomViewCreator implements HippyCustomViewCreator {
FeedsChannelTabPage f40449a;
String f40450b;
public static class FeedsTabChannelHippyViewGroup extends HippyQBViewGroup {
FeedsChannelTabPage f40457a;
boolean f40458b;
public FeedsTabChannelHippyViewGroup(Context context, FeedsChannelTabPage feedsChannelTabPage) {
super(context);
this.f40458b = false;
this.f40457a = feedsChannelTabPage;
}
public void a(Canvas canvas) {
this.f40458b = true;
FeedsChannelTabPage feedsChannelTabPage = this.f40457a;
if (feedsChannelTabPage != null) {
feedsChannelTabPage.z = true;
this.f40457a.invalidate();
}
}
@Override
public void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
FeedsChannelTabPage feedsChannelTabPage = this.f40457a;
if (feedsChannelTabPage != null && !feedsChannelTabPage.F) {
this.f40457a.F = true;
HippyMap hippyMap = new HippyMap();
hippyMap.pushString("primaryKey", String.valueOf(this.f40457a.t));
hippyMap.pushLong("constructTimestamp", this.f40457a.D);
hippyMap.pushLong("loadSucTimestamp", this.f40457a.E);
hippyMap.pushLong("firstDrawTimestamp", System.currentTimeMillis());
this.f40457a.a("@tabpage:timestamp", hippyMap);
BootChainEvent.c("PageDraw." + this.f40457a.e);
}
a(canvas);
}
}
FeedsHippyCustomViewCreator(FeedsChannelTabPage feedsChannelTabPage, String str) {
this.f40449a = feedsChannelTabPage;
this.f40450b = str;
}
private View a(Context context) {
IFeedsViewPager b2 = HippyPagerSwitch.isNewHippyPagerOn() ? b(context) : new FeedsReactViewPager(context, null) {
private boolean ao = false;
@Override
public void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (getChildCount() <= 1 || this.ao) {
return;
}
this.ao = true;
BootTracer.d(FeedsHippyCustomViewCreator.this.f40449a.Q == null ? "" : FeedsHippyCustomViewCreator.this.f40449a.Q.f46351a, FeedsHippyCustomViewCreator.this.f40449a.e);
BootTracer.c(FeedsHippyCustomViewCreator.this.f40449a.Q != null ? FeedsHippyCustomViewCreator.this.f40449a.Q.f46351a : "", FeedsHippyCustomViewCreator.this.f40449a.e);
}
};
FeedsChannelTabPage feedsChannelTabPage = this.f40449a;
if (feedsChannelTabPage != null) {
feedsChannelTabPage.y = b2;
}
return b2.getView();
}
private void a() {
this.f40449a.v = true;
if (TextUtils.isEmpty(this.f40449a.w)) {
return;
}
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
Bundle bundle = new Bundle();
bundle.putString("url", FeedsHippyCustomViewCreator.this.f40449a.w);
if (FeedsHippyCustomViewCreator.this.f40449a.f40419b != null) {
FeedsHippyCustomViewCreator.this.f40449a.f40419b.b(FeedsHippyCustomViewCreator.this.f40449a.getHashCode(), "1", FeedsHippyEventDefineBase.TYPE_ON_LOAD_URL, null, bundle);
}
FeedsHippyCustomViewCreator.this.f40449a.w = "";
}
});
}
private IFeedsViewPager b(Context context) {
return new FeedsHippyPager(context, null) {
private boolean f40455b = false;
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (getChildCount() <= 1 || this.f40455b) {
return;
}
this.f40455b = true;
BootTracer.d(FeedsHippyCustomViewCreator.this.f40449a.Q == null ? "" : FeedsHippyCustomViewCreator.this.f40449a.Q.f46351a, FeedsHippyCustomViewCreator.this.f40449a.e);
BootTracer.c(FeedsHippyCustomViewCreator.this.f40449a.Q != null ? FeedsHippyCustomViewCreator.this.f40449a.Q.f46351a : "", FeedsHippyCustomViewCreator.this.f40449a.e);
}
};
}
private View c(Context context) {
a();
return new FeedsReactQBWaterfallView(context, null) {
@Override
public void onAttachedToWindow() {
IFeedsViewPager a2;
ISmoothScroll.ScrollableView a3;
super.onAttachedToWindow();
if (FeedsHippyCustomViewCreator.this.f40449a.y != null && (a2 = FeedsChannelTabPage.a(this)) != null && (a3 = a2.a(a2.getViewFromAdapter(a2.getCurrentPage()))) != null && (a3 instanceof IFeedsPageView)) {
a2.setPage((IFeedsPageView) a3);
}
((ViewGroup) getParent()).setClipChildren(false);
}
};
}
private View d(Context context) {
return new FeedsTabChannelHippyViewGroup(context, this.f40449a);
}
View a(Context context, ViewGroup viewGroup) {
return new HippyQBWebViewFixHippyScroll(context) {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
Bundle bundle = new Bundle();
bundle.putString("cancelFrom", "BACK");
TraceEventCallback.a().c(FeedsHippyCustomViewCreator.this.f40450b, bundle);
}
};
}
View a(Context context, ViewGroup viewGroup, int i) {
return new HippyQBWebViewFixHippyScroll(context, i) {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
Bundle bundle = new Bundle();
bundle.putString("cancelFrom", "BACK");
TraceEventCallback.a().c(FeedsHippyCustomViewCreator.this.f40450b, bundle);
}
};
}
View b(Context context, ViewGroup viewGroup) {
return new HippyQBModalOnViewHostView(context, viewGroup);
}
@Override
public View createCustomView(String str, Context context, HippyMap hippyMap) {
HippyMap map;
HashMap<String, String> urlParam;
FeedsChannelTabPage feedsChannelTabPage = this.f40449a;
if (feedsChannelTabPage != null && !feedsChannelTabPage.x) {
this.f40449a.x = true;
this.f40449a.j = true;
}
if (TextUtils.equals("View", str)) {
return d(context);
}
if (TextUtils.equals(HippyQBViewListPagerController.CLASS_NAME, str) || TextUtils.equals(HippyQBViewListPagerController.CLASS_NAME_TKD, str)) {
a();
FeedsChannelTabPage feedsChannelTabPage2 = this.f40449a;
if (feedsChannelTabPage2 == null || !(feedsChannelTabPage2.P instanceof HippyQBViewListPager.PagerScrollChangedListener)) {
return null;
}
return FeedsChannelHippyListCreator.a(context, (HippyQBViewListPager.PagerScrollChangedListener) this.f40449a.P);
}
if (TextUtils.equals("ListView", str)) {
a();
return FeedsChannelHippyListCreator.a(context, hippyMap, this.f40449a);
}
if (TextUtils.equals(HippyQBVideoViewController.CLASS_NAME, str) || TextUtils.equals("TKDVideoView", str)) {
HippyQBVideoViewWrapper hippyQBVideoViewWrapper = new HippyQBVideoViewWrapper(context);
hippyQBVideoViewWrapper.setWhere("portal");
return hippyQBVideoViewWrapper;
}
if (TextUtils.equals(HippyQBWaterfallViewController.CLASS_NAME, str) || TextUtils.equals(HippyQBWaterfallViewController.CLASS_NAME_TKD, str)) {
return c(context);
}
if (TextUtils.equals("ViewPager", str)) {
return a(context);
}
if (TextUtils.equals(HippyModalHostManager.HIPPY_CLASS, str) && hippyMap.getBoolean("specialHost")) {
return b(context, this.f40449a);
}
if (TextUtils.equals(HippyQBWebViewController.CLASS_NAME, str) || TextUtils.equals(HippyQBWebViewController.CLASS_NAME_TKD, str)) {
return FeatureToggle.a(BuildConfig.BUG_TOGGLE_93711851) ? a(context, this.f40449a, hippyMap.getInt(HippyQBWebViewController.WEB_TYPE)) : a(context, this.f40449a);
}
if (TextUtils.equals(HippyIFrameController.CLASS_NAME, str) && hippyMap != null && (map = hippyMap.getMap("src")) != null) {
String string = map.getString("url");
if (!TextUtils.isEmpty(string) && (urlParam = UrlUtils.getUrlParam(string)) != null && urlParam.containsKey("module") && TextUtils.equals("novelBookshelf", urlParam.get("module"))) {
return new HippyIFrame(context) {
@Override
protected HippyEventHubBase getEventHub() {
return new FeedsNovelHippyEventHub();
}
};
}
}
return null;
}
}
public FeedsChannelTabPage(Context context, String str, String str2, String str3, String str4, UrlParams urlParams) {
super(context);
AccountInfo currentUserInfo;
this.s = false;
this.f40418a = null;
this.t = 0;
this.v = false;
this.x = false;
this.z = false;
this.e = "";
this.f = "";
this.g = "";
this.B = null;
this.C = false;
this.F = false;
this.H = new Paint();
this.I = new Rect();
this.J = new RectF();
this.i = null;
this.K = false;
this.j = false;
this.L = false;
this.M = 0L;
this.N = false;
this.k = false;
this.l = true;
this.O = new MockListItemHelper(this);
this.R = new TabPageStyleConfig();
this.p = false;
this.S = 255;
this.T = -1L;
if (TextUtils.isEmpty(str)) {
return;
}
Logs.a("FEEDSSNAP", new String[]{"FEEDS_DRAW", "FEEDS_CHANNEL_BG"});
Logs.a("INFOCONTENT", new String[]{"INFO_LOADPAGE", "hippy_infocontent"});
Activity currentActivity = getCurrentActivity();
if (currentActivity != null) {
this.o = currentActivity.getWindow();
}
TraceEventCallback.a().a(str4, null);
this.e = str;
this.Q = urlParams;
this.f = str2;
this.g = str3;
this.B = str4;
Logs.c("FEEDS_CHANNEL_BG", "rn container init start " + this.B);
this.t = hashCode();
this.C = b(str4);
a(context, str4);
if (f()) {
b();
} else {
a(str, str4);
}
ActivityHandler.b().a(this);
EventEmiter.getDefault().register(ISettingService.EVENT_FEEDS_RECOMMEND_STATUS_CHANGED, this);
EventEmiter.getDefault().register("SEND_FEEDSCHANNEL_LOG", this);
EventEmiter.getDefault().register(INewMessageCenter.NEW_MESSAGE_RECEIVE_EVENT, this);
EventEmiter.getDefault().register("com.tencent.mtt.browser.window.data.WindowInfo.onTabSwitch", this);
this.f40421d = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message message) {
int i = message.what;
if (i != 7) {
if (i != 8) {
return;
}
FeedsChannelTabPage.this.a();
return;
}
if (FeedsChannelTabPage.this.A != null) {
FeedsChannelTabPage.this.c();
}
NativePage homePage = FeedsChannelTabPage.this.getHomePage();
if (homePage != null) {
FeedsChannelTabPage feedsChannelTabPage = FeedsChannelTabPage.this;
feedsChannelTabPage.A = new AdditionView(feedsChannelTabPage.getContext(), FeedsChannelTabPage.this, null, "commentpage", "commentpage", (HippyMap) message.obj);
((HomePage) homePage).addView(FeedsChannelTabPage.this.A, new FrameLayout.LayoutParams(-1, -1));
}
}
};
if (str4.contains("initinconstruct=1") && FeatureToggle.a(com.tencent.library.BuildConfig.BUG_TOGGLE_93946211)) {
g(getStyleConfig().e() == TabPageStyleConfig.LayoutType.hide);
}
a(b(this.o));
if (TextUtils.equals("novelsingletab", str) && (currentUserInfo = ((IAccount) QBContext.getInstance().getService(IAccount.class)).getCurrentUserInfo()) != null && currentUserInfo.isLogined()) {
PrivacyAPIRecordUtils.a();
}
}
static int a(boolean z, Window window) {
if (z) {
return 0;
}
return (b(window) ? 0 : BaseSettings.a().m()) + SearchBarView.f40980a;
}
public static 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;
}
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 boolean a(TabPageStyleConfig.StatusBarStyle statusBarStyle, boolean z) {
StatusBarColorManager statusBarColorManager;
Window window;
IWebView.STATUS_BAR status_bar;
if (!z || SkinManager.s().e()) {
if (statusBarStyle == TabPageStyleConfig.StatusBarStyle.light) {
statusBarColorManager = StatusBarColorManager.getInstance();
window = this.o;
status_bar = IWebView.STATUS_BAR.NO_SHOW_LIGHT;
} else if (statusBarStyle == TabPageStyleConfig.StatusBarStyle.dark) {
statusBarColorManager = StatusBarColorManager.getInstance();
window = this.o;
status_bar = IWebView.STATUS_BAR.NO_SHOW_DARK;
}
statusBarColorManager.a(window, status_bar);
return true;
}
return false;
}
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";
}
private void b(String str, String str2) {
if (!FeatureToggle.a(qb.homepage.BuildConfig.FEATURE_TOGGLE_FEEDS_DEACTIVE_869605617) || this.f40419b == null) {
return;
}
Bundle bundle = new Bundle();
bundle.putString("operation", str2);
this.f40419b.a(this.t, "1", str, "", bundle);
}
public static boolean b(Window window) {
return DeviceUtils.b(window);
}
static Bundle c(boolean z) {
Bundle bundle = new Bundle();
bundle.putBoolean("fromStartStop", z);
return bundle;
}
private void c(Canvas canvas) {
if (this.j) {
return;
}
this.O.a(canvas, true, a(getStyleConfig().e() == TabPageStyleConfig.LayoutType.hide, this.o));
}
private void d(Canvas canvas) {
if (this.K || !h()) {
return;
}
this.H.setAlpha(this.S);
canvas.drawBitmap(h.get(this.e), 0.0f, a(getStyleConfig().e() == TabPageStyleConfig.LayoutType.hide || getStyleConfig().e() == TabPageStyleConfig.LayoutType.under, this.o), this.H);
UrlParams urlParams = this.Q;
BootTracer.d(urlParams == null ? "" : urlParams.f46351a, this.e);
if (FeatureToggle.a(qb.homepage.BuildConfig.BUG_TOGGLE_SNAP_92430817) || this.N) {
return;
}
this.N = true;
this.f40421d.postDelayed(new Runnable() {
@Override
public void run() {
Logs.c("FEEDS_CHANNEL_BG", "remove from delay");
FeedsChannelTabPage.this.g();
}
}, 5000L);
}
private void f(boolean z) {
View view = this.f40418a;
if (view == null || this.f40420c == null) {
return;
}
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.f40420c.getLayoutParams();
if (i()) {
setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), 0);
if (SkinManager.s().l()) {
this.f40420c.setBackground(MttResources.i(g.C));
} else {
this.f40420c.setBackgroundColor(-14408668);
}
layoutParams.bottomMargin = BBarHeightUtil.a();
layoutParams2.height = BBarHeightUtil.a();
} else {
setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), BBarHeightUtil.a());
this.f40420c.setBackgroundColor(0);
layoutParams.bottomMargin = 0;
layoutParams2.height = 0;
}
if (getStyleConfig().e() == TabPageStyleConfig.LayoutType.below) {
layoutParams.topMargin = SearchBarView.f40980a + (z ? 0 : BaseSettings.a().m());
} else {
if (getStyleConfig().e() != TabPageStyleConfig.LayoutType.under && !z) {
r3 = BaseSettings.a().m();
}
layoutParams.topMargin = r3;
}
if (this.f40418a.getParent() == this) {
updateViewLayout(this.f40418a, layoutParams);
}
if (this.f40420c.getParent() == this) {
updateViewLayout(this.f40420c, layoutParams2);
}
}
private void g(boolean z) {
long j;
String str;
callPageOpenStep(PlatformStatUtils.PageOpenStep.BUSINESS_LOAD);
Logs.c("FEEDS_CHANNEL_BG", "startCreateReactView " + this.B);
View view = this.f40418a;
if (view != null) {
((QBHippyWindow) view).destroy();
if (this.f40418a.getParent() != null) {
removeView(this.f40418a);
}
this.f40418a = null;
}
this.f40419b = new FeedsChannelReactEventHub(this.e);
boolean isFeedsRecommendEnabled = ((ISettingService) QBContext.getInstance().getService(ISettingService.class)).isFeedsRecommendEnabled();
Bundle bundle = new Bundle(9);
bundle.putString("tabId", "1");
bundle.putBoolean("isFeedsRecommendEnabled", isFeedsRecommendEnabled);
bundle.putString("updateMode", String.valueOf(HomeExternalSetting.a()));
bundle.putString("feedsType", String.valueOf(HomeExternalSetting.b()));
bundle.putString("abilities", this.f40419b.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());
bundle.putString("tabUrl", this.B);
bundle.putString("url", this.B);
bundle.putInt("topAreaHeight", MttResources.r(this.P.getTopAreaHeight()));
bundle.putInt("bottomBarHeight", MttResources.r(BBarHeightUtil.a()));
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.t));
Activity currentActivity = getCurrentActivity();
boolean equalsIgnoreCase = "hippy-vue".equalsIgnoreCase(UrlUtils.getUrlParam(this.B).get("framework"));
ModuleParams.Builder builder = new ModuleParams.Builder();
if (this.urlParams != null) {
builder.setTraceId(this.urlParams.a());
}
ModuleParams build = builder.setFrameworkType(equalsIgnoreCase ? 1 : 0).setModuleName(this.e).setInstanceLoadSuccessListener(new IHippyWindow.HippyInstanceLoadSuccessListener() {
@Override
public void loadSuccess() {
Logs.c("FEEDS_CHANNEL_BG", "loadSuccess " + FeedsChannelTabPage.this.B);
FeedsChannelTabPage.this.E = System.currentTimeMillis();
FeedsChannelTabPage.this.e();
}
}).setComponentName(this.f).setActivity(currentActivity).setProps(bundle).setCustomViewCreator(new FeedsHippyCustomViewCreator(this, this.B)).setCusTomDemotionCallBack(this).setHippyLoadCustomListener(this).build();
this.D = System.currentTimeMillis();
this.f40418a = (QBHippyWindow) QBHippyEngineManager.getInstance().loadModule(build);
this.f40419b.setQBHippyWindow((QBHippyWindow) this.f40418a);
this.f40419b.registNativeMethod(this.e);
this.f40419b.registerListener(this);
if (this.f40418a != null) {
this.f40418a.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
addView(this.f40418a, 0);
j();
}
if (FeatureToggle.a(qb.homepage.BuildConfig.BUG_TOGGLE_SNAP_92430817)) {
d();
}
}
public NativePage getHomePage() {
ViewParent parent = getParent();
while (parent != null && !(parent instanceof HomePage)) {
parent = parent.getParent();
}
if (parent != null) {
return (NativePage) parent;
}
return null;
}
public TabPageStyleConfig getStyleConfig() {
return this.R;
}
private boolean i() {
return getStyleConfig().d() == TabPageStyleConfig.BottomBarStyle.black;
}
private void j() {
FeedsChannelReactEventHub feedsChannelReactEventHub = this.f40419b;
if (feedsChannelReactEventHub != null) {
feedsChannelReactEventHub.a(this.t, "1", FeedsHippyEventDefineBase.TYPE_ON_INSTANTIATED, null, null);
}
}
public static void setScrollableView(IFeedsViewPager iFeedsViewPager) {
if (iFeedsViewPager != null) {
ISmoothScroll.ScrollableView a2 = iFeedsViewPager.a(iFeedsViewPager.getViewFromAdapter(iFeedsViewPager.getCurrentPage()));
if (a2 instanceof IFeedsPageView) {
iFeedsViewPager.setPage((IFeedsPageView) a2);
}
}
}
public void setSearchBarViewColor(HippyMap hippyMap) {
if (hippyMap != null) {
Logs.c("FeedsChannelTabPage", "更换颜色消息不为空,进行读取");
SearchBarViewStyleConfig searchBarViewStyleConfig = new SearchBarViewStyleConfig();
searchBarViewStyleConfig.a(hippyMap);
this.P.a(searchBarViewStyleConfig);
}
}
void a() {
View findViewWithTag = findViewWithTag("view_refresh_eye");
if (findViewWithTag == null) {
return;
}
try {
removeView(findViewWithTag);
} catch (Exception e) {
Logs.c("FeedsChannelTabPage", "feeds refresh eye remove fail! " + e.toString());
}
Bitmap bitmap = this.i;
if (bitmap == null || bitmap.isRecycled()) {
return;
}
this.i.recycle();
this.i = null;
}
@Override
public void a(int i) {
HippyMap hippyMap = new HippyMap();
hippyMap.pushString("primaryKey", String.valueOf(this.t));
hippyMap.pushLong("topAreaHeight", MttResources.r(i));
a("@tabpage:topAreaHeightChanged", hippyMap);
}
void a(int i, String str, Window window) {
Logs.c("FEEDS_CHANNEL_BG", "setTabPageBgImage COLOR:" + i);
if (this.m == null) {
this.m = new SwitchImageView(getContext());
SimpleSkinBuilder.a((ImageView) this.m.f40599b).f();
SimpleSkinBuilder.a((ImageView) this.m.f40598a).f();
addView(this.m, 0, new FrameLayout.LayoutParams(-1, -1));
}
this.m.setColor(i);
this.m.setUseMaskForNightMode(true);
this.P.b(true);
a((TabPageStyleConfig.StatusBarStyle) TabPageStyleConfig.a(str, TabPageStyleConfig.StatusBarStyle.class, TabPageStyleConfig.StatusBarStyle.dark), false);
}
void a(Context context, String str) {
a(str);
this.P = TabPageTopAreaContainerFactory.a(context, str);
this.P.setHeightChangeListener(this);
this.P.a(b(this.o));
TabPageTopAreaContainer tabPageTopAreaContainer = this.P;
addView(tabPageTopAreaContainer, new FrameLayout.LayoutParams(-1, tabPageTopAreaContainer.getTopAreaHeight()));
if (getStyleConfig().e() == TabPageStyleConfig.LayoutType.hide) {
this.P.setSearchBarVisible(8);
}
this.f40420c = new View(getContext());
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, 0);
layoutParams.gravity = 80;
this.f40420c.setLayoutParams(layoutParams);
addView(this.f40420c);
}
void a(Canvas canvas) {
if (this.u == null && this.k) {
d(canvas);
} else if (this.u == null) {
c(canvas);
}
}
void a(Canvas canvas, int i, int i2) {
int width = this.i.getWidth();
int height = this.i.getHeight();
float f = i * 1.0f;
float a2 = (i2 * 1.0f) - BBarHeightUtil.a();
float f2 = height;
float f3 = (f2 * f) / width;
if (Float.compare(f3, a2) > 0) {
int round = Math.round((((f3 - a2) / 2.0f) / f3) * f2);
this.I.set(0, round, width, height - round);
} else {
this.I.set(0, 0, width, height);
}
float a3 = a(getStyleConfig().e() == TabPageStyleConfig.LayoutType.hide || getStyleConfig().e() == TabPageStyleConfig.LayoutType.under, this.o);
this.J.set(0.0f, a3, f, a2 + a3);
canvas.drawBitmap(this.i, this.I, this.J, this.H);
UrlParams urlParams = this.Q;
BootTracer.d(urlParams == null ? "" : urlParams.f46351a, this.e);
}
void a(ActivityHandler.State state) {
if (!this.e.equals("kdtab") || state == ActivityHandler.State.finish) {
return;
}
b(state == ActivityHandler.State.background ? "onDeactiveOperation" : "onActiveOperation", "applicationLevel");
}
void a(HippyMap hippyMap) {
boolean z = hippyMap.getBoolean(NodeProps.VISIBLE);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.f40418a.getLayoutParams();
if (z) {
this.P.setSearchBarVisible(0);
if (getStyleConfig().e() == TabPageStyleConfig.LayoutType.below) {
layoutParams.topMargin = SearchBarView.f40980a + (b(this.o) ? 0 : BaseSettings.a().m());
} else if (getStyleConfig().e() == TabPageStyleConfig.LayoutType.under) {
layoutParams.topMargin = 0;
}
if (this.f40418a.getParent() != this) {
return;
}
} else {
this.P.setSearchBarVisible(8);
layoutParams.topMargin = 0;
if (this.f40418a.getParent() != this) {
return;
}
}
updateViewLayout(this.f40418a, layoutParams);
}
void a(final Promise promise) {
Logs.c("hippy_feeds", "feedschanneltabpage doSaveFeedsSnapshot call");
if (System.currentTimeMillis() - this.M < 1000) {
return;
}
Logs.c("FEEDS_CHANNEL_BG", "do snap");
this.M = System.currentTimeMillis();
View view = this.f40418a;
if (view != null && view.getWidth() > 0 && this.f40418a.getHeight() > 0 && (h.get(this.e) == null || h.get(this.e).getWidth() != this.f40418a.getWidth() || h.get(this.e).getHeight() != this.f40418a.getHeight())) {
h.put(this.e, Bitmap.createBitmap(this.f40418a.getWidth(), this.f40418a.getHeight(), Bitmap.Config.ARGB_4444));
}
final Bitmap bitmap = h.get(this.e);
Logs.c("hippy_feeds", "feedschanneltabpage doSaveFeedsSnapshot begin to snap");
if (bitmap == null || this.f40418a == null) {
return;
}
Canvas canvas = new Canvas(bitmap);
canvas.drawColor(0, PorterDuff.Mode.CLEAR);
this.f40418a.draw(canvas);
Handler handler = G;
if (handler != null) {
handler.post(new Runnable() {
@Override
public void run() {
File file = new File(FileUtils.e(), "snapshot_feeds_tab_hippy_" + FeedsChannelTabPage.this.e);
file.delete();
try {
X5BitmapUtils.a(file, bitmap);
} catch (OutOfMemoryError unused) {
Logs.c("hippy_feeds", "feedschanneltabpage save snap error");
}
Logs.c("hippy_feeds", "feedschanneltabpage save snap suc");
promise.resolve(true);
}
});
}
}
public void a(String str) {
this.R.a(UrlUtils.getUrlParam(str));
}
@Override
public void a(String str, HippyMap hippyMap) {
View view = this.f40418a;
if (view != null) {
((QBHippyWindow) view).sendEvent(str, hippyMap);
}
}
void a(String str, final Promise promise, String str2, Window window) {
Logs.c("FEEDS_CHANNEL_BG", "setTabPageBgImage IMG:" + str);
if (this.m == null) {
this.m = new SwitchImageView(getContext());
SimpleSkinBuilder.a((ImageView) this.m.f40599b).f();
SimpleSkinBuilder.a((ImageView) this.m.f40598a).f();
addView(this.m, 0, new FrameLayout.LayoutParams(-1, -1));
}
this.m.setImageCallBack(new IImageCallBack() {
@Override
public void onGetImageFailed(String str3, Throwable th) {
HippyMap hippyMap = new HippyMap();
hippyMap.pushInt("result", 1);
hippyMap.pushString("url", str3);
promise.reject(hippyMap);
}
@Override
public void onGetImageSuccess(String str3, Bitmap bitmap) {
HippyMap hippyMap = new HippyMap();
hippyMap.pushInt("result", 0);
promise.resolve(hippyMap);
}
});
this.m.setUrl(str);
this.m.setUseMaskForNightMode(true);
this.P.b(true);
a((TabPageStyleConfig.StatusBarStyle) TabPageStyleConfig.a(str2, TabPageStyleConfig.StatusBarStyle.class, TabPageStyleConfig.StatusBarStyle.dark), false);
}
void a(String str, String str2) {
HashMap<String, String> urlParam = UrlUtils.getUrlParam(str2);
if (urlParam.containsKey("screenShot")) {
String str3 = urlParam.get("screenShot");
if (IOpenJsApis.TRUE.equalsIgnoreCase(str3) || "1".equalsIgnoreCase(str3)) {
this.k = true;
if (this.k) {
return;
}
if (G == null) {
G = new Handler(BrowserExecutorSupplier.getBusinessLooper("feedschannelsnap"));
}
d(str);
return;
}
}
this.k = false;
if (this.k) {
}
}
@Override
public void a(HashMap<String, String> hashMap) {
}
void a(boolean z) {
this.P.setStatusBarStatus(z);
this.P.a(getStyleConfig());
f(z);
a(getStyleConfig().f(), true);
}
@Override
public void active() {
super.active();
Logs.c("FEEDS_CHANNEL_BG", "active " + this.B);
b(false);
}
void b() {
a();
TabPageTopAreaContainer tabPageTopAreaContainer = this.P;
int topAreaHeight = tabPageTopAreaContainer != null ? tabPageTopAreaContainer.getTopAreaHeight() : 0;
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
layoutParams.topMargin = topAreaHeight;
FrameLayout frameLayout = new FrameLayout(getContext());
frameLayout.setTag("view_refresh_eye");
addView(frameLayout, layoutParams);
LottieAnimationView lottieAnimationView = new LottieAnimationView(getContext());
lottieAnimationView.setAnimation("feeds_loading_eye.json");
lottieAnimationView.setRepeatCount(-1);
int s = MttResources.s(50);
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(s, s);
layoutParams2.gravity = 17;
frameLayout.addView(lottieAnimationView, layoutParams2);
lottieAnimationView.playAnimation();
if (this.i != null) {
return;
}
new Handler(BrowserExecutorSupplier.getBusinessLooper("decode_loading_image")).post(new Runnable() {
@Override
public void run() {
FeedsChannelTabPage feedsChannelTabPage = FeedsChannelTabPage.this;
feedsChannelTabPage.i = BitmapFactory.decodeResource(feedsChannelTabPage.getResources(), R.drawable.aso);
}
});
}
void b(Canvas canvas) {
if (!FeatureToggle.a(qb.homepage.BuildConfig.BUG_TOGGLE_SNAP_92430817) || this.f40418a == null) {
a(canvas);
}
}
void b(HippyMap hippyMap) {
HippyArray array = hippyMap.getArray("urls");
int size = array.size();
Logs.c("FEEDS_CHANNEL_BG", "presetTabPageImages, count:" + size);
for (int i = 0; i < size; i++) {
String string = array.getString(i);
if (!TextUtils.isEmpty(string)) {
Logs.c("FEEDS_CHANNEL_BG", "presetTabPageImages, url:" + string);
ImageHub.a().a(string);
}
}
}
public void b(boolean z) {
boolean z2;
boolean z3;
QBWebView qBWebView;
AdditionView additionView;
StatusBarColorManager statusBarColorManager;
Window window;
IWebView.STATUS_BAR status_bar;
if (this.f40418a == null) {
g(getStyleConfig().e() == TabPageStyleConfig.LayoutType.hide);
}
this.n = z;
if (q) {
q = false;
r = false;
z2 = true;
} else {
if (r) {
r = false;
z2 = false;
z3 = true;
boolean z4 = !z2 || z3;
this.p = true;
AppBroadcastReceiver.a().a(this);
qBWebView = this.u;
if (qBWebView == null) {
qBWebView.active();
} else {
int i = z4 ? 2 : 0;
FeedsChannelReactEventHub feedsChannelReactEventHub = this.f40419b;
if (feedsChannelReactEventHub != null) {
feedsChannelReactEventHub.a(this.t, "1", HippyEventHubDefineBase.TYPE_ON_ACTIVE, b(i), c(z));
}
}
IUnitTimeHelper unitTimeHelper = getUnitTimeHelper();
unitTimeHelper.a(this.e);
unitTimeHelper.g(getUrl());
FeedsChannelUnitTime.a(unitTimeHelper);
this.P.a(z2, z3);
additionView = this.A;
if (additionView != null) {
additionView.f();
}
((IPublisherSDKService) QBContext.getInstance().getService(IPublisherSDKService.class)).addSendEventCallback(this);
this.P.setStatusBarStatus(b(this.o));
a(b(this.o));
if (!a(getStyleConfig().f(), true)) {
if (SkinManager.s().l() || SkinManager.s().g()) {
statusBarColorManager = StatusBarColorManager.getInstance();
window = this.o;
status_bar = IWebView.STATUS_BAR.NO_SHOW_LIGHT;
} else {
statusBarColorManager = StatusBarColorManager.getInstance();
window = this.o;
status_bar = IWebView.STATUS_BAR.NO_SHOW_DARK;
}
statusBarColorManager.a(window, status_bar);
}
HippyNativeContainer.removeClearPreloadInstance();
}
z2 = false;
}
z3 = false;
if (z2) {
}
this.p = true;
AppBroadcastReceiver.a().a(this);
qBWebView = this.u;
if (qBWebView == null) {
}
IUnitTimeHelper unitTimeHelper2 = getUnitTimeHelper();
unitTimeHelper2.a(this.e);
unitTimeHelper2.g(getUrl());
FeedsChannelUnitTime.a(unitTimeHelper2);
this.P.a(z2, z3);
additionView = this.A;
if (additionView != null) {
}
((IPublisherSDKService) QBContext.getInstance().getService(IPublisherSDKService.class)).addSendEventCallback(this);
this.P.setStatusBarStatus(b(this.o));
a(b(this.o));
if (!a(getStyleConfig().f(), true)) {
}
HippyNativeContainer.removeClearPreloadInstance();
}
boolean b(String str) {
HashMap<String, String> urlParam = UrlUtils.getUrlParam(str);
if (!urlParam.containsKey("hideheader")) {
return false;
}
String str2 = urlParam.get("hideheader");
return IOpenJsApis.TRUE.equalsIgnoreCase(str2) || "1".equalsIgnoreCase(str2);
}
@Override
public void c() {
AdditionView additionView = this.A;
if (additionView != null && additionView.getParent() != null) {
((ViewGroup) this.A.getParent()).removeView(this.A);
}
AdditionView additionView2 = this.A;
if (additionView2 != null) {
additionView2.h();
}
this.A = null;
}
void c(String str) {
if (this.e.equals("kdtab")) {
b("onDeactiveOperation", str);
}
}
@Override
public int currentSkinStyle() {
return i() ? SkinManager.s().l() ? 1 : 3 : super.currentSkinStyle();
}
void d() {
if (this.N) {
return;
}
this.N = true;
this.f40421d.postDelayed(new Runnable() {
@Override
public void run() {
Logs.c("FEEDS_CHANNEL_BG", "remove from delay");
FeedsChannelTabPage.this.g();
}
}, DateUtils.TEN_SECOND);
}
void d(String str) {
File file = new File(FileUtils.e(), "snapshot_feeds_tab_hippy_" + str);
if (file.exists()) {
h.put(str, X5BitmapUtils.a(file));
}
}
public void d(boolean z) {
this.n = z;
if (this.p) {
this.p = false;
QBWebView qBWebView = this.u;
if (qBWebView != null) {
qBWebView.deactive();
} else {
FeedsChannelReactEventHub feedsChannelReactEventHub = this.f40419b;
if (feedsChannelReactEventHub != null) {
feedsChannelReactEventHub.a(this.t, "1", HippyEventHubDefineBase.TYPE_ON_DEACTIVE, "homepage", c(z));
}
}
AppBroadcastReceiver.a().b(this);
IUnitTimeHelper unitTimeHelper = getUnitTimeHelper();
unitTimeHelper.a(this.e);
unitTimeHelper.g(getUrl());
FeedsChannelUnitTime.b(unitTimeHelper);
this.P.b();
AdditionView additionView = this.A;
if (additionView != null) {
additionView.g();
}
}
}
@Override
public void deActive() {
super.deActive();
Logs.c("FEEDS_CHANNEL_BG", "deActive " + this.B);
Bundle bundle = new Bundle();
bundle.putString("cancelFrom", "BACK");
TraceEventCallback.a().c(this.B, bundle);
d(false);
}
@Override
public void destroy() {
super.destroy();
Logs.c("FEEDS_CHANNEL_BG", "destroy " + this.B);
this.s = true;
FeedsChannelReactEventHub feedsChannelReactEventHub = this.f40419b;
if (feedsChannelReactEventHub != null) {
feedsChannelReactEventHub.a(this.t, "1", HippyEventHubDefineBase.TYPE_ON_DESTROY, null, null);
}
if (this.f40418a != null) {
QBHippyEngineManager.getInstance().destroyModule((QBHippyWindow) this.f40418a);
}
AppBroadcastReceiver.a().b(this);
EventEmiter.getDefault().unregister(ISettingService.EVENT_FEEDS_RECOMMEND_STATUS_CHANGED, this);
EventEmiter.getDefault().unregister("SEND_FEEDSCHANNEL_LOG", this);
EventEmiter.getDefault().unregister(INewMessageCenter.NEW_MESSAGE_RECEIVE_EVENT, this);
EventEmiter.getDefault().unregister("com.tencent.mtt.browser.window.data.WindowInfo.onTabSwitch", this);
QBWebView qBWebView = this.u;
if (qBWebView != null) {
qBWebView.destroy();
}
ActivityHandler.b().b(this);
this.P.c();
AdditionView additionView = this.A;
if (additionView != null) {
additionView.h();
}
((IPublisherSDKService) QBContext.getInstance().getService(IPublisherSDKService.class)).removeSendEventCallback(this);
}
@Override
public void dispatchDraw(Canvas canvas) {
if (f()) {
int width = getWidth();
if (width == 0) {
super.dispatchDraw(canvas);
return;
}
Bitmap bitmap = this.i;
if (bitmap != null && !bitmap.isRecycled()) {
a(canvas, width, getHeight());
}
} else {
b(canvas);
}
super.dispatchDraw(canvas);
}
@Override
protected boolean drawChild(Canvas canvas, View view, long j) {
if (f()) {
return super.drawChild(canvas, view, j);
}
if (!FeatureToggle.a(qb.homepage.BuildConfig.BUG_TOGGLE_SNAP_92430817) || view != this.f40418a) {
return super.drawChild(canvas, view, j);
}
boolean drawChild = super.drawChild(canvas, view, j);
if (this.u == null && this.k) {
d(canvas);
} else if (this.u == null) {
c(canvas);
}
return drawChild;
}
void e() {
if ("kdtab".equals(this.e) && FeatureToggle.a(qb.homepage.BuildConfig.FEATURE_TOGGLE_PRELOADKDDETAILPAGE_867029377)) {
HippyNativeContainer.preloadPage("kandianfloat", "kandianfloat");
HippyNativeContainer.preloadPage("kdarticle", "kdarticle");
}
}
public void e(boolean z) {
if (z) {
g(this.C);
}
}
@Override
public boolean edgeBackforward() {
return this.l;
}
boolean f() {
return FeatureToggle.a(qb.homepage.BuildConfig.FEATURE_TOGGLE_FEEDS_LOADING_869390257) && this.e.equals("kdtab");
}
boolean g() {
Handler handler;
if (f() && (handler = this.f40421d) != null) {
handler.sendEmptyMessage(8);
return true;
}
if (this.L) {
return false;
}
this.L = true;
Logs.c("FEEDS_CHANNEL_BG", "begin remove");
ObjectAnimator ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(this, PropertyValuesHolder.ofInt("SnapshotAlpha", 255, 0));
ofPropertyValuesHolder.setInterpolator(new AccelerateInterpolator());
ofPropertyValuesHolder.setDuration(200L);
ofPropertyValuesHolder.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
super.onAnimationEnd(animator);
Logs.c("FEEDS_CHANNEL_BG", "remove end");
FeedsChannelTabPage.this.K = true;
FeedsChannelTabPage.this.invalidate();
}
});
ofPropertyValuesHolder.start();
return true;
}
Activity getCurrentActivity() {
return (getContext() == null || !(getContext() instanceof Activity)) ? ActivityHandler.b().a() : (Activity) getContext();
}
@Override
public View getCusTomDemotionView() {
Logs.c("FEEDS_CHANNEL_BG", "getCusTomDemotionView " + this.B);
if (this.u == null) {
this.u = new QBWebView(getContext());
this.u.setQBWebViewClient(new QBWebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(QBWebView qBWebView, String str) {
if (TextUtils.equals(str, "https://qbrnweb.html5.qq.com")) {
FeedsChannelTabPage.this.u.loadUrl("https://qbrnweb.html5.qq.com");
} else {
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("https://qbrnweb.html5.qq.com").b(1).c(60));
}
return true;
}
});
}
this.u.loadUrl("https://qbrnweb.html5.qq.com");
return this.u;
}
public int getHashCode() {
return this.t;
}
@Override
public String getPageTitle() {
return this.g;
}
@Override
public View getPageView() {
return this;
}
@Override
public String getUrl() {
return this.B;
}
boolean h() {
Bitmap bitmap = h.get(this.e);
return bitmap != null && bitmap.getWidth() == getWidth();
}
@Override
public void loadUrl(String str) {
Logs.c("FEEDS_CHANNEL_BG", "loadUrl " + this.B);
if (this.v) {
Bundle bundle = new Bundle();
bundle.putString("url", str);
FeedsChannelReactEventHub feedsChannelReactEventHub = this.f40419b;
if (feedsChannelReactEventHub != null) {
feedsChannelReactEventHub.b(getHashCode(), "1", FeedsHippyEventDefineBase.TYPE_ON_LOAD_URL, null, bundle);
}
} else {
this.w = str;
}
EventLog.a("拉新承接", "获取数据", "视频portal加载url", str, "anyuanzhao", 1);
}
@Override
public void onApplicationState(ActivityHandler.State state) {
if (AnonymousClass16.f40439a[state.ordinal()] == 1) {
r = true;
}
a(state);
}
@Override
public void onBroadcastReceiver(Intent intent) {
FeedsChannelReactEventHub feedsChannelReactEventHub;
if (!TextUtils.equals(intent.getAction(), "android.intent.action.SCREEN_OFF") || (feedsChannelReactEventHub = this.f40419b) == null) {
return;
}
feedsChannelReactEventHub.a(this.t, "1", FeedsHippyEventDefineBase.TYPE_ON_SCREEN_OFF, null, null);
}
@Override
public void onEnterIntoMultiwindow() {
deActive();
c("qbMultiWindow");
}
@EventReceiver(createMethod = CreateMethod.NONE, eventName = ISettingService.EVENT_FEEDS_RECOMMEND_STATUS_CHANGED, threadMode = EventThreadMode.MAINTHREAD)
public void onFeedsRecommendStatusChanged(EventMessage eventMessage) {
e(true);
}
@Override
public void onHippyDownloadBegin() {
TraceEventCallback.a().e(this.B, null);
}
@Override
public void onHippyDownloadEnd(boolean z, int i, String str) {
TraceEventCallback.a().b(this.B, z, i, str, null);
}
@Override
public void onHippyLoadBegin() {
TraceEventCallback.a().d(this.B, null);
}
@Override
public void onHippyLoadEnd(boolean z, int i, String str) {
callPageOpenStep(PlatformStatUtils.PageOpenStep.BUSINESS_UITREECOMPLETED);
TraceEventCallback.a().a(this.B, z, i, str, null);
}
@Override
public void onImageLoadConfigChanged() {
View view = this.f40418a;
if (view != null) {
((QBHippyWindow) view).onNoPicModeChanged();
}
QBWebView qBWebView = this.u;
if (qBWebView != null) {
qBWebView.getQBSettings().m(ImageLoadManager.getInstance().getImageLoadsAutomatcily());
this.u.getQBSettings().n(ImageLoadManager.getInstance().a());
}
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
AdditionView additionView;
if (i != 4 || (additionView = this.A) == null) {
return false;
}
if (additionView.c()) {
return true;
}
c();
return true;
}
@Override
public void onLeaveFromMultiwindow() {
active();
}
@Override
public boolean onReactEvent(String str, final HippyMap hippyMap, final Promise promise) {
if (hippyMap.containsKey(ICircleModule.CIRCLE_ARGUMENTS)) {
if (!TextUtils.equals(String.valueOf(this.t), hippyMap.getMap(ICircleModule.CIRCLE_ARGUMENTS).getString("primaryKey"))) {
return true;
}
}
if (hippyMap.containsKey("primaryKey")) {
if (!TextUtils.equals(String.valueOf(this.t), hippyMap.getString("primaryKey"))) {
return true;
}
}
if (FeedsHippyEventDefineBase.ABILITY_CALL_COMMENT.name.equalsIgnoreCase(str)) {
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - this.T < MMTipsBar.DURATION_SHORT) {
return true;
}
this.T = currentTimeMillis;
Message obtainMessage = this.f40421d.obtainMessage(7);
obtainMessage.obj = hippyMap;
obtainMessage.sendToTarget();
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("success", true);
promise.resolve(jSONObject);
} catch (JSONException unused) {
}
return true;
}
if (FeedsHippyEventDefineBase.ABILITY_CLOSE_COMMENT_MODAL.name.equalsIgnoreCase(str)) {
this.f40421d.post(new Runnable() {
@Override
public void run() {
FeedsChannelTabPage.this.c();
}
});
return true;
}
if (FeedsHippyEventDefineBase.ABILITY_COMMENTLIST_SEND_MSG.name.equalsIgnoreCase(str)) {
a(HippyEventHubDefineBase.EVENT_COMMON_LIST_SEND_MSG, hippyMap);
try {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("success", true);
promise.resolve(jSONObject2);
} catch (JSONException unused2) {
}
return true;
}
if (FeedsHippyEventDefine.ABILITY_DO_SNAP.name.equalsIgnoreCase(str)) {
Logs.c("hippy_feeds", "feedschanneltabpage dosnap call");
if (this.k) {
Logs.c("hippy_feeds", "feedschanneltabpage dosnap switch open");
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
FeedsChannelTabPage.this.a(promise);
}
});
}
return true;
}
if (FeedsHippyEventDefine.ABILITY_REMOVE_SNAP.name.equalsIgnoreCase(str)) {
if (f() || this.k) {
Logs.c("FEEDS_CHANNEL_BG", "remove from front");
g();
}
return true;
}
if (HippyPageEventDefine.ABILITY_SET_GESTURE_BACK_ENABLED.name.equalsIgnoreCase(str)) {
this.l = hippyMap.getBoolean(NodeProps.ENABLED);
return true;
}
if (FeedsHippyEventDefine.ABILITY_PRESET_TAB_PAGE_IMAGES.name.equalsIgnoreCase(str)) {
b(hippyMap);
return true;
}
if (FeedsHippyEventDefine.ABILITY_SET_TAB_PAGE_BG_IMAGE.name.equalsIgnoreCase(str)) {
final String string = hippyMap.getString("type");
final String string2 = hippyMap.getString("statusBarType");
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
Logs.c("FEEDS_CHANNEL_BG", "setTabPageBgImage:" + string);
if ("IMG".equals(string)) {
FeedsChannelTabPage.this.a(hippyMap.getString("url"), promise, string2, FeedsChannelTabPage.this.o);
} else if ("COLOR".equals(string)) {
FeedsChannelTabPage.this.a(hippyMap.getInt("color"), string2, FeedsChannelTabPage.this.o);
}
if (FeatureToggle.a(qb.homepage.BuildConfig.FEATURE_TOGGLE_866341647)) {
HippyMap map = hippyMap.getMap("searchArea");
Logs.c("FeedsChannelTabPage", "收到更换颜色消息");
FeedsChannelTabPage.this.setSearchBarViewColor(map);
}
}
});
return true;
}
if (FeedsHippyEventDefine.ABILITY_CLEAR_TAB_PAGE_BG_IMAGE.name.equalsIgnoreCase(str)) {
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
StatusBarColorManager statusBarColorManager;
Window window;
IWebView.STATUS_BAR status_bar;
Logs.c("FEEDS_CHANNEL_BG", "clearTabPageBgImage");
if (FeedsChannelTabPage.this.m != null) {
FeedsChannelTabPage.this.m.a();
}
FeedsChannelTabPage.this.P.b(false);
if (FeatureToggle.a(qb.homepage.BuildConfig.FEATURE_TOGGLE_866341647)) {
FeedsChannelTabPage.this.P.f();
}
if (SkinManager.s().l() || SkinManager.s().g()) {
statusBarColorManager = StatusBarColorManager.getInstance();
window = FeedsChannelTabPage.this.o;
status_bar = IWebView.STATUS_BAR.NO_SHOW_LIGHT;
} else {
statusBarColorManager = StatusBarColorManager.getInstance();
window = FeedsChannelTabPage.this.o;
status_bar = IWebView.STATUS_BAR.NO_SHOW_DARK;
}
statusBarColorManager.a(window, status_bar);
}
});
return true;
}
if (!FeedsHippyEventDefine.ABILITY_SET_TAB_PAGE_STYLE.name.equalsIgnoreCase(str)) {
if (!FeedsHippyEventDefine.ABILITY_SET_SEARCHBAR_VISIBLE.name.equalsIgnoreCase(str)) {
return false;
}
QBTask.b((Callable) new Callable<Object>() {
@Override
public Object call() throws Exception {
if (FeedsChannelTabPage.this.s) {
return null;
}
FeedsChannelTabPage.this.a(hippyMap);
return null;
}
});
return false;
}
final String string3 = hippyMap.getString("type");
Logs.c("FEEDS_CHANNEL_BG", "onReactEvent: ABILITY_SET_TAB_PAGE_STYLE " + hippyMap.toString());
this.R.a(hippyMap);
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
if (FeedsChannelTabPage.this.s) {
return;
}
if ("IMG".equals(string3)) {
FeedsChannelTabPage.this.a(hippyMap.getString("url"), promise, FeedsChannelTabPage.this.getStyleConfig().f().name(), FeedsChannelTabPage.this.o);
} else if ("COLOR".equals(string3)) {
FeedsChannelTabPage.this.a(hippyMap.getInt("color"), FeedsChannelTabPage.this.getStyleConfig().f().name(), FeedsChannelTabPage.this.o);
}
FeedsChannelTabPage feedsChannelTabPage = FeedsChannelTabPage.this;
feedsChannelTabPage.a(FeedsChannelTabPage.b(feedsChannelTabPage.o));
if (FeedsChannelTabPage.this.mTabHostCallBack != null) {
FeedsChannelTabPage.this.mTabHostCallBack.f();
}
}
});
return true;
}
@Override
public void onSendEvent(String str, HashMap<String, Object> hashMap) {
a(str, b(hashMap));
}
@Override
public void onStart() {
super.onStart();
super.active();
b(true);
}
@Override
public void onStatusBarVisible(boolean z) {
super.onStatusBarVisible(z);
if (FeatureToggle.a(qb.homepage.BuildConfig.BUG_TOGGLE_92851167)) {
a(!z);
} else {
this.P.setStatusBarStatus(!z);
}
}
@Override
public void onStop() {
super.onStop();
super.deActive();
d(true);
}
@EventReceiver(createMethod = CreateMethod.NONE, eventName = "com.tencent.mtt.browser.window.data.WindowInfo.onTabSwitch")
public void onSwitchToOtherTab(EventMessage eventMessage) {
ITabPage iTabPage;
if (this.p || eventMessage == null || !(eventMessage.arg instanceof WindowInfo) || (iTabPage = ((WindowInfo) eventMessage.arg).e) == null || iTabPage.getTabType() != 120) {
return;
}
c("switchToOtherTab");
}
@Override
public void reload(int i) {
StringBuilder sb;
String str;
Logs.c("FEEDS_CHANNEL_BG", "reload 1" + this.B);
if (i == 1) {
Logs.c("FEEDS_CHANNEL_BG", "reload 11" + this.B);
if (this.u == null) {
Bundle bundle = new Bundle();
bundle.putInt("reloadType", 1);
if (this.f40419b != null) {
Logs.c("FEEDS_CHANNEL_BG", "reload 13" + this.B);
this.f40419b.a(this.t, "1", "reload", null, bundle);
return;
}
return;
}
sb = new StringBuilder();
str = "reload 12";
} else {
Logs.c("FEEDS_CHANNEL_BG", "reload 21" + this.B);
if (this.u == null) {
if (this.f40419b != null) {
Logs.c("FEEDS_CHANNEL_BG", "reload 23" + this.B);
this.f40419b.a(this.t, "1", "reload", null, null);
return;
}
return;
}
sb = new StringBuilder();
str = "reload 22";
}
sb.append(str);
sb.append(this.B);
Logs.c("FEEDS_CHANNEL_BG", sb.toString());
this.u.reload();
}
@EventReceiver(createMethod = CreateMethod.NONE, eventName = "SEND_FEEDSCHANNEL_LOG", threadMode = EventThreadMode.MAINTHREAD)
public void sendFeedsChannelLog(EventMessage eventMessage) {
FeedsChannelReactEventHub feedsChannelReactEventHub = this.f40419b;
if (feedsChannelReactEventHub != null) {
feedsChannelReactEventHub.sendDebugOpre(HippyEventHubDefineBase.TYPE_UPLOAD_LOG, this.e, "1");
}
}
@EventReceiver(createMethod = CreateMethod.NONE, eventName = INewMessageCenter.NEW_MESSAGE_RECEIVE_EVENT, threadMode = EventThreadMode.MAINTHREAD)
public void sendMessageCome(EventMessage eventMessage) {
FeedsChannelReactEventHub feedsChannelReactEventHub = this.f40419b;
if (feedsChannelReactEventHub != null) {
feedsChannelReactEventHub.j(((INewMessageCenter) QBContext.getInstance().getService(INewMessageCenter.class)).getUnreadMsgCountJson());
}
}
public void setFeedsDrawCallback(IFeedsRNContainerDrawCallback iFeedsRNContainerDrawCallback) {
this.U = iFeedsRNContainerDrawCallback;
}
public void setSnapshotAlpha(int i) {
this.S = i;
invalidate();
}
@Override
public IWebView.STATUS_BAR statusBarType() {
return IWebView.STATUS_BAR.NO_SHOW;
}
@Override
public boolean supportCustomTabBg() {
return i();
}
@Override
public void switchSkin() {
View view;
int i;
super.switchSkin();
View view2 = this.f40418a;
if (view2 != null) {
((QBHippyWindow) view2).onSkinChanged();
}
QBWebView qBWebView = this.u;
if (qBWebView != null) {
qBWebView.switchSkin();
}
h.remove(this.e);
File file = new File(FileUtils.e(), "snapshot_feeds_tab_hippy_" + this.e);
if (this.f40420c != null) {
if (!i()) {
view = this.f40420c;
i = 0;
} else if (SkinManager.s().l()) {
this.f40420c.setBackground(MttResources.i(g.C));
} else {
view = this.f40420c;
i = -14408668;
}
view.setBackgroundColor(i);
}
file.delete();
}
@Override
public void toPage(String str) {
Bundle bundle = new Bundle();
bundle.putString("toPageUrl", str);
Logs.c("FEEDS_CHANNEL_BG", "toPage " + str);
c("jumpIntoSecondPage");
FeedsChannelReactEventHub feedsChannelReactEventHub = this.f40419b;
if (feedsChannelReactEventHub != null) {
feedsChannelReactEventHub.a(this.t, "1", HippyEventHubDefineBase.TYPE_ON_TOPAGE, "homepage", bundle);
}
}
}