同程有借 v1.0.0版本的 MD5 值为:e33397cdbab33543d0c134ec96d77fb8
以下内容为反编译后的 WebviewActivity.java 源代码,内容仅作参考
package com.moture.plugin.web.activity;
import android.app.Activity;
import android.app.Dialog;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.MutableLiveData;
import com.bonree.sdk.agent.engine.external.Instrumented;
import com.bonree.sdk.agent.engine.external.MethodInfo;
import com.bonree.sdk.agent.engine.external.WebViewInstrumentation;
import com.bonree.sdk.agent.engine.external.XMLParseInstrumentation;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.moture.lib.core.app.AppMain;
import com.moture.lib.core.app.AppUtil;
import com.moture.lib.core.device.DeviceUtil;
import com.moture.lib.core.misc.helper.SharedPreferencesHelper;
import com.moture.lib.core.misc.json.JsonHelper;
import com.moture.lib.core.misc.logger.LogModuleType;
import com.moture.lib.core.misc.logger.Logger;
import com.moture.lib.core.permission.AppPermission;
import com.moture.lib.core.permission.PermissionConfig;
import com.moture.lib.core.permission.PermissionDenied;
import com.moture.lib.core.permission.PermissionGrant;
import com.moture.lib.core.utils.contacts.ContactInfo;
import com.moture.lib.core.utils.contacts.ContactsUtils;
import com.moture.lib.core.utils.immersion.WebviewLayoutListener;
import com.moture.lib.core.utils.ui.UiKit;
import com.moture.lib.router.URLBridge;
import com.moture.lib.ui.widgets.LibImageButton;
import com.moture.lib.ui.widgets.dialog.TipsDialog;
import com.moture.lib.ui.widgets.sysbartint.SysBarTintExclude;
import com.moture.plugin.auth.AuthJavascriptInterface;
import com.moture.plugin.auth.FabricAuth;
import com.moture.plugin.auth.response.FabricLoginCallbackData;
import com.moture.plugin.core.BaseJavascriptInterface;
import com.moture.plugin.core.BaseWebActivity;
import com.moture.plugin.core.BridgeHelper;
import com.moture.plugin.core.BridgeWebView;
import com.moture.plugin.core.CommonUtils;
import com.moture.plugin.core.ErrorType;
import com.moture.plugin.core.FabricCallBackData;
import com.moture.plugin.core.WebConstant;
import com.moture.plugin.core.views.WebTitleView;
import com.moture.plugin.http.FabricHttp;
import com.moture.plugin.lottie.DefaultLottieLoadingCreator;
import com.moture.plugin.lottie.LottieAnimation;
import com.moture.plugin.lottie.LottieLoading;
import com.moture.plugin.photo.FabricPhoto;
import com.moture.plugin.photo.ImagePreviewEvent;
import com.moture.plugin.photo.PhotoJavascriptInterface;
import com.moture.plugin.photo.UploadManager;
import com.moture.plugin.photo.request.CropPhotoBean;
import com.moture.plugin.photo.request.FabricChooseImageOptions;
import com.moture.plugin.photo.request.ResizedPhotoBean;
import com.moture.plugin.photo.response.FabricChooseImageCallbackData;
import com.moture.plugin.photo.response.FabricChooseImageItem;
import com.moture.plugin.toast.FabricToast;
import com.moture.plugin.toast.ToastJavascriptInterface;
import com.moture.plugin.utils.FabricUtils;
import com.moture.plugin.utils.UtilsJavascriptInterface;
import com.moture.plugin.utils.response.ContactObject;
import com.moture.plugin.utils.response.FabricUtilsGetContactsCallbackData;
import com.moture.plugin.web.R;
import com.moture.plugin.web.bridge.FabricWeb;
import com.moture.plugin.web.bridge.WebJavascriptInterface;
import com.moture.plugin.web.bridge.request.FabricWebviewLaunchOptions;
import com.plugin.location.FabricLocation;
import com.plugin.scan.RxPermissionsUtils;
import com.plugin.storage.FabricStorage;
import com.plugin.toolbar.FabricToolBar;
import com.plugin.toolbar.ToolBarItemClickListener;
import com.plugin.toolbar.ToolBarJavascriptInterface;
import com.plugin.toolbar.request.FabricToolbarNavbarOptions;
import com.plugin.toolbar.request.ToolbarNavbarItem;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.sensorsdata.analytics.android.sdk.jsbridge.JSHookAop;
import e2.b;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import p4.a;
import p4.b;
import r6.c;
@SysBarTintExclude
@Instrumented
public class WebviewActivity extends BaseWebActivity {
public static final String APP_URL_SCHEME_KEY = "APP_URL_SCHEME_KEY";
public static String APP_URL_SCHEME_VALUE = "innclient";
protected static DefaultLottieLoadingCreator mDefaultLottieLoadingCreator = null;
public static String mOptionsKey = "fabricWebviewLaunchOptions";
public static String mTitleKey = "webTitle";
public static String mUrlKey = "url";
private static Map<Class<? extends BaseJavascriptInterface>, String> modulePlugins;
public View bridgeErrorLayout;
public TextView bridgeReloadTv;
public BridgeWebView bridgeWebView;
public AuthJavascriptInterface mAuthJavascriptInterface;
public LinearLayout mCenterViewLayout;
private FabricWebviewLaunchOptions mFabricWebviewLaunchOptions;
private JFWebChromeClient mJFWebChromeClient;
private JFWebViewClient mJFWebViewClient;
public LinearLayout mLeftViewLayout;
public PhotoJavascriptInterface mPhotoJavascriptInterface;
public LinearLayout mRightViewLayout;
private ToolBarItemClickListener mToolBarItemClickListener;
public ToolBarJavascriptInterface mToolBarJavascriptInterface;
public ValueCallback<Uri[]> mUploadCallbackAboveL;
public UtilsJavascriptInterface mUtilsJavascriptInterface;
public WebJavascriptInterface mWebJavascriptInterface;
private MoKeyDownEvent moKeyDownEvent;
public String webTitle;
public RelativeLayout webviewActivityLayout;
public WebTitleView webviewTitleView;
public String loadUrl = "https://fex.qa.tcshuke.com/docs/admin/bridge/demo?env=uat";
public boolean transparentTitle = false;
public boolean isNavbarHidden = false;
public boolean webviewHistory = false;
public boolean webviewIndicator = false;
public boolean webviewNoIndicator = false;
protected LottieAnimation mLottieAnimation = null;
private boolean isShowFirst = true;
public MutableLiveData<String> mWebviewLoadFinishedLivedata = new MutableLiveData<>();
public MutableLiveData<String> mWebviewLoadStartedLivedata = new MutableLiveData<>();
public void downloadByBrowser(String str) {
try {
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.BROWSABLE");
intent.setData(Uri.parse(str));
startActivity(intent);
} catch (Exception e9) {
e9.printStackTrace();
}
}
public void finishCurrentActivity() {
finish();
FabricWebviewLaunchOptions fabricWebviewLaunchOptions = this.mFabricWebviewLaunchOptions;
if (fabricWebviewLaunchOptions != null && TextUtils.equals("top", fabricWebviewLaunchOptions.direction)) {
overridePendingTransition(R.anim.common_activity_bottom_in, R.anim.common_activity_bottom_out);
} else {
overridePendingTransition(R.anim.common_activity_left_in, R.anim.common_activity_right_out);
}
}
private void initBottomSide() {
WebviewLayoutListener.assistActivity(this, findViewById(16908290));
}
private void initView() {
RelativeLayout relativeLayout;
FrameLayout frameLayout;
this.webviewActivityLayout = (RelativeLayout) findViewById(R.id.activity_webview_layout);
if (this.transparentTitle) {
LayoutInflater from = LayoutInflater.from(this);
int i9 = R.layout.webview_below_layout;
relativeLayout = (RelativeLayout) (!(from instanceof LayoutInflater) ? from.inflate(i9, (ViewGroup) null) : XMLParseInstrumentation.inflate(from, i9, (ViewGroup) null));
} else {
LayoutInflater from2 = LayoutInflater.from(this);
int i10 = R.layout.webview_abolve_layout;
relativeLayout = (RelativeLayout) (!(from2 instanceof LayoutInflater) ? from2.inflate(i10, (ViewGroup) null) : XMLParseInstrumentation.inflate(from2, i10, (ViewGroup) null));
}
LottieAnimation lottieAnimation = this.mLottieAnimation;
if (lottieAnimation != null && lottieAnimation.openLottieLoading() && (frameLayout = (FrameLayout) relativeLayout.findViewById(R.id.lottie_layout)) != null) {
frameLayout.addView(this.mLottieAnimation.getView());
frameLayout.setVisibility(0);
}
this.webviewActivityLayout.addView(relativeLayout);
initTitleLayout(relativeLayout);
initHalfWebview(relativeLayout);
initWebview(relativeLayout);
}
private boolean isLottieShow() {
LottieAnimation lottieAnimation = this.mLottieAnimation;
if (lottieAnimation == null) {
return false;
}
return lottieAnimation.isShow();
}
public static void launchJFWebviewActivity(Activity activity, String str) {
launchJFWebviewActivity(activity, str, null);
}
private void logE(String str) {
a aVar = new a();
aVar.i(this.loadUrl);
b bVar = new b();
bVar.d("Plugin.Web");
bVar.f(str);
bVar.e(aVar);
Logger.e(LogModuleType.LOG_MSG_EXT_CONTEXT, JsonHelper.getInstance().toJson(bVar));
}
public void logI(String str, String str2) {
a aVar = new a();
aVar.i(this.loadUrl);
b bVar = new b();
bVar.d(str);
bVar.f(str2);
bVar.e(aVar);
Logger.i(LogModuleType.LOG_MSG_EXT_CONTEXT, JsonHelper.getInstance().toJson(bVar));
}
private static void logSE(String str, String str2, String str3) {
a aVar = new a();
aVar.i(str);
aVar.c(str3);
b bVar = new b();
bVar.d("Plugin.Web");
bVar.f(str2);
bVar.e(aVar);
Logger.e(LogModuleType.LOG_MSG_EXT_CONTEXT, JsonHelper.getInstance().toJson(bVar));
}
public static void registerModulePlugin(Class<? extends BaseJavascriptInterface> cls, String str) {
if (cls == null || TextUtils.isEmpty(str)) {
return;
}
if (modulePlugins == null) {
modulePlugins = new HashMap();
}
modulePlugins.put(cls, str);
}
public void sendCenterMsgToH5(int i9) {
List<ToolbarNavbarItem> list;
ToolBarJavascriptInterface toolBarJavascriptInterface = this.mToolBarJavascriptInterface;
FabricToolbarNavbarOptions fabricToolbarNavbarOptions = toolBarJavascriptInterface.fabricLocalOptions;
String str = toolBarJavascriptInterface.fabricLocalCallBackId;
if (fabricToolbarNavbarOptions == null || (list = fabricToolbarNavbarOptions.center) == null || list.size() <= i9) {
return;
}
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricToolbarNavbarOptions.center.get(i9).tag), str, false);
}
private void sendExceptionResponse(String str) {
sendExceptionResponse(str, "");
}
public void sendLeftMsgToH5(int i9) {
List<ToolbarNavbarItem> list;
ToolBarJavascriptInterface toolBarJavascriptInterface = this.mToolBarJavascriptInterface;
FabricToolbarNavbarOptions fabricToolbarNavbarOptions = toolBarJavascriptInterface.fabricLocalOptions;
String str = toolBarJavascriptInterface.fabricLocalCallBackId;
if (fabricToolbarNavbarOptions != null && (list = fabricToolbarNavbarOptions.left) != null && list.size() > i9) {
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricToolbarNavbarOptions.left.get(i9).tag), str, false);
} else if (i9 == 0) {
if (this.bridgeWebView.canGoBack()) {
this.bridgeWebView.goBack();
} else {
finishCurrentActivity();
}
}
}
public void sendRightMsgToH5(int i9) {
List<ToolbarNavbarItem> list;
ToolBarJavascriptInterface toolBarJavascriptInterface = this.mToolBarJavascriptInterface;
FabricToolbarNavbarOptions fabricToolbarNavbarOptions = toolBarJavascriptInterface.fabricLocalOptions;
String str = toolBarJavascriptInterface.fabricLocalCallBackId;
if (fabricToolbarNavbarOptions == null || (list = fabricToolbarNavbarOptions.right) == null || list.size() <= i9) {
return;
}
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricToolbarNavbarOptions.right.get(i9).tag), str, false);
}
public static void setDefaultLottieLoadingCreator(DefaultLottieLoadingCreator defaultLottieLoadingCreator) {
mDefaultLottieLoadingCreator = defaultLottieLoadingCreator;
}
public void checkImagePermission(int i9, String[] strArr) {
AppPermission.requestPermissions(this, i9, strArr);
}
@Override
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
List<ToolbarNavbarItem> list;
if (keyEvent.getAction() == 0) {
if (keyEvent.getKeyCode() == 4) {
ToolBarJavascriptInterface toolBarJavascriptInterface = this.mToolBarJavascriptInterface;
FabricToolbarNavbarOptions fabricToolbarNavbarOptions = toolBarJavascriptInterface.fabricLocalOptions;
String str = toolBarJavascriptInterface.fabricLocalCallBackId;
if (fabricToolbarNavbarOptions != null && (list = fabricToolbarNavbarOptions.left) != null && !list.isEmpty()) {
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricToolbarNavbarOptions.left.get(0).tag), str, false);
} else if (this.bridgeWebView.canGoBack()) {
this.bridgeWebView.goBack();
} else {
return super.dispatchKeyEvent(keyEvent);
}
return true;
}
MoKeyDownEvent moKeyDownEvent = this.moKeyDownEvent;
if (moKeyDownEvent != null && moKeyDownEvent.onKeyDown(keyEvent.getKeyCode(), keyEvent)) {
return true;
}
}
StringBuilder sb = new StringBuilder();
sb.append(keyEvent.getKeyCode());
sb.append(" dispatchKeyEvent action : ");
sb.append(keyEvent.getAction());
sb.append(this.moKeyDownEvent == null);
AppUtil.print(sb.toString());
return super.dispatchKeyEvent(keyEvent);
}
public LottieAnimation getLottieAnimation() {
return this.mLottieAnimation;
}
public void initCenterView() {
LibImageButton libImageButton = (LibImageButton) this.webviewTitleView.getCenterTitleLayout().getChildAt(0);
libImageButton.getTextView().setTextSize(18.0f);
libImageButton.getTextView().setTextColor(Color.parseColor("#FF000000"));
libImageButton.getTextView().setTypeface(Typeface.defaultFromStyle(1));
}
public void initHalfWebview(RelativeLayout relativeLayout) {
String str;
FabricWebviewLaunchOptions fabricWebviewLaunchOptions = this.mFabricWebviewLaunchOptions;
if (fabricWebviewLaunchOptions == null) {
return;
}
try {
float parseFloat = Float.parseFloat(fabricWebviewLaunchOptions.screen);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams.width = -1;
layoutParams.height = DeviceUtil.dip2px(parseFloat);
layoutParams.addRule(12);
relativeLayout.setLayoutParams(layoutParams);
if (this.mFabricWebviewLaunchOptions.overlayOpacity > 0.0f) {
str = "#" + Integer.toHexString((int) (this.mFabricWebviewLaunchOptions.overlayOpacity * 255.0f));
} else {
str = "#00";
}
ColorDrawable colorDrawable = new ColorDrawable();
colorDrawable.setColor(Color.parseColor(str + "000000"));
getWindow().setBackgroundDrawable(colorDrawable);
this.webviewTitleView.setVisibility(8);
if (this.mFabricWebviewLaunchOptions.overlayClickClose) {
this.webviewActivityLayout.setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
MethodInfo.onClickEventEnter(view, WebviewActivity.class);
WebviewActivity.this.finishCurrentActivity();
MethodInfo.onClickEventEnd();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
}
} catch (Exception e9) {
logSE(this.loadUrl, "初始化 webview 失败 [initHalfWebview]", e9.getMessage());
}
}
public void initLeftView() {
LibImageButton libImageButton = (LibImageButton) this.mLeftViewLayout.getChildAt(0);
if (libImageButton != null) {
libImageButton.setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
MethodInfo.onClickEventEnter(view, WebviewActivity.class);
if (WebviewActivity.this.bridgeWebView.canGoBack()) {
WebviewActivity.this.bridgeWebView.goBack();
} else {
WebviewActivity.this.finishCurrentActivity();
}
MethodInfo.onClickEventEnd();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
libImageButton.getImageView().setVisibility(0);
libImageButton.getTextView().setVisibility(0);
libImageButton.getTextView().setText("");
if (this.transparentTitle) {
libImageButton.getImageView().setImageResource(R.mipmap.arrow_left_white);
} else {
libImageButton.getImageView().setImageResource(R.mipmap.arrow_left_black);
}
libImageButton.setImageViewWidth(DeviceUtil.dip2px(30.0f));
libImageButton.setImageViewHeight(DeviceUtil.dip2px(30.0f));
}
}
protected void initLottieAnimation() {
if (mDefaultLottieLoadingCreator == null) {
mDefaultLottieLoadingCreator = new DefaultLottieLoadingCreator() {
@Override
public LottieAnimation createLoading(@NonNull Context context) {
return new LottieLoading(context);
}
};
}
LottieAnimation createLoading = mDefaultLottieLoadingCreator.createLoading(this);
this.mLottieAnimation = createLoading;
if (createLoading == null || !createLoading.openLottieLoading()) {
return;
}
this.mLottieAnimation.playAnimation();
}
public void initRightView() {
if (this.webviewHistory) {
this.webviewTitleView.getRightTitleLayout().setVisibility(0);
if (this.webviewTitleView.getRightTitleLayout().getChildCount() > 0) {
LibImageButton libImageButton = (LibImageButton) this.webviewTitleView.getRightTitleLayout().getChildAt(0);
libImageButton.setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
MethodInfo.onClickEventEnter(view, WebviewActivity.class);
WebviewActivity.this.finishCurrentActivity();
MethodInfo.onClickEventEnd();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
libImageButton.getImageView().setVisibility(0);
libImageButton.getTextView().setVisibility(0);
libImageButton.getTextView().setText("");
libImageButton.getImageView().setImageResource(R.mipmap.icon_webview_close);
return;
}
return;
}
this.webviewTitleView.getRightTitleLayout().setVisibility(8);
}
public void initTitleLayout(RelativeLayout relativeLayout) {
WebTitleView webTitleView = (WebTitleView) relativeLayout.findViewById(R.id.webview_title_layout);
this.webviewTitleView = webTitleView;
this.mLeftViewLayout = webTitleView.getLeftTitleLayout();
this.mCenterViewLayout = this.webviewTitleView.getCenterTitleLayout();
this.mRightViewLayout = this.webviewTitleView.getRightTitleLayout();
initLeftView();
initCenterView();
initRightView();
this.mToolBarItemClickListener = new ToolBarItemClickListener() {
@Override
public void onItemClick(String str, int i9) {
if (TextUtils.equals(str, "left")) {
WebviewActivity.this.sendLeftMsgToH5(i9);
} else if (TextUtils.equals(str, "center")) {
WebviewActivity.this.sendCenterMsgToH5(i9);
} else if (TextUtils.equals(str, "right")) {
WebviewActivity.this.sendRightMsgToH5(i9);
}
}
};
this.webviewTitleView.fitsSystemWindows(true);
if (this.isNavbarHidden) {
this.webviewTitleView.setVisibility(8);
} else {
this.webviewTitleView.setVisibility(0);
}
}
public void initWebview(RelativeLayout relativeLayout) {
this.bridgeWebView = (BridgeWebView) relativeLayout.findViewById(R.id.bridgeWebView);
View findViewById = relativeLayout.findViewById(R.id.bridgeErrorLayout);
this.bridgeErrorLayout = findViewById;
this.bridgeReloadTv = (TextView) findViewById.findViewById(R.id.reload_txt);
JFWebChromeClient jFWebChromeClient = new JFWebChromeClient();
this.mJFWebChromeClient = jFWebChromeClient;
jFWebChromeClient.webviewActivity = this;
jFWebChromeClient.setWebTitle(this.webTitle);
this.bridgeWebView.setWebChromeClient(this.mJFWebChromeClient);
JFWebViewClient jFWebViewClient = new JFWebViewClient();
this.mJFWebViewClient = jFWebViewClient;
jFWebViewClient.webviewActivity = this;
BridgeWebView bridgeWebView = this.bridgeWebView;
if (bridgeWebView instanceof WebView) {
WebViewInstrumentation.setsetWebViewClient(bridgeWebView, jFWebViewClient);
} else {
bridgeWebView.setWebViewClient(jFWebViewClient);
}
this.bridgeWebView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String str, String str2, String str3, String str4, long j9) {
WebviewActivity.this.downloadByBrowser(str);
}
});
if (this.webviewHistory) {
String userAgentString = this.bridgeWebView.getSettings().getUserAgentString();
this.bridgeWebView.getSettings().setUserAgentString(userAgentString + "/NoWebview");
}
FabricHttp.register(this.bridgeWebView);
this.mAuthJavascriptInterface = FabricAuth.register(this, this.bridgeWebView);
this.mUtilsJavascriptInterface = FabricUtils.register(this, this.bridgeWebView);
FabricToast.register(this, this.bridgeWebView, this.mLottieAnimation).setRefreshSysBar(new ToastJavascriptInterface.RefreshSysBar() {
@Override
public void refresh() {
WebviewActivity.this.refreshStatuBarColor();
}
});
registerModulePlugin();
this.mPhotoJavascriptInterface = FabricPhoto.register(this, this.bridgeWebView);
this.mWebJavascriptInterface = FabricWeb.register(this, this.bridgeWebView);
this.mToolBarJavascriptInterface = FabricToolBar.register(this, this.bridgeWebView, this.webviewTitleView).setSystemBarTintManager(getTintBarManager()).setToolBarItemClickListener(this.mToolBarItemClickListener);
FabricStorage.register(this, this.bridgeWebView);
FabricLocation.register(this, this.bridgeWebView);
BridgeWebView bridgeWebView2 = this.bridgeWebView;
String str = this.loadUrl;
bridgeWebView2.loadUrl(str);
JSHookAop.loadUrl(bridgeWebView2, str);
this.bridgeReloadTv.setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
MethodInfo.onClickEventEnter(view, WebviewActivity.class);
WebviewActivity.this.bridgeWebView.reload();
LottieAnimation lottieAnimation = WebviewActivity.this.mLottieAnimation;
if (lottieAnimation != null && lottieAnimation.openLottieLoading()) {
WebviewActivity.this.mLottieAnimation.playAnimation();
}
MethodInfo.onClickEventEnd();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
}
@Override
protected void onActivityResult(int i9, int i10, Intent intent) {
String str;
ContactInfo retrieveContactInfo;
String phoneNumber;
PhotoJavascriptInterface photoJavascriptInterface;
Uri[] uriArr;
String insertImage;
super.onActivityResult(i9, i10, intent);
String str2 = null;
r3 = null;
JsonObject asJsonObject = null;
String str3 = null;
if (i9 == 777) {
if (i10 == -1) {
if (intent != null) {
try {
retrieveContactInfo = ContactsUtils.retrieveContactInfo(this, intent.getData());
} catch (SecurityException unused) {
str = null;
}
if (retrieveContactInfo != null) {
str = retrieveContactInfo.getDisplayName();
try {
phoneNumber = retrieveContactInfo.getPhoneNumber();
str3 = str;
str = str3;
str2 = phoneNumber;
} catch (SecurityException unused2) {
UiKit.showToast("获取姓名和手机号码失败,请手动输入", this);
FabricUtilsGetContactsCallbackData fabricUtilsGetContactsCallbackData = new FabricUtilsGetContactsCallbackData();
if (TextUtils.isEmpty(str2)) {
}
fabricUtilsGetContactsCallbackData.contacts = new ArrayList();
ContactObject contactObject = new ContactObject();
contactObject.contactName = str;
HashSet hashSet = new HashSet();
hashSet.add(str2);
contactObject.mobile = hashSet;
fabricUtilsGetContactsCallbackData.contacts.add(contactObject);
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricUtilsGetContactsCallbackData), this.mUtilsJavascriptInterface.fabricContactCallBackId, true);
return;
}
FabricUtilsGetContactsCallbackData fabricUtilsGetContactsCallbackData2 = new FabricUtilsGetContactsCallbackData();
if (TextUtils.isEmpty(str2) || !TextUtils.isEmpty(str)) {
fabricUtilsGetContactsCallbackData2.contacts = new ArrayList();
ContactObject contactObject2 = new ContactObject();
contactObject2.contactName = str;
HashSet hashSet2 = new HashSet();
hashSet2.add(str2);
contactObject2.mobile = hashSet2;
fabricUtilsGetContactsCallbackData2.contacts.add(contactObject2);
}
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricUtilsGetContactsCallbackData2), this.mUtilsJavascriptInterface.fabricContactCallBackId, true);
return;
}
}
phoneNumber = null;
str = str3;
str2 = phoneNumber;
FabricUtilsGetContactsCallbackData fabricUtilsGetContactsCallbackData22 = new FabricUtilsGetContactsCallbackData();
if (TextUtils.isEmpty(str2)) {
}
fabricUtilsGetContactsCallbackData22.contacts = new ArrayList();
ContactObject contactObject22 = new ContactObject();
contactObject22.contactName = str;
HashSet hashSet22 = new HashSet();
hashSet22.add(str2);
contactObject22.mobile = hashSet22;
fabricUtilsGetContactsCallbackData22.contacts.add(contactObject22);
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricUtilsGetContactsCallbackData22), this.mUtilsJavascriptInterface.fabricContactCallBackId, true);
return;
}
FabricUtilsGetContactsCallbackData fabricUtilsGetContactsCallbackData3 = new FabricUtilsGetContactsCallbackData();
fabricUtilsGetContactsCallbackData3.contacts = new ArrayList();
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricUtilsGetContactsCallbackData3), this.mUtilsJavascriptInterface.fabricContactCallBackId, true);
} else if (i9 != 888) {
switch (i9) {
case 9:
case 10:
if (i10 == -1) {
ArrayList<String> stringArrayListExtra = intent.getStringArrayListExtra("select_result");
intent.getBooleanExtra("is_camera_image", false);
FabricChooseImageCallbackData fabricChooseImageCallbackData = new FabricChooseImageCallbackData();
FabricChooseImageOptions fabricChooseImageOptions = this.mPhotoJavascriptInterface.mFabricChooseImageOptions;
ResizedPhotoBean resizedPhotoBean = fabricChooseImageOptions != null ? fabricChooseImageOptions.resizedBase64 : null;
ArrayList arrayList = new ArrayList();
for (int i11 = 0; i11 < stringArrayListExtra.size(); i11++) {
FabricChooseImageItem fabricChooseImageItem = new FabricChooseImageItem();
fabricChooseImageItem.path = stringArrayListExtra.get(i11);
fabricChooseImageItem.size = CommonUtils.getFileSize(stringArrayListExtra.get(i11));
Bitmap imageBitmap = CommonUtils.getImageBitmap(stringArrayListExtra.get(i11));
if (imageBitmap == null) {
logE("拍照/选择照片selectedBitmap为空");
}
if (resizedPhotoBean != null && imageBitmap != null) {
Bitmap zoomBitmap = CommonUtils.zoomBitmap(imageBitmap, resizedPhotoBean.width, resizedPhotoBean.height);
fabricChooseImageItem.base64 = CommonUtils.bitmaptoString(zoomBitmap);
zoomBitmap.recycle();
}
if (TextUtils.isEmpty(fabricChooseImageItem.base64)) {
logE("拍照/选择照片base64为空");
}
arrayList.add(fabricChooseImageItem);
}
fabricChooseImageCallbackData.tempFiles = arrayList;
if (this.mPhotoJavascriptInterface != null) {
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricChooseImageCallbackData), this.mPhotoJavascriptInterface.mChooseImageCallbackId, true);
return;
}
return;
}
sendExceptionResponse(ErrorType.ntv_view_window_cancelled, "操作取消");
logI(LogModuleType.Permission, "拍照/选择照片取消[REQUEST_CODE_CAMERA]");
return;
case 11:
if (i10 != 0 || (photoJavascriptInterface = this.mPhotoJavascriptInterface) == null) {
return;
}
String str4 = photoJavascriptInterface.mPreviewImageCallbackId;
FabricCallBackData fabricCallBackData = new FabricCallBackData("");
fabricCallBackData.code = "1";
this.bridgeWebView.mBridgeHelper.sendResponse(fabricCallBackData, str4, true);
return;
case 12:
case 14:
case 15:
if (i10 == -1 && intent != null) {
if (Build.VERSION.SDK_INT >= 21) {
String dataString = intent.getDataString();
ClipData clipData = intent.getClipData();
if (clipData != null) {
uriArr = new Uri[clipData.getItemCount()];
for (int i12 = 0; i12 < clipData.getItemCount(); i12++) {
uriArr[i12] = clipData.getItemAt(i12).getUri();
}
} else {
uriArr = null;
}
if (dataString != null) {
uriArr = new Uri[]{Uri.parse(dataString)};
}
ValueCallback<Uri[]> valueCallback = this.mUploadCallbackAboveL;
if (valueCallback != null) {
valueCallback.onReceiveValue(uriArr);
this.mUploadCallbackAboveL = null;
return;
}
return;
}
return;
}
ValueCallback<Uri[]> valueCallback2 = this.mUploadCallbackAboveL;
if (valueCallback2 != null) {
valueCallback2.onReceiveValue(null);
this.mUploadCallbackAboveL = null;
return;
}
return;
case 13:
if (i10 == -1 && intent != null) {
if (Build.VERSION.SDK_INT >= 21) {
Bitmap bitmap = (Bitmap) intent.getExtras().get("data");
this.mUploadCallbackAboveL.onReceiveValue((bitmap == null || (insertImage = MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, (String) null, (String) null)) == null) ? null : new Uri[]{Uri.parse(insertImage)});
this.mUploadCallbackAboveL = null;
return;
}
return;
}
ValueCallback<Uri[]> valueCallback3 = this.mUploadCallbackAboveL;
if (valueCallback3 != null) {
valueCallback3.onReceiveValue(null);
this.mUploadCallbackAboveL = null;
return;
}
return;
case 16:
if (UploadManager.mFilePath == null) {
sendExceptionResponse(ErrorType.ntv_view_window_cancelled, "操作取消");
return;
}
FabricChooseImageCallbackData fabricChooseImageCallbackData2 = new FabricChooseImageCallbackData();
FabricChooseImageOptions fabricChooseImageOptions2 = this.mPhotoJavascriptInterface.mFabricChooseImageOptions;
ResizedPhotoBean resizedPhotoBean2 = fabricChooseImageOptions2 != null ? fabricChooseImageOptions2.resizedBase64 : null;
ArrayList arrayList2 = new ArrayList();
FabricChooseImageItem fabricChooseImageItem2 = new FabricChooseImageItem();
String str5 = UploadManager.mFilePath;
fabricChooseImageItem2.path = str5;
fabricChooseImageItem2.size = CommonUtils.getFileSize(str5);
if (resizedPhotoBean2 != null) {
Bitmap zoomBitmap2 = CommonUtils.zoomBitmap(CommonUtils.getImageBitmap(UploadManager.mFilePath), resizedPhotoBean2.width, resizedPhotoBean2.height);
fabricChooseImageItem2.base64 = CommonUtils.bitmaptoString(zoomBitmap2);
zoomBitmap2.recycle();
}
arrayList2.add(fabricChooseImageItem2);
fabricChooseImageCallbackData2.tempFiles = arrayList2;
if (this.mPhotoJavascriptInterface != null) {
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(fabricChooseImageCallbackData2), this.mPhotoJavascriptInterface.mChooseImageCallbackId, true);
return;
}
return;
case 17:
boolean isProviderEnabled = ((LocationManager) getSystemService("location")).isProviderEnabled("gps");
if (this.mUtilsJavascriptInterface != null) {
if (isProviderEnabled) {
if (ContextCompat.checkSelfPermission(this, PermissionConfig.Location.ACCESS_FINE_LOCATION) != 0 && ContextCompat.checkSelfPermission(this, PermissionConfig.Location.ACCESS_COARSE_LOCATION) != 0) {
FabricCallBackData fabricCallBackData2 = new FabricCallBackData(Boolean.FALSE);
fabricCallBackData2.code = ErrorType.ntv_permission_reject;
fabricCallBackData2.message = "定位权限被拒绝";
this.bridgeWebView.mBridgeHelper.sendResponse(fabricCallBackData2, this.mUtilsJavascriptInterface.fabricGPSCallBackId, true);
return;
}
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(Boolean.TRUE), this.mUtilsJavascriptInterface.fabricGPSCallBackId, true);
return;
}
FabricCallBackData fabricCallBackData3 = new FabricCallBackData(Boolean.FALSE);
fabricCallBackData3.code = ErrorType.location_service_disallow;
this.bridgeWebView.mBridgeHelper.sendResponse(fabricCallBackData3, this.mUtilsJavascriptInterface.fabricGPSCallBackId, true);
return;
}
return;
default:
return;
}
} else {
if (i10 != -1 || intent == null) {
return;
}
String stringExtra = intent.getStringExtra("resultStr");
if (stringExtra != null) {
try {
asJsonObject = JsonParser.parseString(stringExtra).getAsJsonObject();
} catch (Exception unused3) {
}
}
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(asJsonObject), this.mUtilsJavascriptInterface.fabricScanCallBackId, true);
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
}
@Override
public void onDestroy() {
super.onDestroy();
this.bridgeWebView.destroy();
this.bridgeWebView = null;
this.mLottieAnimation = null;
this.moKeyDownEvent = null;
}
public void onEventMainThread(ImagePreviewEvent imagePreviewEvent) {
PhotoJavascriptInterface photoJavascriptInterface = this.mPhotoJavascriptInterface;
if (photoJavascriptInterface == null || imagePreviewEvent == null) {
return;
}
String str = photoJavascriptInterface.mPreviewImageCallbackId;
if (TextUtils.isEmpty(str)) {
return;
}
String str2 = this.mPhotoJavascriptInterface.mFabricPreviewImageOptions.urls.get(imagePreviewEvent.position).id;
if (TextUtils.isEmpty(str2)) {
str2 = "";
}
this.bridgeWebView.mBridgeHelper.sendResponse(new FabricCallBackData(str2), str, false);
}
@Override
protected void onInitParams(Bundle bundle) {
Intent intent = getIntent();
if (intent != null && intent.hasExtra(mUrlKey)) {
this.loadUrl = intent.getStringExtra(mUrlKey);
}
if (intent != null && intent.hasExtra(mTitleKey)) {
this.webTitle = intent.getStringExtra(mTitleKey);
}
if (intent != null && intent.hasExtra(mOptionsKey)) {
this.mFabricWebviewLaunchOptions = (FabricWebviewLaunchOptions) intent.getSerializableExtra(mOptionsKey);
}
this.transparentTitle = CommonUtils.hasParamByUrl(this.loadUrl, "ntv_float");
this.isNavbarHidden = CommonUtils.hasParamByUrl(this.loadUrl, "ntv_hidden");
this.webviewHistory = CommonUtils.hasParamByUrl(this.loadUrl, "ntv_history");
this.webviewIndicator = CommonUtils.hasParamByUrl(this.loadUrl, "ntv_indicator");
this.webviewNoIndicator = CommonUtils.hasParamByUrl(this.loadUrl, "ntv_noindicator");
this.loadUrl = CommonUtils.getRealUrl(this.loadUrl);
}
@Override
public void onRequestPermissionsResult(int i9, @NonNull String[] strArr, @NonNull int[] iArr) {
super.onRequestPermissionsResult(i9, strArr, iArr);
if (i9 != 2001) {
return;
}
boolean z8 = false;
for (int i10 : iArr) {
if (i10 == -1) {
z8 = true;
}
}
if (z8) {
UploadManager.instance().permissionDialog(new UploadManager.PermissionDialogCallback() {
@Override
public void onPermissionCancel() {
WebviewActivity.this.logI(LogModuleType.Permission, "相机拍照权限被拒绝[TAKE_PHOTO_PERMISSION_REQUEST_CODE]");
WebviewActivity.this.sendExceptionResponse(ErrorType.ntv_permission_reject, "相机权限被拒绝");
}
@Override
public void onPermissionSet() {
WebviewActivity.this.logI(LogModuleType.Permission, "相机拍照权限操作取消[TAKE_PHOTO_PERMISSION_REQUEST_CODE]");
WebviewActivity.this.sendExceptionResponse(ErrorType.ntv_view_window_cancelled, "操作取消");
}
});
} else {
UploadManager.instance().openCamera();
}
}
@Override
protected void onResume() {
super.onResume();
if (!this.isShowFirst) {
this.bridgeWebView.mBridgeHelper.callHandler("fabric_webview.onShow", "", null);
} else {
this.isShowFirst = false;
}
}
@Override
protected void onStop() {
super.onStop();
LottieAnimation lottieAnimation = this.mLottieAnimation;
if (lottieAnimation != null && lottieAnimation.isPlaying()) {
this.mLottieAnimation.stopAnimation();
}
this.bridgeWebView.mBridgeHelper.callHandler("fabric_webview.onHide", "", null);
if (isAppOnForeground()) {
return;
}
this.bridgeWebView.mBridgeHelper.callHandler("fabric_webview.onBackground", "", null);
}
public void processLogin(boolean z8, String str, String str2, boolean z9) {
processLogin(z8, null, str, str2, z9);
}
public void recordVideo(final int i9) {
RxPermissionsUtils.subscribe(this, new c<Boolean>() {
@Override
public void accept(Boolean bool) throws Exception {
if (bool.booleanValue()) {
Intent intent = new Intent("android.media.action.VIDEO_CAPTURE");
intent.putExtra("android.intent.extra.videoQuality", 1);
intent.putExtra("android.intent.extras.CAMERA_FACING_FRONT", 1);
intent.putExtra("android.intent.extra.durationLimit", 10);
WebviewActivity.this.startActivityForResult(intent, i9);
return;
}
WebviewActivity.this.logI(LogModuleType.Permission, "相机拍照权限被拒绝[recordVideo]");
TipsDialog.showAlert("请打开" + AppUtil.appName() + "相机权限");
}
}, PermissionConfig.Camera.CAMERA);
}
@Override
public void refreshStatuBarColor() {
if (this.transparentTitle) {
int i9 = R.color.transparent;
setStatusBarTintResource(i9, isLottieShow());
this.webviewTitleView.setBackGroundColor(AppUtil.getColor(i9));
this.webviewTitleView.setBackGroundAlpha(0);
if (this.webviewTitleView.getCenterTitleLayout().getChildCount() > 0) {
((LibImageButton) this.webviewTitleView.getCenterTitleLayout().getChildAt(0)).setTextColor(Color.parseColor("#FFFFFFFF"));
}
((LibImageButton) this.mLeftViewLayout.getChildAt(0)).getImageView().setImageResource(R.mipmap.arrow_left_white);
} else {
setStatusBarTintResource(R.color.transparent, statusBarDark());
this.webviewTitleView.setBackGroundColor(AppUtil.getColor(R.color.white));
this.webviewTitleView.setBackGroundAlpha(255);
if (this.webviewTitleView.getCenterTitleLayout().getChildCount() > 0) {
((LibImageButton) this.webviewTitleView.getCenterTitleLayout().getChildAt(0)).setTextColor(Color.parseColor("#111B31"));
}
((LibImageButton) this.mLeftViewLayout.getChildAt(0)).getImageView().setImageResource(R.mipmap.arrow_left_black);
}
FabricToolbarNavbarOptions fabricToolbarNavbarOptions = this.mToolBarJavascriptInterface.fabricLocalOptions;
if (fabricToolbarNavbarOptions == null) {
initLeftView();
initRightView();
return;
}
refreshTitleAndStatusBar(fabricToolbarNavbarOptions);
}
public void refreshTitleAndStatusBar(FabricToolbarNavbarOptions fabricToolbarNavbarOptions) {
if (fabricToolbarNavbarOptions == null) {
return;
}
try {
this.mToolBarJavascriptInterface.initTitleLayout(fabricToolbarNavbarOptions);
this.mToolBarJavascriptInterface.initTitleLayoutLeft(this.webviewTitleView.getLeftTitleLayout(), fabricToolbarNavbarOptions.left, this.transparentTitle);
this.mToolBarJavascriptInterface.initTitleLayoutCenter(this.webviewTitleView.getCenterTitleLayout(), fabricToolbarNavbarOptions.center);
this.mToolBarJavascriptInterface.initTitleLayoutRight(this.webviewTitleView.getRightTitleLayout(), fabricToolbarNavbarOptions.right);
} catch (Exception e9) {
logSE(this.loadUrl, "设置标题栏失败[refreshTitleAndStatusBar]", e9.getMessage());
e9.printStackTrace();
}
}
@PermissionGrant(requestCode = 9)
public void selectImagePermissionBellow() {
boolean z8;
int i9;
FabricChooseImageOptions fabricChooseImageOptions = this.mPhotoJavascriptInterface.mFabricChooseImageOptions;
float f9 = 1.0f;
if (fabricChooseImageOptions != null) {
i9 = fabricChooseImageOptions.count;
CropPhotoBean cropPhotoBean = fabricChooseImageOptions.crop;
if (cropPhotoBean != null) {
f9 = cropPhotoBean.ratio;
if (f9 > 0.0f) {
z8 = true;
}
}
z8 = false;
} else {
z8 = false;
i9 = 9;
}
b.C0185b a9 = e2.b.a();
a9.i(false);
a9.g(false);
a9.e(i9);
a9.f(null);
a9.a(true);
if (z8) {
a9.c(z8);
a9.d(f9);
}
a9.h(this, 9);
}
@PermissionDenied(requestCode = 9)
public void selectImagePermissionDenied() {
logI(LogModuleType.Permission, "选择图片权限被拒绝[selectImagePermissionDenied]");
sendExceptionResponse("1", "权限拒绝");
}
@Override
protected int setContentView() {
return R.layout.activity_webview;
}
public void setMoKeyDownEvent(MoKeyDownEvent moKeyDownEvent) {
this.moKeyDownEvent = moKeyDownEvent;
}
@Override
protected void setupViews(Bundle bundle) {
if (!this.webviewNoIndicator) {
initLottieAnimation();
}
initView();
initBottomSide();
}
public void showPopueWindow() {
showPopueWindow(false);
}
@Override
protected Class<?> sysBarTineExclude() {
return getClass();
}
@PermissionGrant(requestCode = 10)
public void takeCamera() {
float f9;
CropPhotoBean cropPhotoBean;
FabricChooseImageOptions fabricChooseImageOptions = this.mPhotoJavascriptInterface.mFabricChooseImageOptions;
boolean z8 = false;
if (fabricChooseImageOptions == null || (cropPhotoBean = fabricChooseImageOptions.crop) == null) {
f9 = 1.0f;
} else {
f9 = cropPhotoBean.ratio;
if (f9 > 0.0f) {
z8 = true;
}
}
b.C0185b a9 = e2.b.a();
a9.b(true);
if (z8) {
a9.c(z8);
a9.d(f9);
}
a9.h(this, 10);
}
@PermissionDenied(requestCode = 10)
public void takeCameraDenied() {
logI(LogModuleType.Permission, "相机拍照权限被拒绝[takeCameraDenied]");
sendExceptionResponse(ErrorType.ntv_permission_reject, "相机权限被拒绝");
}
public static void launchJFWebviewActivity(Activity activity, String str, FabricWebviewLaunchOptions fabricWebviewLaunchOptions) {
if (TextUtils.isEmpty(str)) {
logSE(str, "webView跳转失败,jumpUrl为空", "");
return;
}
String string = SharedPreferencesHelper.getInstance().getString(APP_URL_SCHEME_KEY);
if (!TextUtils.isEmpty(string)) {
APP_URL_SCHEME_VALUE = string;
}
if (str.startsWith(APP_URL_SCHEME_VALUE)) {
URLBridge.withUrl(str).bridge(AppMain.getApp());
} else if (!str.startsWith("tctclient") && !str.startsWith("weixin") && !str.startsWith("alipay") && !str.startsWith("androidamap") && !str.startsWith("baidumap")) {
if (CommonUtils.hasParamByUrl(CommonUtils.parseParamToObj(str), "ntv_external_url")) {
activity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
return;
}
Intent intent = new Intent(activity, WebviewActivity.class);
if (!TextUtils.isEmpty(str)) {
intent.putExtra(mUrlKey, str);
}
if (fabricWebviewLaunchOptions != null) {
intent.putExtra(mOptionsKey, fabricWebviewLaunchOptions);
}
activity.startActivityForResult(intent, WebConstant.OPEN_NEW_URL_REQUEST_CODE);
} else {
try {
activity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
} catch (Exception e9) {
if (str.startsWith("weixin")) {
TipsDialog.showAlert("您没有安装微信,请先安装");
} else if (str.startsWith("alipay")) {
TipsDialog.showAlert("您没有安装支付宝,请先安装");
} else if (str.startsWith("androidamap")) {
TipsDialog.showAlert("您没有安装高德地图,请先安装");
} else if (str.startsWith("baidumap")) {
TipsDialog.showAlert("您没有安装百度地图,请先安装");
} else {
logSE(str, "跳转三方应用失败", e9.getMessage());
e9.printStackTrace();
}
}
}
}
public void sendExceptionResponse(String str, String str2) {
PhotoJavascriptInterface photoJavascriptInterface = this.mPhotoJavascriptInterface;
if (photoJavascriptInterface != null) {
String str3 = photoJavascriptInterface.mChooseImageCallbackId;
FabricCallBackData fabricCallBackData = new FabricCallBackData("");
fabricCallBackData.code = str;
if (!TextUtils.isEmpty(str2)) {
fabricCallBackData.message = str2;
}
this.bridgeWebView.mBridgeHelper.sendResponse(fabricCallBackData, str3, true);
}
}
public void processLogin(boolean z8, HashMap<String, String> hashMap, String str, String str2, boolean z9) {
BridgeHelper bridgeHelper;
BridgeHelper bridgeHelper2;
if (z8) {
FabricLoginCallbackData fabricLoginCallbackData = new FabricLoginCallbackData();
fabricLoginCallbackData.accessToken = str;
if (hashMap == null) {
hashMap = new HashMap<>();
}
fabricLoginCallbackData.userInfo = hashMap;
BridgeWebView bridgeWebView = this.bridgeWebView;
if (bridgeWebView != null && (bridgeHelper2 = bridgeWebView.mBridgeHelper) != null) {
bridgeHelper2.sendResponse(new FabricCallBackData(fabricLoginCallbackData), this.mAuthJavascriptInterface.mLoginCallbackId, true);
}
if (!TextUtils.isEmpty(str2)) {
launchJFWebviewActivity(this, str2, null);
}
if (z9) {
finishCurrentActivity();
return;
}
return;
}
FabricLoginCallbackData fabricLoginCallbackData2 = new FabricLoginCallbackData();
fabricLoginCallbackData2.action = "cancelled";
BridgeWebView bridgeWebView2 = this.bridgeWebView;
if (bridgeWebView2 == null || (bridgeHelper = bridgeWebView2.mBridgeHelper) == null) {
return;
}
bridgeHelper.sendResponse(new FabricCallBackData(fabricLoginCallbackData2), this.mAuthJavascriptInterface.mLoginCallbackId, true);
}
public void showPopueWindow(boolean z8) {
final Dialog dialog = new Dialog(this, R.style.BottomDialog);
LayoutInflater from = LayoutInflater.from(this);
int i9 = R.layout.popupwindow_camera_need;
View inflate = !(from instanceof LayoutInflater) ? from.inflate(i9, (ViewGroup) null) : XMLParseInstrumentation.inflate(from, i9, (ViewGroup) null);
Button button = (Button) inflate.findViewById(R.id.btn_pop_cancel);
Button button2 = (Button) inflate.findViewById(R.id.btn_pop_file);
dialog.setContentView(inflate);
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
ViewGroup.LayoutParams layoutParams = inflate.getLayoutParams();
layoutParams.width = getResources().getDisplayMetrics().widthPixels;
layoutParams.height = (getResources().getDisplayMetrics().heightPixels * 1) / 3;
inflate.setLayoutParams(layoutParams);
dialog.getWindow().setGravity(80);
dialog.getWindow().setWindowAnimations(R.style.BottomDialog_Animation);
((Button) inflate.findViewById(R.id.btn_pop_album)).setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
MethodInfo.onClickEventEnter(view, WebviewActivity.class);
RxPermissionsUtils.subscribe(WebviewActivity.this, new c<Boolean>() {
@Override
public void accept(Boolean bool) throws Exception {
if (bool.booleanValue()) {
Intent intent = new Intent("android.intent.action.GET_CONTENT");
intent.addCategory("android.intent.category.OPENABLE");
intent.setType("image/*");
WebviewActivity.this.startActivityForResult(Intent.createChooser(intent, "Image Chooser"), 12);
return;
}
WebviewActivity.this.logI(LogModuleType.Permission, "存储权限被拒绝[showPopueWindow]");
TipsDialog.showAlert("请打开" + AppUtil.appName() + "存储权限");
}
}, PermissionConfig.Storage.WRITE_EXTERNAL_STORAGE, PermissionConfig.Storage.READ_EXTERNAL_STORAGE);
dialog.dismiss();
MethodInfo.onClickEventEnd();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
((Button) inflate.findViewById(R.id.btn_pop_camera)).setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
MethodInfo.onClickEventEnter(view, WebviewActivity.class);
RxPermissionsUtils.subscribe(WebviewActivity.this, new c<Boolean>() {
@Override
public void accept(Boolean bool) throws Exception {
if (bool.booleanValue()) {
WebviewActivity.this.takeCamera(13);
return;
}
WebviewActivity.this.logI(LogModuleType.Permission, "相机拍照权限被拒绝[WebViewActivity bt_camera]");
TipsDialog.showAlert("请打开" + AppUtil.appName() + "相机权限");
}
}, PermissionConfig.Camera.CAMERA);
dialog.dismiss();
MethodInfo.onClickEventEnd();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
button2.setVisibility(z8 ? 0 : 8);
button2.setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
MethodInfo.onClickEventEnter(view, WebviewActivity.class);
RxPermissionsUtils.subscribe(WebviewActivity.this, new c<Boolean>() {
@Override
public void accept(Boolean bool) throws Exception {
if (bool.booleanValue()) {
Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT");
intent.addCategory("android.intent.category.OPENABLE");
intent.setType("*/*");
WebviewActivity.this.startActivityForResult(intent, 15);
return;
}
WebviewActivity.this.logI(LogModuleType.Permission, "存储权限被拒绝[WebViewActivity bt_file]");
TipsDialog.showAlert("请打开" + AppUtil.appName() + "存储权限");
}
}, PermissionConfig.Storage.WRITE_EXTERNAL_STORAGE, PermissionConfig.Storage.READ_EXTERNAL_STORAGE);
dialog.dismiss();
MethodInfo.onClickEventEnd();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
MethodInfo.onClickEventEnter(view, WebviewActivity.class);
ValueCallback<Uri[]> valueCallback = WebviewActivity.this.mUploadCallbackAboveL;
if (valueCallback != null) {
valueCallback.onReceiveValue(null);
WebviewActivity.this.mUploadCallbackAboveL = null;
}
dialog.dismiss();
MethodInfo.onClickEventEnd();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
});
dialog.show();
}
private void registerModulePlugin() {
Map<Class<? extends BaseJavascriptInterface>, String> map = modulePlugins;
if (map == null) {
return;
}
for (Map.Entry<Class<? extends BaseJavascriptInterface>, String> entry : map.entrySet()) {
try {
this.bridgeWebView.addJavascriptInterface(entry.getKey().getConstructor(Activity.class, BridgeWebView.class).newInstance(this, this.bridgeWebView), entry.getValue());
} catch (IllegalAccessException e9) {
AppUtil.print(e9);
} catch (InstantiationException e10) {
AppUtil.print(e10);
} catch (NoSuchMethodException e11) {
AppUtil.print(e11);
} catch (InvocationTargetException e12) {
AppUtil.print(e12);
}
}
}
public void takeCamera(int i9) {
Intent intent = new Intent();
intent.setAction("android.media.action.IMAGE_CAPTURE");
intent.putExtra("orientation", 0);
startActivityForResult(intent, i9);
}
}