QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 HippyNativePage.java 源代码,内容仅作参考
package com.tencent.mtt.hippy.qb.portal;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Base64;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.FrameLayout;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.UrlUtils;
import com.tencent.matrix.memorycanary.MemoryCanaryAccess;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.nativeframework.NativePage;
import com.tencent.mtt.base.preload.facade.IQbPreloadService;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.UnitTimeDefines;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.utils.UIUtil;
import com.tencent.mtt.browser.StatusBarColorManager;
import com.tencent.mtt.browser.file.facade.IFileStatService;
import com.tencent.mtt.browser.jsextension.open.IOpenJsApis;
import com.tencent.mtt.browser.performance.facade.IAppMemoryListener;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.share.facade.IShare;
import com.tencent.mtt.browser.window.IWebView;
import com.tencent.mtt.browser.window.IWebViewClient;
import com.tencent.mtt.browser.window.PageFrame;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.browser.window.WindowChangedListener;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.browser.window.data.PageInfo;
import com.tencent.mtt.browser.window.templayer.BaseNativeGroup;
import com.tencent.mtt.browser.window.templayer.IPageBussinessProxy;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.debug.facade.IDebugService;
import com.tencent.mtt.external.circle.publishersdk.IPublisherSDKService;
import com.tencent.mtt.external.reader.image.ImageReaderController;
import com.tencent.mtt.hippy.HippyEngine;
import com.tencent.mtt.hippy.HippyInstanceContext;
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.HippyVerticalConfigManager;
import com.tencent.mtt.hippy.qb.portal.eventdefine.HippyEventHubDefineBase;
import com.tencent.mtt.hippy.qb.portal.eventdefine.HippyPageEventDefine;
import com.tencent.mtt.hippy.qb.portal.loading.HippyPageLoadingViewController;
import com.tencent.mtt.hippy.qb.portal.toolbar.PageToolBarModeController;
import com.tencent.mtt.hippy.qb.update.HippyUpdateQuery;
import com.tencent.mtt.hippy.qb.update.MTT.JsBundleModule;
import com.tencent.mtt.hippy.qb.utils.HippyMapHelper;
import com.tencent.mtt.hippy.qb.utils.WormHoleManager;
import com.tencent.mtt.hippy.qb.views.image.HippyQBGifImageViewController;
import com.tencent.mtt.hippy.qb.views.image.HippyQBWebImageView;
import com.tencent.mtt.hippy.qb.views.nowlive.HippyNowLiveRoomViewWrapper;
import com.tencent.mtt.hippy.qb.views.nowlive.HippyQBNowLiveRoomViewController;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebView;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebViewController;
import com.tencent.mtt.hippy.uimanager.HippyCustomViewCreator;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.mtt.welfare.facade.IPendantService;
import com.tencent.rmpbusiness.report.TraceEventCallback;
import com.tencent.tkd.topicsdk.adapter.qbinterface.ISendEventCallback;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONException;
import org.json.JSONObject;
import qb.a.e;
import qb.hippybusiness.BuildConfig;
public class HippyNativePage extends NativePage implements IAppMemoryListener, WindowChangedListener, IHippyWindow.HippyInstanceLoadSuccessListener, IHippyWindow.HippyLoadCustomListener, ModuleParams.CusTomDemotionCallBack, HippyEventHubBase.IEventListener, PageToolBarModeController.IListener, ISendEventCallback {
public static final String KEY_BACKGROUNDCOLOR = "backgroundColor";
public static final String KEY_COMP_NAME = "component";
public static final String KEY_FRAMEWORK = "framework";
public static final String KEY_MODULE = "module";
public static final String KEY_NAVIGATIONCOLOR = "navigationColor";
public static final String KEY_PRELOAD_WEBVIEW_URL = "preloadUrl";
public static final String KEY_TITLE = "title";
public static final String KEY_TRANSPARENT = "transparent";
public static final String KEY_WORMHOLE = "wormhole";
public static final int MSG_BACK = 6;
public static final int MSG_CALL_COMMENT = 7;
public static final int MSG_INTERCEPT_UNIT_TIME = 4;
public static final int MSG_LOAD_RN_PAGE = 5;
public static final int MSG_MEMORY_TRIGGER = 8;
public static final int MSG_RN_EVENT = 1;
public static final int MSG_SET_PAGE_TITLE = 3;
public static final int MSG_SET_TOOLBAR_MODE = 2;
public static final String TAG = "HippyNativePage";
public static final String VALUE_FRAMEWORK_VUE = "hippy-vue";
private static boolean sIdleInfoPageUsable;
private static boolean sIdleUgcPageUsable;
private static boolean sIdleVideoFloatPageUsable;
public static HashMap<String, HippyNativePage> sPreLoadPages = new HashMap<>();
public static ArrayList<HippyNameStruct> sPreloadModule = new ArrayList<>();
private HippyPageLoadingViewController loadingViewController;
private HippyAdditionView mAdditionView;
HippyEngine.BackPressHandler mBackPressHandler;
protected AtomicInteger mBackStackCounter;
String mBackgroundColor;
private StatusBarColorManager mBarColorManager;
protected HippyCustomViewCreator mBusinessCustomViewCreator;
private int mColor;
private Context mContext;
private boolean mCoverToolbar;
private String mCustomPageTitle;
private boolean mDebugUrl;
public boolean mEntered;
protected HippyPageEventHub mEventHub;
protected Map<String, String> mExtraData;
public boolean mFrontEndCallEdgeBack;
protected ArrayList<WeakReference<HippyQBWebImageView>> mGifImageArrayList;
protected int mHashCode;
HippyInstanceContext mHippyContext;
protected QBHippyWindow mHippyRootView;
private IHippyWindow.IHippyRootViewInitFinished mHippyRootViewInitFinished;
boolean mHippyTransparent;
private boolean mIsForNative;
private boolean mIsLoadHippySuccess;
private boolean mLayoutFromTop;
String mNavigationColor;
protected int mOrientation;
private ArrayList<PeddingAction> mPeddingActions;
HippyQBWebView mPreloadWebView;
protected HippyBackWebView mReactBakWebView;
private HippyVerticalConfigManager.ReactConfigInfo mReactConfigInfo;
private boolean mSetComment;
private HippyMap mShareInfo;
private int mStatusBarHeight;
private PageToolBarModeController mToolBarController;
private View mTopView;
private int mTopViewHeight;
protected Handler mUIHandler;
protected String mUrl;
protected IRNPageUrlListener mUrlListener;
public String mValueCompName;
public int mValueFramework;
public String mValueModule;
public String mValuePreloadWebviewUrl;
public String mValueTitle;
public boolean mWithWormHole;
protected UrlParams urlParams;
public static class HippyNameStruct {
public String component;
public String module;
public HippyNameStruct(String str, String str2) {
this.module = str;
this.component = str2;
}
}
public class HippyNativePageCustomViewCreatorWrapper implements HippyCustomViewCreator {
HippyNativePageCustomViewCreatorWrapper() {
}
@Override
public View createCustomView(String str, Context context, HippyMap hippyMap) {
View createCustomView;
if (HippyNativePage.this.mBusinessCustomViewCreator == null) {
HippyNativePage hippyNativePage = HippyNativePage.this;
hippyNativePage.mBusinessCustomViewCreator = hippyNativePage.getCustomViewCreater();
}
HippyQBWebImageView hippyQBWebImageView = null;
if (TextUtils.equals(str, HippyQBWebViewController.CLASS_NAME) || TextUtils.equals(str, HippyQBWebViewController.CLASS_NAME_TKD)) {
String string = (hippyMap != null && hippyMap.containsKey("source") && hippyMap.getMap("source").containsKey("uri")) ? hippyMap.getMap("source").getString("uri") : "";
if (HippyNativePage.this.mPreloadWebView != null && !TextUtils.isEmpty(string) && string.equalsIgnoreCase(HippyNativePage.this.mPreloadWebView.getUrl())) {
final HippyQBWebView hippyQBWebView = HippyNativePage.this.mPreloadWebView;
HippyNativePage hippyNativePage2 = HippyNativePage.this;
hippyNativePage2.mPreloadWebView = null;
hippyNativePage2.post(new Runnable() {
@Override
public void run() {
hippyQBWebView.setEventsPending(false);
}
});
return hippyQBWebView;
}
}
if (!TextUtils.equals(str, HippyQBGifImageViewController.CLASS_NAME) && !TextUtils.equals(str, HippyQBGifImageViewController.CLASS_NAME_TKD)) {
if (TextUtils.equals(str, HippyQBNowLiveRoomViewController.CLASS_NAME)) {
return new HippyNowLiveRoomViewWrapper(context);
}
if (HippyNativePage.this.mBusinessCustomViewCreator != null) {
return HippyNativePage.this.mBusinessCustomViewCreator.createCustomView(str, context, hippyMap);
}
return null;
}
if (HippyNativePage.this.mBusinessCustomViewCreator != null && (createCustomView = HippyNativePage.this.mBusinessCustomViewCreator.createCustomView(str, context, hippyMap)) != null) {
hippyQBWebImageView = (HippyQBWebImageView) createCustomView;
}
if (hippyQBWebImageView == null) {
hippyQBWebImageView = new HippyQBWebImageView(context);
}
HippyNativePage.this.mGifImageArrayList.add(new WeakReference<>(hippyQBWebImageView));
HippyNativePage.this.clearNullObj();
return hippyQBWebImageView;
}
}
public interface IRNPageUrlListener {
void onRNPageEventHandle(Message message);
}
public static class PeddingAction {
String mAction;
Bundle mBundle;
public PeddingAction(String str, Bundle bundle) {
this.mAction = str;
this.mBundle = bundle;
}
}
public HippyNativePage(Context context, FrameLayout.LayoutParams layoutParams) {
super(context, layoutParams, (BaseNativeGroup) null, false);
this.mValueModule = "";
this.mValueCompName = "";
this.mValueFramework = 0;
this.mWithWormHole = false;
this.mValueTitle = "";
this.mValuePreloadWebviewUrl = "";
this.mExtraData = new HashMap();
this.mUrl = "";
this.mHashCode = 0;
this.mPeddingActions = new ArrayList<>();
this.mCoverToolbar = false;
this.mOrientation = -1;
this.mCustomPageTitle = null;
this.mSetComment = false;
this.mDebugUrl = false;
this.mStatusBarHeight = 0;
this.mBarColorManager = null;
this.mColor = -2;
this.mLayoutFromTop = false;
this.mIsForNative = true;
this.mBackStackCounter = new AtomicInteger(0);
this.mIsLoadHippySuccess = false;
this.mTopViewHeight = 0;
this.mEntered = false;
this.mBackgroundColor = null;
this.mNavigationColor = null;
this.mHippyTransparent = false;
this.mPreloadWebView = null;
this.mGifImageArrayList = new ArrayList<>();
this.mBusinessCustomViewCreator = null;
this.mHippyRootViewInitFinished = null;
this.mFrontEndCallEdgeBack = true;
}
public HippyNativePage(Context context, FrameLayout.LayoutParams layoutParams, BaseNativeGroup baseNativeGroup, int i, IRNPageUrlListener iRNPageUrlListener, String str) {
this(context, layoutParams, baseNativeGroup, i, false, iRNPageUrlListener, str, null);
}
public HippyNativePage(Context context, FrameLayout.LayoutParams layoutParams, BaseNativeGroup baseNativeGroup, int i, boolean z, IRNPageUrlListener iRNPageUrlListener, String str) {
this(context, layoutParams, baseNativeGroup, i, z, iRNPageUrlListener, str, null);
}
public HippyNativePage(Context context, FrameLayout.LayoutParams layoutParams, BaseNativeGroup baseNativeGroup, int i, boolean z, IRNPageUrlListener iRNPageUrlListener, String str, IHippyWindow.IHippyRootViewInitFinished iHippyRootViewInitFinished) {
super(context, layoutParams, baseNativeGroup, i);
this.mValueModule = "";
this.mValueCompName = "";
this.mValueFramework = 0;
this.mWithWormHole = false;
this.mValueTitle = "";
this.mValuePreloadWebviewUrl = "";
this.mExtraData = new HashMap();
this.mUrl = "";
this.mHashCode = 0;
this.mPeddingActions = new ArrayList<>();
this.mCoverToolbar = false;
this.mOrientation = -1;
this.mCustomPageTitle = null;
this.mSetComment = false;
this.mDebugUrl = false;
this.mStatusBarHeight = 0;
this.mBarColorManager = null;
this.mColor = -2;
this.mLayoutFromTop = false;
this.mIsForNative = true;
this.mBackStackCounter = new AtomicInteger(0);
this.mIsLoadHippySuccess = false;
this.mTopViewHeight = 0;
this.mEntered = false;
this.mBackgroundColor = null;
this.mNavigationColor = null;
this.mHippyTransparent = false;
this.mPreloadWebView = null;
this.mGifImageArrayList = new ArrayList<>();
this.mBusinessCustomViewCreator = null;
this.mHippyRootViewInitFinished = null;
this.mFrontEndCallEdgeBack = true;
this.mHippyRootViewInitFinished = iHippyRootViewInitFinished;
this.mContext = context;
this.mHashCode = hashCode();
this.mUrlListener = iRNPageUrlListener;
this.mCoverToolbar = z;
this.mToolBarController = new PageToolBarModeController(context, this.mAddressBarDataSource);
this.mToolBarController.setListener(this);
this.mBarColorManager = StatusBarColorManager.getInstance();
this.mStatusBarHeight = BaseSettings.a().m();
preLoadUrl(str);
initBackGroundColor();
WindowManager.a().a((WindowChangedListener) this);
TraceEventCallback.a().a(str, null);
MemoryCanaryAccess.getInstance().addAppMemoryListener(this);
this.mUIHandler = new Handler(Looper.getMainLooper()) {
private void handleLoadRnPage(Message message) {
HippyMap map;
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) && (map = hippyMap.getMap(ICircleModule.CIRCLE_ARGUMENTS)) != null) {
for (String str2 : map.keySet()) {
bundle.putString(str2, map.get(str2).toString());
}
}
Logs.c("HippyNativePage", "handleLoadRnPage:" + string);
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(string).a(bundle).d(true).c(0).b(1));
}
private void handleMsgBack() {
PageFrame s;
if (HippyNativePage.this.mBackStackCounter.get() > 0) {
HippyNativePage.this.mBackStackCounter.decrementAndGet();
HippyNativePage.this.doHippyBack();
} else {
if (HippyNativePage.this.interceptGoBackEvent() || (s = WindowManager.a().s()) == null || !s.canGoBack(false)) {
return;
}
s.back(false);
}
}
private void handleSetToolbarMode(Message message) {
if (!(message.obj instanceof Object[]) || ((Object[]) message.obj).length < 2) {
return;
}
boolean z2 = true;
HippyMap hippyMap = (HippyMap) ((Object[]) message.obj)[1];
if (HippyNativePage.this.mToolBarController != null) {
String string = hippyMap.containsKey("mode") ? hippyMap.getString("mode") : "normal";
if (!"comment".equalsIgnoreCase(string)) {
if ("normal".equalsIgnoreCase(string)) {
HippyNativePage.this.mToolBarController.setNormalMode();
return;
}
return;
}
String string2 = hippyMap.getString("hint");
String string3 = hippyMap.getString("num");
String string4 = hippyMap.getString("circleId");
String string5 = hippyMap.getString("postId");
String string6 = hippyMap.getString("ch");
int i2 = hippyMap.getInt(IPendantService.BUSINESS_ID);
boolean z3 = !hippyMap.containsKey("toolBarBackBtnVisible") || hippyMap.getBoolean("toolBarBackBtnVisible");
boolean z4 = !hippyMap.containsKey("toolBarCommentBtnVisible") || hippyMap.getBoolean("toolBarCommentBtnVisible");
boolean z5 = !hippyMap.containsKey("toolBarInputBtnVisible") || hippyMap.getBoolean("toolBarInputBtnVisible");
boolean z6 = !hippyMap.containsKey("toolBarShareBtnVisible") || hippyMap.getBoolean("toolBarShareBtnVisible");
if (hippyMap.containsKey("toolBarMultiWindowBtnVisible") && !hippyMap.getBoolean("toolBarMultiWindowBtnVisible")) {
z2 = false;
}
HippyNativePage.this.mToolBarController.setCommentMode(string2, string3, string4, string5, string6, Integer.valueOf(i2), z3, z4, z5, z6, z2);
}
}
@Override
public void handleMessage(Message message) {
switch (message.what) {
case 1:
HippyNativePage.this.mUrlListener.onRNPageEventHandle(message);
return;
case 2:
handleSetToolbarMode(message);
return;
case 3:
default:
return;
case 4:
HippyNativePage.this.onInterceptUnitTime(message);
return;
case 5:
handleLoadRnPage(message);
return;
case 6:
handleMsgBack();
return;
case 7:
if (HippyNativePage.this.mAdditionView != null) {
HippyNativePage.this.removeAddtionView();
}
HippyNativePage hippyNativePage = HippyNativePage.this;
Context context2 = hippyNativePage.mContext;
HippyNativePage hippyNativePage2 = HippyNativePage.this;
hippyNativePage.mAdditionView = new HippyAdditionView(context2, hippyNativePage2, hippyNativePage2.mUrlListener, "commentpage", "commentpage", (HippyMap) message.obj);
HippyNativePage hippyNativePage3 = HippyNativePage.this;
hippyNativePage3.addView(hippyNativePage3.mAdditionView, new FrameLayout.LayoutParams(-1, -1));
return;
case 8:
StringBuilder sb = new StringBuilder();
sb.append("sendMemoryTriggerEvent:");
sb.append(message.arg1);
sb.append(", (mHippyRootView != null):");
sb.append(HippyNativePage.this.mHippyRootView != null);
Logs.c("HippyNativePage", sb.toString());
if (HippyNativePage.this.mHippyRootView == null || HippyNativePage.this.mEventHub == null) {
return;
}
Bundle bundle = new Bundle(9);
bundle.putInt("flag", message.arg1);
HippyNativePage.this.mEventHub.sendEventToHippy(HippyEventHubDefineBase.EVENT_PERFORMANCE, HippyNativePage.this.mHippyRootView.getId(), "", HippyEventHubDefineBase.TYPE_ON_MEMORYTRIM, null, HippyNativePage.this.mValueModule, String.valueOf(HippyNativePage.this.mHashCode), bundle);
return;
}
}
};
initPreloadWebview();
if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_868967067) && canShowLoadingView(str) && this.loadingViewController == null) {
showLoadingView();
}
}
private void addPreloadData() {
Map<String, String> preloadCacheMap = ((IQbPreloadService) QBContext.getInstance().getService(IQbPreloadService.class)).getPreloadCacheMap(this.mUrl);
if (preloadCacheMap != null) {
this.mExtraData.putAll(preloadCacheMap);
}
}
private void analysisStatusBarColor() {
int d2;
boolean l = SkinManager.s().l();
int i = R.color.theme_home_color_bkg;
if (l) {
d2 = MttResources.c(R.color.theme_home_color_bkg);
} else {
int statusBarBgColor = getStatusBarBgColor();
HippyVerticalConfigManager.ReactConfigInfo reactConfigInfo = this.mReactConfigInfo;
if (reactConfigInfo == null || reactConfigInfo.color == -2) {
if (this.mValueModule.equals("infoportal")) {
i = R.color.info_read_portal_top_bar_bg;
} else if (this.mValueModule.equals("sports")) {
i = R.color.a2u;
} else if (this.mValueModule.equals("nearby")) {
i = e.J;
} else if (statusBarBgColor != -2) {
this.mColor = statusBarBgColor;
i = -1;
}
if (i == -1) {
return;
} else {
d2 = MttResources.d(i);
}
} else {
d2 = this.mReactConfigInfo.color;
}
}
this.mColor = d2;
}
private boolean canShowLoadingView(String str) {
HashMap<String, String> urlParam = UrlUtils.getUrlParam(str);
return urlParam != null && TextUtils.equals("1", urlParam.get("loadingAnimation"));
}
public void clearNullObj() {
ArrayList<WeakReference<HippyQBWebImageView>> arrayList = this.mGifImageArrayList;
if (arrayList == null) {
return;
}
Iterator<WeakReference<HippyQBWebImageView>> it = arrayList.iterator();
while (it.hasNext()) {
WeakReference<HippyQBWebImageView> next = it.next();
if (next == null || next.get() == null) {
it.remove();
}
}
}
private static Bitmap decodeBase64BitMap(String str) {
int indexOf;
if (str.startsWith("data:") && (indexOf = str.indexOf(";base64,")) >= 0) {
try {
byte[] decode = Base64.decode(str.substring(indexOf + 8), 0);
return BitmapFactory.decodeByteArray(decode, 0, decode.length);
} catch (Exception unused) {
}
}
return null;
}
public void doHippyBack() {
sendEvent(HippyEventHubDefineBase.EVENT_DO_BACK, new Bundle(9));
}
private void fillShareInfo(PageInfo pageInfo) {
HippyMap hippyMap = this.mShareInfo;
if (hippyMap != null) {
String string = HippyMapHelper.getString(hippyMap, "url", "");
String string2 = HippyMapHelper.getString(this.mShareInfo, "title", "");
String string3 = HippyMapHelper.getString(this.mShareInfo, "imgUrl", "");
String string4 = HippyMapHelper.getString(this.mShareInfo, "description", "");
int i = HippyMapHelper.getInt(this.mShareInfo, IShare.SHARE_ID, -1);
int i2 = HippyMapHelper.getInt(this.mShareInfo, IPendantService.CONTENT_TYPE, -1);
String string5 = HippyMapHelper.getString(this.mShareInfo, "weappPath", "");
String string6 = HippyMapHelper.getString(this.mShareInfo, "weappOriginId", "");
boolean z = HippyMapHelper.getBoolean(this.mShareInfo, "toWeApp", false);
int i3 = HippyMapHelper.getInt(this.mShareInfo, "fromwhere", 0);
String string7 = HippyMapHelper.getString(this.mShareInfo, "imgData", "");
pageInfo.b(string);
pageInfo.a(string2);
pageInfo.e(i3);
if (!TextUtils.isEmpty(string3)) {
pageInfo.f(string3);
}
if (!TextUtils.isEmpty(string7)) {
pageInfo.a(decodeBase64BitMap(string7));
}
if (!TextUtils.isEmpty(string4)) {
pageInfo.d(string4);
}
if (i != -1) {
pageInfo.f(i);
}
if (i2 != -1) {
pageInfo.g(i2);
}
if (!z || TextUtils.isEmpty(string6) || TextUtils.isEmpty(string5)) {
return;
}
pageInfo.f46379c = z;
pageInfo.f46377a = string6;
pageInfo.f46378b = string5;
}
}
public static boolean getIdleInfoPageUsable() {
return sIdleInfoPageUsable;
}
public static boolean getIdleUgcPageUsable() {
return sIdleUgcPageUsable;
}
public static boolean getIdleVideoFloatPageUsable() {
return sIdleVideoFloatPageUsable;
}
public static HippyNativePage getPage(String str) {
Logs.c("HippyNativePage", "getPage:" + str);
return sPreLoadPages.get(str);
}
private void handleCallComment(HippyMap hippyMap, Promise promise) {
Message obtainMessage = this.mUIHandler.obtainMessage(7);
obtainMessage.obj = hippyMap;
obtainMessage.sendToTarget();
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("success", true);
promise.resolve(jSONObject);
} catch (JSONException unused) {
}
}
private void handleGetJSBundleVersion(HippyMap hippyMap, final Promise promise) {
HippyArray array = hippyMap.getArray("moduleList");
final HippyMap hippyMap2 = new HippyMap();
ArrayList<String> arrayList = new ArrayList<>();
if (array == null || array.size() <= 0) {
return;
}
for (int i = 0; i < array.size(); i++) {
String string = array.getString(i);
String moduleVersionName = QBHippyEngineManager.getInstance().getModuleVersionName(string);
if (TextUtils.isEmpty(moduleVersionName)) {
arrayList.add(string);
} else {
hippyMap2.pushString(string, moduleVersionName);
}
}
if (arrayList.size() > 0) {
new HippyUpdateQuery().query(arrayList, new HippyUpdateQuery.QueryCallback() {
@Override
public void onFinish(ArrayList<JsBundleModule> arrayList2, int i2) {
if (arrayList2 != null && arrayList2.size() > 0) {
Iterator<JsBundleModule> it = arrayList2.iterator();
while (it.hasNext()) {
JsBundleModule next = it.next();
hippyMap2.pushString(next.sModuleName, next.sVersionName);
}
}
promise.resolve(hippyMap2);
}
});
} else {
promise.resolve(hippyMap2);
}
}
private void handleHippyRootParams(boolean z) {
if (this.mHippyRootView == null) {
return;
}
if (!this.mLayoutFromTop || (DeviceUtils.aq() && !DeviceUtils.a())) {
ViewGroup.LayoutParams layoutParams = this.mHippyRootView.getLayoutParams();
if (layoutParams == null) {
layoutParams = new FrameLayout.LayoutParams(-1, -1);
}
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) layoutParams;
layoutParams2.topMargin = 0;
if (this.mTopView != null && !DeviceUtils.aq()) {
layoutParams2.topMargin += this.mTopViewHeight;
}
this.mHippyRootView.setLayoutParams(layoutParams2);
return;
}
ViewGroup.LayoutParams layoutParams3 = this.mHippyRootView.getLayoutParams();
if (layoutParams3 == null) {
layoutParams3 = new FrameLayout.LayoutParams(-1, -1);
}
FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) layoutParams3;
int i = ((z && getResources().getConfiguration().orientation != 2) || DeviceUtils.a()) ? -this.mStatusBarHeight : 0;
if (this.mTopView != null) {
i += this.mTopViewHeight;
}
layoutParams4.topMargin = i;
this.mHippyRootView.setLayoutParams(layoutParams4);
}
private void handlePreloadWebView(final HippyMap hippyMap) {
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
if (HippyNativePage.this.mPreloadWebView == null) {
String string = hippyMap.getString("uri");
if (TextUtils.isEmpty(string) || HippyNativePage.this.mHippyRootView == null || HippyNativePage.this.mHippyRootView.getHippyRootView() == null) {
return;
}
if (HippyNativePage.this.mBusinessCustomViewCreator == null) {
HippyNativePage hippyNativePage = HippyNativePage.this;
hippyNativePage.mBusinessCustomViewCreator = hippyNativePage.getCustomViewCreater();
}
if (HippyNativePage.this.mBusinessCustomViewCreator != null) {
HippyNativePage hippyNativePage2 = HippyNativePage.this;
hippyNativePage2.mPreloadWebView = (HippyQBWebView) hippyNativePage2.mBusinessCustomViewCreator.createCustomView(HippyQBWebViewController.CLASS_NAME, HippyNativePage.this.mHippyRootView.getHippyRootView().getContext(), hippyMap);
}
if (HippyNativePage.this.mPreloadWebView == null) {
HippyNativePage hippyNativePage3 = HippyNativePage.this;
hippyNativePage3.mPreloadWebView = new HippyQBWebView(hippyNativePage3.mHippyRootView.getHippyRootView().getContext());
}
HippyNativePage.this.mPreloadWebView.setEventsPending(true);
HippyNativePage.this.mPreloadWebView.loadUrl(string);
}
}
});
}
private void handleSetShareInfo(HippyMap hippyMap) {
this.mShareInfo = hippyMap;
}
private void handleTraceEvent(HippyMap hippyMap) {
String string = hippyMap.getString("business");
String string2 = hippyMap.getString(IFileStatService.EVENT_REPORT_NAME);
String string3 = hippyMap.getString("loadUrl");
if (TextUtils.isEmpty(string) || TextUtils.isEmpty(string2) || TextUtils.isEmpty(string3)) {
return;
}
HippyMap map = hippyMap.getMap("eventValue");
String string4 = map == null ? "" : map.getString("preload");
String string5 = map != null ? map.getString("extra") : "";
Bundle bundle = new Bundle();
bundle.putString("business", string);
bundle.putString("preload", string4);
bundle.putString("extra", string5);
TraceEventCallback.a().onHippyCustomTraceEvent(string3, string2, bundle);
}
private void handleUsedTime(HippyMap hippyMap) {
if ("start".equals(hippyMap.getString("type"))) {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("scene", hippyMap.getString("scene"));
String string = hippyMap.getString("kv");
if (!TextUtils.isEmpty(string)) {
hashMap.put("kv", string);
}
hashMap.put("ch", hippyMap.getString("ch") + "__" + hippyMap.getString("tabid"));
interceptUnitTime(hippyMap.getString(ImageReaderController.REPORT_UNIT), -1, hashMap);
}
}
private static HippyArray hashListToHippyList(List list) {
HippyArray hippyArray = new HippyArray();
for (Object obj : list) {
if (obj instanceof HashMap) {
hippyArray.pushMap(hashMapToHippyMap((HashMap) obj));
} else {
if (obj instanceof List) {
obj = hashListToHippyList((List) obj);
}
hippyArray.pushObject(obj);
}
}
return hippyArray;
}
private static HippyMap hashMapToHippyMap(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, hashMapToHippyMap((HashMap) obj));
} else if (obj instanceof List) {
hippyMap.pushArray(str, hashListToHippyList((List) obj));
} else {
hippyMap.pushObject(str, obj);
}
}
return hippyMap;
}
private void initBackGroundColor() {
String str = this.mBackgroundColor;
if (str == null) {
setBackgroundNormalIds(0, R.color.theme_home_color_bkg);
} else {
try {
setBackgroundColor(Color.parseColor(str));
} catch (Throwable unused) {
}
}
}
private void initLoadingView() {
}
private void initPreloadWebview() {
String str;
Logs.c("HippyNativePage", "initPreloadWebview.");
if (this.mPreloadWebView != null) {
str = "initPreloadWebview. PreloadWebview is existed.";
} else if (TextUtils.isEmpty(this.mValuePreloadWebviewUrl)) {
str = "initPreloadWebview. No PreloadWebviewUrl.";
} else {
this.mHippyContext = new HippyInstanceContext(getActivity());
if (this.mBusinessCustomViewCreator == null) {
this.mBusinessCustomViewCreator = getCustomViewCreater();
}
HippyCustomViewCreator hippyCustomViewCreator = this.mBusinessCustomViewCreator;
if (hippyCustomViewCreator != null) {
this.mPreloadWebView = (HippyQBWebView) hippyCustomViewCreator.createCustomView(HippyQBWebViewController.CLASS_NAME, this.mHippyContext, null);
}
if (this.mPreloadWebView == null) {
this.mPreloadWebView = new HippyQBWebView(this.mHippyContext);
}
this.mPreloadWebView.setEventsPending(true);
this.mPreloadWebView.loadUrl(this.mValuePreloadWebviewUrl);
str = "initPreloadWebview. Done.";
}
Logs.c("HippyNativePage", str);
}
public static void putPage(String str, HippyNativePage hippyNativePage) {
Logs.c("HippyNativePage", "putPage:" + str + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + Integer.toHexString(System.identityHashCode(hippyNativePage)));
sPreLoadPages.put(str, hippyNativePage);
}
public static void removePage(String str) {
Logs.c("HippyNativePage", "removePage:" + str);
sPreLoadPages.remove(str);
}
public void sendLifecycleEvent(String str, Bundle bundle) {
HippyPageEventHub hippyPageEventHub;
StringBuilder sb = new StringBuilder();
sb.append("sendLifecycleEvent:");
sb.append(str);
sb.append(", (mHippyRootView != null):");
sb.append(this.mHippyRootView != null);
Logs.c("HippyNativePage", sb.toString());
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow == null || (hippyPageEventHub = this.mEventHub) == null) {
return;
}
hippyPageEventHub.sendEventToHippy(HippyEventHubDefineBase.EVENT_LIFE_CYCLE, qBHippyWindow.getId(), "", str, null, this.mValueModule, String.valueOf(this.mHashCode), bundle);
}
private void sendPeddingEvent() {
if (this.mPeddingActions.size() > 0) {
this.mUIHandler.post(new Runnable() {
@Override
public void run() {
Iterator it = HippyNativePage.this.mPeddingActions.iterator();
while (it.hasNext()) {
PeddingAction peddingAction = (PeddingAction) it.next();
HippyNativePage.this.sendLifecycleEvent(peddingAction.mAction, peddingAction.mBundle);
}
HippyNativePage.this.mPeddingActions.clear();
}
});
}
}
public static void setIdleInfoPageUsable(boolean z) {
sIdleInfoPageUsable = z;
}
public static void setIdleUgcPageUsable(boolean z) {
sIdleUgcPageUsable = z;
}
public static void setIdleVideoFloatPageUsable(boolean z) {
sIdleVideoFloatPageUsable = z;
}
private void startCreateReactView() {
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null) {
qBHippyWindow.setPageDataUrl(this.mUrl);
callPageOpenStep(PlatformStatUtils.PageOpenStep.BUSINESS_UITREECOMPLETED);
} else {
if (getActivity() == null) {
return;
}
createReactView();
}
}
private void switchBakWebView() {
if (this.mReactBakWebView != null) {
return;
}
HippyVerticalConfigManager.ReactConfigInfo reactConfigInfo = this.mReactConfigInfo;
this.mReactBakWebView = new HippyBackWebView(getContext(), reactConfigInfo != null ? reactConfigInfo.backUrl : "");
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
layoutParams.topMargin = this.mStatusBarHeight + this.mTopViewHeight;
addView(this.mReactBakWebView, layoutParams);
}
@Override
public void actionHome(byte b2) {
super.actionHome(b2);
Bundle bundle = new Bundle();
bundle.putString("cancelFrom", "HOME");
TraceEventCallback.a().c(this.mUrl, bundle);
}
@Override
public void active() {
((IDebugService) QBContext.getInstance().getService(IDebugService.class)).stopFrameRateMonitor(this.mHashCode + "_FromeFeedsToDetailPage:" + this.mValueModule);
super.active();
Logs.c("HippyNativePage", "active");
if (this.mIsLoadHippySuccess) {
sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_ACTIVE, new Bundle());
} else {
this.mPeddingActions.add(new PeddingAction(HippyEventHubDefineBase.TYPE_ON_ACTIVE, new Bundle()));
}
HippyBackWebView hippyBackWebView = this.mReactBakWebView;
if (hippyBackWebView != null) {
hippyBackWebView.active();
}
HippyAdditionView hippyAdditionView = this.mAdditionView;
if (hippyAdditionView != null) {
hippyAdditionView.active();
}
if (this.mSetComment) {
this.mToolBarController.setCommentMode();
}
activeGIfView();
((IPublisherSDKService) QBContext.getInstance().getService(IPublisherSDKService.class)).addSendEventCallback(this);
}
protected void activeGIfView() {
if (this.mGifImageArrayList.size() > 0) {
Iterator<WeakReference<HippyQBWebImageView>> it = this.mGifImageArrayList.iterator();
while (it.hasNext()) {
WeakReference<HippyQBWebImageView> next = it.next();
if (next != null && (next.get() instanceof HippyQBWebImageView)) {
next.get().active();
}
}
}
}
public void addExtraData(Map<String, String> map) {
this.mExtraData.putAll(map);
}
public void addTopView(View view, int i) {
this.mTopView = view;
this.mTopViewHeight = i;
addView(this.mTopView, new FrameLayout.LayoutParams(-1, i));
}
@Override
public void back(boolean z) {
Bundle bundle = new Bundle();
bundle.putString("cancelFrom", "BACK");
TraceEventCallback.a().c(this.mUrl, bundle);
super.back(z);
}
public void callPageOpenStep(PlatformStatUtils.PageOpenStep pageOpenStep) {
UrlParams urlParams = this.urlParams;
if (urlParams == null || TextUtils.isEmpty(urlParams.a())) {
return;
}
PlatformStatUtils.PageOpenStruct pageOpenStruct = new PlatformStatUtils.PageOpenStruct();
pageOpenStruct.a(this.urlParams.a());
pageOpenStruct.b(pageOpenStep.name());
pageOpenStruct.c(this.urlParams.f46351a);
pageOpenStruct.d(UnitTimeDefines.a(this.urlParams.f46351a));
pageOpenStruct.a(System.currentTimeMillis());
PlatformStatUtils.a(pageOpenStruct);
}
@Override
public boolean can(int i) {
switch (i) {
case 1:
case 2:
case 3:
case 4:
case 7:
case 9:
case 11:
case 12:
return true;
case 5:
HippyVerticalConfigManager.ReactConfigInfo reactConfigInfo = this.mReactConfigInfo;
if (reactConfigInfo != null) {
return reactConfigInfo.noImage;
}
return true;
case 6:
case 8:
case 10:
default:
return false;
}
}
public void changeStatusBar(boolean z, boolean z2) {
ViewGroup.LayoutParams layoutParams;
int i;
HippyVerticalConfigManager.ReactConfigInfo reactConfigInfo = this.mReactConfigInfo;
this.mLayoutFromTop = reactConfigInfo == null ? false : reactConfigInfo.layoutFromTop;
Window window = getActivity().getWindow();
boolean ai = DeviceUtils.ai();
handleHippyRootParams(z);
if (DeviceUtils.aq()) {
analysisStatusBarColor();
if (this.mHippyRootView != null) {
if (this.mLayoutFromTop || ai || !z || !this.mIsForNative || DeviceUtils.a()) {
QBHippyWindow qBHippyWindow = this.mHippyRootView;
qBHippyWindow.setPadding(qBHippyWindow.getPaddingLeft(), this.mTopViewHeight, this.mHippyRootView.getPaddingRight(), this.mHippyRootView.getPaddingBottom());
View view = this.mTopView;
if (view != null) {
view.setPadding(0, 0, 0, 0);
layoutParams = this.mTopView.getLayoutParams();
i = this.mTopViewHeight;
layoutParams.height = i;
this.mTopView.setLayoutParams(layoutParams);
}
this.mHippyRootView.setStatusBarColor(this.mColor);
} else {
QBHippyWindow qBHippyWindow2 = this.mHippyRootView;
qBHippyWindow2.setPadding(qBHippyWindow2.getPaddingLeft(), this.mStatusBarHeight + this.mTopViewHeight, this.mHippyRootView.getPaddingRight(), this.mHippyRootView.getPaddingBottom());
View view2 = this.mTopView;
if (view2 != null) {
view2.setPadding(0, this.mStatusBarHeight, 0, 0);
layoutParams = this.mTopView.getLayoutParams();
i = this.mTopViewHeight + this.mStatusBarHeight;
layoutParams.height = i;
this.mTopView.setLayoutParams(layoutParams);
}
this.mHippyRootView.setStatusBarColor(this.mColor);
}
}
if (z2 && this.mIsForNative && isPageVisible()) {
this.mBarColorManager.a(window, statusBarType());
}
}
}
@Override
public boolean coverToolbar() {
return this.mCoverToolbar;
}
public void createReactView() {
Logs.c("HippyNativePage", "end CreateReactView:" + this.mValueModule + ", " + this.mValueCompName);
callPageOpenStep(PlatformStatUtils.PageOpenStep.BUSINESS_LOAD);
this.mExtraData.put("weakTipSwitcher", FeatureToggle.a(qb.framework.BuildConfig.FEATURE_TOGGLE_868075379) ? "1" : "0");
this.mEventHub = getEventHub();
addPreloadData();
Bundle build = new HippyInitBundleBuilder(this.mEventHub).setUrl(this.mUrl).setExtraData(this.mExtraData).setOrientation(this.mOrientation).setPrimaryKey(String.valueOf(this.mHashCode)).build();
ModuleParams.Builder builder = new ModuleParams.Builder();
String demotionUrl = getDemotionUrl();
if (TextUtils.isEmpty(demotionUrl)) {
builder.setCusTomDemotionCallBack(this);
} else {
builder.setDemotionUrl(demotionUrl);
}
UrlParams urlParams = this.urlParams;
if (urlParams != null) {
builder.setTraceId(urlParams.a());
}
Activity activity = getActivity();
if (WormHoleManager.needOpenWormhole(this.mValueCompName)) {
this.mWithWormHole = true;
} else {
this.mWithWormHole = false;
}
processBuilder(builder);
onProcessProps(build);
ModuleParams build2 = builder.setFrameworkType(this.mValueFramework).setNeedWormHole(this.mWithWormHole).setModuleName(this.mValueModule).setComponentName(this.mValueCompName).setProps(build).setActivity(activity).setCustomViewCreator(new HippyNativePageCustomViewCreatorWrapper()).setHippyLoadCustomListener(this).setDebug(this.mDebugUrl).setInstanceLoadSuccessListener(this).build();
HippyInstanceContext hippyInstanceContext = this.mHippyContext;
if (hippyInstanceContext != null) {
build2.mHippyInstanceContext = hippyInstanceContext;
}
this.mHippyRootView = (QBHippyWindow) QBHippyEngineManager.getInstance().loadModule(build2, getHippyRootViewInitFinished());
if (this.mHippyRootView != null) {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
if (this.mTopView == null) {
addView(this.mHippyRootView, layoutParams);
} else {
layoutParams.topMargin = this.mTopViewHeight;
addView(this.mHippyRootView, layoutParams);
this.mTopView.bringToFront();
}
HippyPageLoadingViewController hippyPageLoadingViewController = this.loadingViewController;
if (hippyPageLoadingViewController != null) {
hippyPageLoadingViewController.bringLoadingToFront();
}
Logs.c("HippyNativePage", "createReactView succ");
registerMethod();
changeStatusBar(!DeviceUtils.b(activity.getWindow()), true);
if (this.mHippyTransparent) {
setBackgroundColor(0);
}
} else {
Logs.c("HippyNativePage", "mRnRootView loadModule Failed");
switchBakWebView();
changeStatusBar(!DeviceUtils.b(activity.getWindow()), true);
}
sendPeddingEvent();
}
@Override
public void deactive() {
super.deactive();
Logs.c("HippyNativePage", "deactive");
Bundle bundle = new Bundle();
bundle.putString("cancelFrom", "BACK");
TraceEventCallback.a().c(this.mUrl, bundle);
if (this.mIsLoadHippySuccess) {
sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_DEACTIVE, new Bundle());
} else {
this.mPeddingActions.add(new PeddingAction(HippyEventHubDefineBase.TYPE_ON_DEACTIVE, new Bundle()));
}
HippyBackWebView hippyBackWebView = this.mReactBakWebView;
if (hippyBackWebView != null) {
hippyBackWebView.deactive();
}
HippyAdditionView hippyAdditionView = this.mAdditionView;
if (hippyAdditionView != null) {
hippyAdditionView.deactive();
}
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null && qBHippyWindow.getHippyRootView() != null) {
WormHoleManager.sendRootDeleteMessageToClient(this.mHippyRootView);
}
activeGIfView();
}
protected void deactiveGIfView() {
if (this.mGifImageArrayList.size() > 0) {
Iterator<WeakReference<HippyQBWebImageView>> it = this.mGifImageArrayList.iterator();
while (it.hasNext()) {
WeakReference<HippyQBWebImageView> next = it.next();
if (next != null && (next.get() instanceof HippyQBWebImageView)) {
next.get().deactive();
}
}
}
}
@Override
public void destroy() {
super.destroy();
Logs.c("HippyNativePage", "destroy");
sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_DESTROY, new Bundle());
HippyPageEventHub hippyPageEventHub = this.mEventHub;
if (hippyPageEventHub != null) {
hippyPageEventHub.deRegistNativeMethod(this.mValueModule);
this.mEventHub.unregisterListener(this);
this.mEventHub.setQBHippyWindow((QBHippyWindow) null);
this.mEventHub = null;
}
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null) {
qBHippyWindow.destroy();
this.mHippyRootView = null;
}
PageToolBarModeController pageToolBarModeController = this.mToolBarController;
if (pageToolBarModeController != null) {
pageToolBarModeController.setListener(null);
}
WindowManager.a().b(this);
HippyAdditionView hippyAdditionView = this.mAdditionView;
if (hippyAdditionView != null) {
hippyAdditionView.destroy();
}
((IPublisherSDKService) QBContext.getInstance().getService(IPublisherSDKService.class)).removeSendEventCallback(this);
MemoryCanaryAccess.getInstance().removeAppMemoryListener(this);
}
@Override
public boolean edgeBackforward() {
return this.mFrontEndCallEdgeBack;
}
public Activity getActivity() {
Context context = this.mContext;
return context instanceof Activity ? (Activity) context : ActivityHandler.b().a();
}
public View getCusTomDemotionView() {
HippyBackWebView hippyBackWebView = this.mReactBakWebView;
if (hippyBackWebView != null) {
return hippyBackWebView;
}
HippyVerticalConfigManager.ReactConfigInfo reactConfigInfo = this.mReactConfigInfo;
String str = reactConfigInfo != null ? reactConfigInfo.backUrl : "https://qbrnweb.html5.qq.com/favnew";
Logs.c("HippyNativePage", "getCusTomDemotionView:" + str);
this.mReactBakWebView = new HippyBackWebView(getContext(), str);
return this.mReactBakWebView;
}
public HippyCustomViewCreator getCustomViewCreater() {
return null;
}
public String getDemotionUrl() {
return null;
}
protected HippyPageEventHub getEventHub() {
return new HippyPageEventHub();
}
protected int getHippyPageStatFromWhere(boolean z) {
IWebViewClient webViewClient;
IPageBussinessProxy bussinessProxy;
BaseNativeGroup nativeGroup = getNativeGroup();
if (nativeGroup == null || (webViewClient = nativeGroup.getWebViewClient()) == null || (bussinessProxy = webViewClient.getBussinessProxy()) == null) {
return -1;
}
return bussinessProxy.f(z);
}
protected IHippyWindow.IHippyRootViewInitFinished getHippyRootViewInitFinished() {
return this.mHippyRootViewInitFinished;
}
public HippyPageLoadingViewController getLoadingViewController() {
return this.loadingViewController;
}
@Override
public int getNavigationBarColor() {
String str = this.mNavigationColor;
if (str != null) {
try {
return Color.parseColor(str);
} catch (IllegalArgumentException unused) {
}
}
return super.getNavigationBarColor();
}
@Override
public String getPageTitle() {
if (!TextUtils.isEmpty(this.mCustomPageTitle)) {
return this.mCustomPageTitle;
}
HippyVerticalConfigManager.ReactConfigInfo reactConfigInfo = this.mReactConfigInfo;
return reactConfigInfo == null ? !TextUtils.isEmpty(this.mValueTitle) ? this.mValueTitle : super.getPageTitle() : reactConfigInfo.title;
}
public HippyVerticalConfigManager.ReactConfigInfo getRNVerticalConfigInfo(String str) {
return HippyVerticalConfigManager.getInstance().getConfigInfo(this.mValueModule);
}
public HashMap<String, Object> getReactConfig() {
return new HashMap<>();
}
@Override
public String getRestoreUrl() {
return this.mUrl;
}
@Override
public PageInfo getShareBundle() {
PageInfo pageInfo = new PageInfo();
pageInfo.a(getPageTitle()).b(getUrl());
pageInfo.a(0);
fillShareInfo(pageInfo);
return pageInfo;
}
@Override
public int getStatusBarBgColor() {
return super.getStatusBarBgColor();
}
@Override
public String getUrl() {
return this.mUrl;
}
protected String getWriteToHistoryUrl() {
return this.mUrl;
}
public void hideLoadingView() {
HippyPageLoadingViewController hippyPageLoadingViewController = this.loadingViewController;
if (hippyPageLoadingViewController != null) {
hippyPageLoadingViewController.hideLoadingView();
}
}
protected boolean interceptGoBackEvent() {
return false;
}
@Override
public boolean isForcePortalScreen() {
return this.mOrientation == 1;
}
public void loadSuccess() {
this.mIsLoadHippySuccess = true;
if (!TextUtils.isEmpty(this.mValueModule) && !TextUtils.isEmpty(this.mValueCompName)) {
this.mReactConfigInfo = getRNVerticalConfigInfo(this.mValueModule);
Activity a2 = ActivityHandler.b().a();
if (a2 != null) {
changeStatusBar(true ^ DeviceUtils.b(a2.getWindow()), isActive());
}
}
sendPeddingEvent();
}
@Override
public void loadUrl(String str) {
loadUrl(str, true);
}
public void loadUrl(String str, boolean z) {
super.loadUrl(str);
preLoadUrl(str);
if (TextUtils.isEmpty(this.mValueModule) || TextUtils.isEmpty(this.mValueCompName)) {
return;
}
startCreateReactView();
}
protected boolean needAddToHistory() {
return true;
}
@Override
public boolean onBackPressed() {
HippyAdditionView hippyAdditionView = this.mAdditionView;
if (hippyAdditionView != null) {
if (!hippyAdditionView.onBackPressed()) {
removeAddtionView();
}
return true;
}
if (this.mBackStackCounter.get() <= 0) {
return super.onBackPressed();
}
this.mBackStackCounter.decrementAndGet();
doHippyBack();
return true;
}
@Override
public void onComment(int i, String str, String str2, String str3, String str4) {
if (this.mHippyRootView == null || this.mEventHub == null) {
return;
}
Bundle bundle = new Bundle(9);
bundle.putInt("result", i);
bundle.putString("commentText", str2);
this.mEventHub.sendEventToHippy(HippyPageEventDefine.EVENT_COMMENT, this.mHippyRootView.getId(), "", HippyPageEventDefine.TYPE_ON_COMMENT, null, this.mValueModule, String.valueOf(this.mHashCode), bundle);
}
@Override
public void onCommentBtnClick() {
if (this.mHippyRootView == null || this.mEventHub == null) {
return;
}
this.mEventHub.sendEventToHippy(HippyPageEventDefine.EVENT_COMMENT, this.mHippyRootView.getId(), "", HippyPageEventDefine.TYPE_ON_COMMENT_BTN_CLICK, null, this.mValueModule, String.valueOf(this.mHashCode), new Bundle(9));
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
if (isActive()) {
if (configuration.orientation == 2) {
changeStatusBar(false, false);
} else {
changeStatusBar(!((ActivityHandler.b().a().getWindow().getAttributes().flags & 1024) == 1024), false);
}
}
}
public void onCurrentPageFrameChanged(PageFrame pageFrame) {
sendWndNum(WindowManager.a().w());
}
@Override
public void onEnterIntoMultiwindow() {
deactive();
}
@Override
public void onHippyDownloadBegin() {
Logs.c("HippyNativePage", "onHippyDownloadBegin: " + this.mValueModule);
TraceEventCallback.a().e(this.mUrl, null);
}
@Override
public void onHippyDownloadEnd(boolean z, int i, String str) {
Logs.c("HippyNativePage", "onHippyDownloadEnd: " + this.mValueModule + ", ok:" + z + ", code:" + i + ", msg:" + str);
TraceEventCallback.a().b(this.mUrl, z, i, str, null);
}
@Override
public void onHippyLoadBegin() {
Logs.c("HippyNativePage", "onHippyLoadBegin: " + this.mValueModule);
TraceEventCallback.a().d(this.mUrl, null);
}
@Override
public void onHippyLoadEnd(boolean z, int i, String str) {
callPageOpenStep(PlatformStatUtils.PageOpenStep.BUSINESS_UITREECOMPLETED);
Logs.c("HippyNativePage", "onHippyLoadEnd: " + this.mValueModule + ", ok:" + z + ", code:" + i + ", msg:" + str);
TraceEventCallback.a().a(this.mUrl, z, i, str, null);
}
@Override
public void onImageLoadConfigChanged() {
super.onImageLoadConfigChanged();
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null) {
qBHippyWindow.onNoPicModeChanged();
}
HippyBackWebView hippyBackWebView = this.mReactBakWebView;
if (hippyBackWebView != null) {
hippyBackWebView.onImageLoadConfigChanged();
}
}
protected void onInterceptUnitTime(Message message) {
Set<String> keySet;
String str;
StringBuilder sb;
HippyMap hippyMap = (HippyMap) ((Object[]) message.obj)[1];
String string = hippyMap.getString(ImageReaderController.REPORT_UNIT);
HippyMap map = hippyMap.getMap("extras");
if (TextUtils.isEmpty(string)) {
return;
}
HashMap<String, String> hashMap = new HashMap<>();
if (map != null && (keySet = map.keySet()) != null) {
for (String str2 : keySet) {
Object obj = map.get(str2);
if (obj == null) {
hashMap.put(str2, "");
} else {
if (obj instanceof String) {
str = (String) obj;
} else {
if (obj instanceof Number) {
sb = new StringBuilder();
sb.append("");
sb.append(obj);
} else if (obj instanceof Boolean) {
sb = new StringBuilder();
sb.append(((Boolean) obj).booleanValue());
sb.append("");
}
str = sb.toString();
}
hashMap.put(str2, str);
}
}
}
interceptUnitTime(string, -1, hashMap);
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
return super.onKeyDown(i, keyEvent);
}
@Override
public boolean onKeyUp(int i, KeyEvent keyEvent) {
if (i != 4) {
return super.onKeyUp(i, keyEvent);
}
boolean z = false;
HippyAdditionView hippyAdditionView = this.mAdditionView;
if (hippyAdditionView != null) {
z = hippyAdditionView.onBackPressed();
} else if (this.mHippyRootView != null) {
if (this.mBackPressHandler == null) {
this.mBackPressHandler = new HippyEngine.BackPressHandler() {
@Override
public void handleBackPress() {
PageFrame s = WindowManager.a().s();
if (s != null) {
s.back(false);
}
}
};
}
z = this.mHippyRootView.onBackPressed(this.mBackPressHandler);
}
if (z) {
return true;
}
return super.onKeyUp(i, keyEvent);
}
@Override
public void onLeaveFromMultiwindow() {
active();
}
@Override
public void onMemoryTrigger(int i) {
Handler handler = this.mUIHandler;
if (handler != null) {
Message obtainMessage = handler.obtainMessage(8);
obtainMessage.arg1 = i;
obtainMessage.sendToTarget();
}
}
public void onPageFrameAdded(PageFrame pageFrame, boolean z) {
sendWndNum(WindowManager.a().w());
}
public void onPageFrameClosed(PageFrame pageFrame) {
sendWndNum(WindowManager.a().w());
}
public void onProcessProps(Bundle bundle) {
}
public boolean onReactEvent(String str, HippyMap hippyMap, Promise promise) {
if (hippyMap.containsKey(ICircleModule.CIRCLE_ARGUMENTS) && !TextUtils.equals(String.valueOf(this.mHashCode), hippyMap.getMap(ICircleModule.CIRCLE_ARGUMENTS).getString("primaryKey"))) {
return true;
}
if (hippyMap.containsKey("primaryKey") && !TextUtils.equals(String.valueOf(this.mHashCode), hippyMap.getString("primaryKey"))) {
return true;
}
if (HippyEventHubDefineBase.ABILITY_SET_TOOLBAR_MODE.name.equalsIgnoreCase(str)) {
this.mUIHandler.obtainMessage(2, new Object[]{str, hippyMap}).sendToTarget();
return true;
}
if (HippyEventHubDefineBase.ABILITY_INTERCEPT_UNIT_TIME.name.equalsIgnoreCase(str)) {
this.mUIHandler.obtainMessage(4, new Object[]{str, hippyMap}).sendToTarget();
return true;
}
if (HippyPageEventDefine.ABILITY_USED_TIME.name.equalsIgnoreCase(str)) {
handleUsedTime(hippyMap);
return true;
}
if (HippyEventHubDefineBase.ABILITY_SET_PAGE_TITLE.name.equalsIgnoreCase(str)) {
this.mCustomPageTitle = hippyMap.getString("title");
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
if (HippyNativePage.this.getNativeGroup() == null || HippyNativePage.this.getNativeGroup().getWebViewClient() == null) {
return;
}
IWebViewClient webViewClient = HippyNativePage.this.getNativeGroup().getWebViewClient();
HippyNativePage hippyNativePage = HippyNativePage.this;
webViewClient.onReceivedTitle(hippyNativePage, hippyNativePage.mCustomPageTitle);
}
});
return true;
}
if (HippyEventHubDefineBase.ABILITY_LOAD_RNPAGE.name.equalsIgnoreCase(str)) {
this.mUIHandler.obtainMessage(5, new Object[]{str, hippyMap}).sendToTarget();
return true;
}
if (HippyEventHubDefineBase.ABILITY_BACK.name.equalsIgnoreCase(str)) {
this.mUIHandler.obtainMessage(6, new Object[]{str, hippyMap}).sendToTarget();
return true;
}
if (HippyEventHubDefineBase.ABILITY_ADD_BACK_STACK.name.equalsIgnoreCase(str)) {
this.mBackStackCounter.incrementAndGet();
return true;
}
if (HippyEventHubDefineBase.ABILITY_REMOVE_BACK_STACK.name.equalsIgnoreCase(str)) {
if (this.mBackStackCounter.decrementAndGet() < 0) {
this.mBackStackCounter.set(0);
}
return true;
}
if (HippyEventHubDefineBase.ABILITY_PRELOAD_WEBVIEW.name.equalsIgnoreCase(str)) {
handlePreloadWebView(hippyMap);
return true;
}
if (HippyEventHubDefineBase.ABILITY_GET_JSBUNDLE_VERSION.name.equalsIgnoreCase(str)) {
handleGetJSBundleVersion(hippyMap, promise);
} else if (HippyEventHubDefineBase.ABILITY_CALL_COMMENT.name.equalsIgnoreCase(str)) {
handleCallComment(hippyMap, promise);
} else if (HippyPageEventDefine.ABILITY_SET_GESTURE_BACK_ENABLED.name.equalsIgnoreCase(str)) {
this.mFrontEndCallEdgeBack = hippyMap.getBoolean(NodeProps.ENABLED);
} else if (HippyPageEventDefine.ABILITY_SET_SHARE_INFO.name.equalsIgnoreCase(str)) {
handleSetShareInfo(hippyMap);
} else if (HippyEventHubDefineBase.ABILITY_TRACE_EVENT.name.equalsIgnoreCase(str)) {
handleTraceEvent(hippyMap);
}
if (this.mUrlListener == null) {
return false;
}
Message obtainMessage = this.mUIHandler.obtainMessage();
obtainMessage.what = 1;
obtainMessage.obj = new Object[]{str, hippyMap};
this.mUIHandler.sendMessage(obtainMessage);
return true;
}
@Override
public void onSendEvent(String str, HashMap<String, Object> hashMap) {
sendEvent(str, hashMapToHippyMap(hashMap));
}
@Override
public void onSkinChanged() {
super.onSkinChanged();
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null) {
qBHippyWindow.onSkinChanged();
}
HippyBackWebView hippyBackWebView = this.mReactBakWebView;
if (hippyBackWebView != null) {
hippyBackWebView.switchSkin();
}
changeStatusBar(!((ActivityHandler.b().a().getWindow().getAttributes().flags & 1024) == 1024), true);
}
@Override
public void onStart() {
super.onStart();
Logs.c("HippyNativePage", HippyEventHubDefineBase.TYPE_ON_START);
if (this.mIsLoadHippySuccess) {
sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_START, new Bundle());
} else {
this.mPeddingActions.add(new PeddingAction(HippyEventHubDefineBase.TYPE_ON_START, new Bundle()));
}
HippyAdditionView hippyAdditionView = this.mAdditionView;
if (hippyAdditionView != null) {
hippyAdditionView.onStart();
}
activeGIfView();
}
@Override
public void onStatusBarVisible(boolean z) {
super.onStatusBarVisible(z);
changeStatusBar(z, false);
}
@Override
public void onStop() {
super.onStop();
Logs.c("HippyNativePage", HippyEventHubDefineBase.TYPE_ON_STOP);
if (this.mIsLoadHippySuccess) {
sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_STOP, new Bundle());
} else {
this.mPeddingActions.add(new PeddingAction(HippyEventHubDefineBase.TYPE_ON_STOP, new Bundle()));
}
HippyAdditionView hippyAdditionView = this.mAdditionView;
if (hippyAdditionView != null) {
hippyAdditionView.onStop();
}
deactiveGIfView();
}
@Override
public void onTrimEvent(int i, int i2) {
}
@Override
public boolean overrideSnapshot() {
return true;
}
@Override
public void preActive() {
super.preActive();
Logs.c("HippyNativePage", "preActive");
((IDebugService) QBContext.getInstance().getService(IDebugService.class)).startFrameRateMonitor(this.mHashCode + "_FromeFeedsToDetailPage:" + this.mValueModule);
}
public void preLoadUrl(String str) {
int i;
Logs.c("HippyNativePage", "preLoadUrl:" + str);
HashMap<String, String> urlParam = UrlUtils.getUrlParam(str);
if (urlParam == null || !urlParam.containsKey("module") || !urlParam.containsKey("component")) {
Logs.c("HippyNativePage", "invalid extraHeader. preLoadUrl error url:" + str);
return;
}
if (urlParam.containsKey("backgroundColor")) {
this.mBackgroundColor = urlParam.get("backgroundColor");
}
if (urlParam.containsKey(KEY_NAVIGATIONCOLOR)) {
this.mNavigationColor = urlParam.get(KEY_NAVIGATIONCOLOR);
}
if (urlParam.containsKey("transparent")) {
this.mHippyTransparent = "1".equals(urlParam.get("transparent"));
}
this.mValueTitle = urlParam.get("title");
this.mValueModule = urlParam.get("module");
this.mWithWormHole = "1".equals(urlParam.get(KEY_WORMHOLE));
this.mValueFramework = "hippy-vue".equalsIgnoreCase(urlParam.get("framework")) ? 1 : 0;
this.mValueCompName = urlParam.get("component");
this.mValueCompName = urlParam.get("component");
if (TextUtils.isEmpty(this.mValueModule) || TextUtils.isEmpty(this.mValueCompName)) {
Logs.c("HippyNativePage", "invalid mValueModule:" + this.mValueModule + ",mValueCompName: " + this.mValueCompName);
} else {
this.mReactConfigInfo = getRNVerticalConfigInfo(this.mValueModule);
}
if (urlParam.containsKey("orientation")) {
try {
i = Integer.parseInt(urlParam.get("orientation"));
} catch (Throwable unused) {
i = -1;
}
this.mOrientation = -1;
if (i == 2 || i == 1) {
this.mOrientation = i;
}
}
if (urlParam.containsKey("comment") && "1".equals(urlParam.get("comment"))) {
this.mSetComment = true;
}
if (urlParam.containsKey("debug")) {
String str2 = urlParam.get("debug");
if (IOpenJsApis.TRUE.equalsIgnoreCase(str2) || "1".equalsIgnoreCase(str2)) {
this.mDebugUrl = true;
} else {
this.mDebugUrl = false;
}
}
if (urlParam.containsKey("preloadUrl")) {
this.mValuePreloadWebviewUrl = urlParam.get("preloadUrl");
}
this.mUrl = str;
}
public void processBuilder(ModuleParams.Builder builder) {
}
public void refreshQburl(String str) {
this.mUrl = str;
if (this.mEventHub == null) {
return;
}
Bundle bundle = new Bundle(9);
bundle.putString("abilities", this.mEventHub.getCommonAbilityString());
bundle.putString("customerAbilities", this.mEventHub.getCustomerAbilityString());
bundle.putString("primaryKey", String.valueOf(this.mHashCode));
bundle.putString("url", this.mUrl);
int i = this.mOrientation;
if (i != -1) {
bundle.putInt("orientation", i);
}
bundle.putInt("multiWindowCount", WindowManager.a().y());
for (String str2 : this.mExtraData.keySet()) {
bundle.putString(str2, this.mExtraData.get(str2));
}
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null) {
qBHippyWindow.sendEvent(HippyPageEventDefine.EVENT_REFRESH_QBURL, bundle);
}
}
public void registerMethod() {
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null) {
this.mEventHub.setQBHippyWindow(qBHippyWindow);
this.mEventHub.registerListener(this);
this.mEventHub.registNativeMethod(this.mValueModule);
}
}
@Override
public void reload() {
super.reload();
Logs.c("HippyNativePage", "reload");
if (this.mHippyRootView != null) {
sendLifecycleEvent("reload", new Bundle());
}
HippyBackWebView hippyBackWebView = this.mReactBakWebView;
if (hippyBackWebView != null) {
hippyBackWebView.reload();
}
}
public void removeAddtionView() {
HippyAdditionView hippyAdditionView = this.mAdditionView;
if (hippyAdditionView != null && hippyAdditionView.getParent() != null) {
((ViewGroup) this.mAdditionView.getParent()).removeView(this.mAdditionView);
}
this.mAdditionView = null;
}
@Override
public void restoreState(String str, Bundle bundle) {
loadUrl(str);
}
public void sendEvent(String str, Bundle bundle) {
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null) {
qBHippyWindow.sendEvent(str, bundle);
}
}
public void sendEvent(String str, HippyMap hippyMap) {
QBHippyWindow qBHippyWindow = this.mHippyRootView;
if (qBHippyWindow != null) {
qBHippyWindow.sendEvent(str, hippyMap);
}
}
public void sendWndNum(int i) {
HippyPageEventHub hippyPageEventHub = this.mEventHub;
if (hippyPageEventHub != null) {
hippyPageEventHub.sendWndNum(i);
}
}
public void setCoverToolbar(boolean z) {
this.mCoverToolbar = z;
}
public void setForNative(boolean z) {
this.mIsForNative = z;
}
public void setRNPageUrlListener(IRNPageUrlListener iRNPageUrlListener) {
this.mUrlListener = iRNPageUrlListener;
}
public void setUrlParams(UrlParams urlParams) {
this.urlParams = urlParams;
}
public void showLoadingView() {
if (this.loadingViewController == null) {
this.loadingViewController = new HippyPageLoadingViewController();
this.loadingViewController.initLoadingView(this);
}
this.loadingViewController.showLoadingView();
}
@Override
public IWebView.STATUS_BAR statusBarType() {
return SkinManager.s().l() ? IWebView.STATUS_BAR.NO_SHOW_LIGHT : this.mSaveStatueBar != null ? this.mSaveStatueBar : UIUtil.a(this.mColor) ? IWebView.STATUS_BAR.NO_SHOW_DARK : IWebView.STATUS_BAR.NO_SHOW_LIGHT;
}
@Override
public void toPage(String str) {
super.toPage(str);
Logs.c("HippyNativePage", "toPage:" + str);
Bundle bundle = new Bundle(9);
bundle.putString("toPageUrl", str);
if (this.mIsLoadHippySuccess) {
sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_TOPAGE, bundle);
} else {
this.mPeddingActions.add(new PeddingAction(HippyEventHubDefineBase.TYPE_ON_TOPAGE, new Bundle()));
}
}
}