EMOTIBOT v3.0.0版本的 MD5 值为:e78ae62c08f0ada6738206eeb97d2940
以下内容为反编译后的 x5WebViewHelper.java 源代码,内容仅作参考
package com.getmessage.module_base.web;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.util.Log;
import android.view.animation.DecelerateInterpolator;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.core.app.NotificationCompat;
import com.getmessage.module_base.R;
import com.getmessage.module_base.app.BaseApplication;
import com.getmessage.module_base.web.WebViewHelper;
import com.getmessage.module_base.web.x5WebViewHelper;
import com.tencent.smtt.export.external.interfaces.JsResult;
import com.tencent.smtt.export.external.interfaces.SslError;
import com.tencent.smtt.export.external.interfaces.SslErrorHandler;
import com.tencent.smtt.sdk.ValueCallback;
import com.tencent.smtt.sdk.WebChromeClient;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;
import p.a.y.e.a.s.e.net.a41;
import p.a.y.e.a.s.e.net.b11;
import p.a.y.e.a.s.e.net.kt2;
import p.a.y.e.a.s.e.net.ot;
import p.a.y.e.a.s.e.net.p8;
import p.a.y.e.a.s.e.net.r5;
@Keep
public class x5WebViewHelper extends WebViewClient implements a41 {
private static final String TAG = "WebViewHelper";
private int currentProgress;
private String failingUrl;
private boolean isAnimStart = false;
private boolean isNeedClearHistory = false;
private WebViewHelper.d listener;
private Context mContext;
private ProgressBar mProgressBar;
private WebView mWebView;
private TextView tvTitle;
public class a extends WebChromeClient {
public final Activity lite_do;
public a(Activity activity) {
this.lite_do = activity;
}
@Override
public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
return super.onJsAlert(webView, str, str2, jsResult);
}
@Override
public void onProgressChanged(WebView webView, int i) {
x5WebViewHelper x5webviewhelper = x5WebViewHelper.this;
x5webviewhelper.currentProgress = x5webviewhelper.mProgressBar.getProgress();
if (i < 100 || x5WebViewHelper.this.isAnimStart) {
x5WebViewHelper.this.startProgressAnimation(i);
return;
}
x5WebViewHelper.this.isAnimStart = true;
x5WebViewHelper.this.mProgressBar.setProgress(i);
x5WebViewHelper x5webviewhelper2 = x5WebViewHelper.this;
x5webviewhelper2.startDismissAnimation(x5webviewhelper2.mProgressBar.getProgress());
}
@Override
public void onReceivedIcon(WebView webView, Bitmap bitmap) {
super.onReceivedIcon(webView, bitmap);
}
@Override
public void onReceivedTitle(WebView webView, String str) {
super.onReceivedTitle(webView, str);
if (x5WebViewHelper.this.tvTitle != null) {
x5WebViewHelper.this.tvTitle.setText(str);
}
}
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
WebCameraHelper.getInstance().mUploadCallbackAboveL = valueCallback;
WebCameraHelper.getInstance().showOptions(this.lite_do);
return true;
}
@Override
public void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) {
WebCameraHelper.getInstance().mUploadMessage = valueCallback;
WebCameraHelper.getInstance().showOptions(this.lite_do);
}
}
public class b implements ValueAnimator.AnimatorUpdateListener {
public final int lite_static;
public b(int i) {
this.lite_static = i;
}
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
x5WebViewHelper.this.mProgressBar.setProgress((int) (((100 - this.lite_static) * valueAnimator.getAnimatedFraction()) + this.lite_static));
}
}
public class c extends AnimatorListenerAdapter {
public c() {
}
@Override
public void onAnimationEnd(Animator animator) {
x5WebViewHelper.this.mProgressBar.setProgress(0);
x5WebViewHelper.this.mProgressBar.setVisibility(8);
x5WebViewHelper.this.isAnimStart = false;
}
}
public x5WebViewHelper(WebView webView, ProgressBar progressBar, TextView textView, Context context) {
this.mWebView = webView;
this.mProgressBar = progressBar;
this.tvTitle = textView;
this.mContext = context;
}
public static void lite_do() {
if (WebCameraHelper.getInstance().mUploadCallbackAboveL != null) {
WebCameraHelper.getInstance().mUploadCallbackAboveL.onReceiveValue(null);
WebCameraHelper.getInstance().mUploadCallbackAboveL = null;
}
if (WebCameraHelper.getInstance().mUploadMessage != null) {
WebCameraHelper.getInstance().mUploadMessage.onReceiveValue(null);
WebCameraHelper.getInstance().mUploadMessage = null;
}
}
public void lite_for(DialogInterface dialogInterface, int i) {
this.mContext.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://d.alipay.com")));
}
public void lite_new(String str, DialogInterface dialogInterface, int i) {
try {
Toast.makeText(this.mContext, kt2.lite_goto(BaseApplication.getInstance(), R.string.do_go_other_app_hint, new Object[0]), 0).show();
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
intent.setFlags(805306368);
this.mContext.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
p8.lite_default(kt2.lite_goto(BaseApplication.getInstance(), R.string.no_other_app, new Object[0]));
}
}
public void startDismissAnimation(int i) {
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.mProgressBar, "alpha", 1.0f, 0.0f);
ofFloat.setDuration(1500L);
ofFloat.setInterpolator(new DecelerateInterpolator());
ofFloat.addUpdateListener(new b(i));
ofFloat.addListener(new c());
ofFloat.start();
}
public void startProgressAnimation(int i) {
ObjectAnimator ofInt = ObjectAnimator.ofInt(this.mProgressBar, NotificationCompat.CATEGORY_PROGRESS, this.currentProgress, i);
ofInt.setDuration(300L);
ofInt.setInterpolator(new DecelerateInterpolator());
ofInt.start();
}
@Override
public boolean canGoBack() {
return this.mWebView.canGoBack();
}
@Override
public void clearHistoryPage() {
this.isNeedClearHistory = true;
}
@Override
public void clearReceiveValue() {
WebView webView = this.mWebView;
if (webView != null) {
webView.postDelayed(new Runnable() {
@Override
public final void run() {
x5WebViewHelper.lite_do();
}
}, 1000L);
}
}
@Override
public void clearWebViewCache() {
WebView webView = this.mWebView;
if (webView != null) {
webView.clearCache(true);
}
}
@Override
public void doUpdateVisitedHistory(WebView webView, String str, boolean z) {
Log.i(TAG, "doUpdateVisitedHistory: url:" + str + ",isLoad:" + z);
if (this.isNeedClearHistory) {
webView.clearHistory();
this.isNeedClearHistory = false;
}
}
@Override
public String getUrl() {
WebView webView = this.mWebView;
return webView != null ? webView.getUrl() : "";
}
@Override
public void goBack() {
this.mWebView.goBack();
}
@Override
public void goBackIfCan() {
if (canGoBack()) {
this.mWebView.goBack();
if (this.mWebView.getOriginalUrl().contains("indexLoadError") && canGoBack()) {
this.mWebView.goBack();
}
}
}
@Override
public void initClient(Activity activity) {
WebView.setWebContentsDebuggingEnabled(false);
b11.lite_try(activity);
this.mWebView.getSettings().setMixedContentMode(0);
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
this.mWebView.getSettings().setAllowFileAccessFromFileURLs(true);
this.mWebView.getSettings().setCacheMode(-1);
this.mWebView.getSettings().setDomStorageEnabled(true);
this.mWebView.getSettings().setUseWideViewPort(true);
this.mWebView.getSettings().setLoadWithOverviewMode(true);
this.mWebView.getSettings().setBuiltInZoomControls(false);
this.mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
this.mWebView.getSettings().setGeolocationEnabled(true);
this.mWebView.getSettings().setAllowFileAccess(true);
this.mWebView.getSettings().setBlockNetworkImage(true);
this.mWebView.setWebViewClient(this);
this.mWebView.setWebChromeClient(new a(activity));
}
@Override
public void loadData(String str, String str2, String str3) {
this.mWebView.loadData(str, str2, str3);
}
@Override
public void loadUrl(String str) {
this.mWebView.loadUrl(str);
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
WebCameraHelper.getInstance().onActivityResult(i, i2, intent);
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
WebViewHelper.d dVar = this.listener;
if (dVar != null) {
dVar.lite_continue();
}
this.mWebView.getSettings().setBlockNetworkImage(false);
if (this.mWebView.getSettings().getLoadsImagesAutomatically()) {
return;
}
this.mWebView.getSettings().setLoadsImagesAutomatically(true);
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
this.mProgressBar.setVisibility(0);
this.mProgressBar.setAlpha(1.0f);
super.onPageStarted(webView, str, bitmap);
}
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
}
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
StringBuilder b2 = r5.b("onReceivedSslError sslError=");
b2.append(sslError.toString());
Log.e(TAG, b2.toString());
webView.getSettings().setMixedContentMode(0);
sslErrorHandler.proceed();
}
@Override
public void refresh() {
StringBuilder b2 = r5.b("refresh url:");
b2.append(this.mWebView.getUrl());
Log.i(TAG, b2.toString());
WebView webView = this.mWebView;
webView.loadUrl(webView.getUrl());
}
@Override
public void release() {
}
@Override
public void setListener(WebViewHelper.d dVar) {
this.listener = dVar;
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, final String str) {
Log.e(TAG, "shouldOverrideUrlLoading: " + str);
this.failingUrl = null;
if (str.startsWith("weixin://wap/pay?")) {
try {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
this.mContext.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
p8.lite_default(kt2.lite_goto(BaseApplication.getInstance(), R.string.failed_to_start_wechat, new Object[0]));
}
return true;
}
if (str.startsWith("alipays:") || str.startsWith("alipay")) {
try {
this.mContext.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
} catch (Exception unused) {
new AlertDialog.Builder(this.mContext).setMessage(kt2.lite_goto(BaseApplication.getInstance(), R.string.no_alipay_app, new Object[0])).setPositiveButton("立即安装", new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
x5WebViewHelper.this.lite_for(dialogInterface, i);
}
}).setNegativeButton("取消", (DialogInterface.OnClickListener) null).show();
}
return true;
}
if (!str.startsWith(ot.lite_do)) {
try {
new AlertDialog.Builder(this.mContext).setMessage(kt2.lite_goto(BaseApplication.getInstance(), R.string.whether_to_jump_to_other_applications, new Object[0])).setPositiveButton(kt2.lite_goto(BaseApplication.getInstance(), R.string.shi, new Object[0]), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
x5WebViewHelper.this.lite_new(str, dialogInterface, i);
}
}).setNegativeButton("取消", (DialogInterface.OnClickListener) null).show();
} catch (Exception unused2) {
p8.lite_default(kt2.lite_goto(BaseApplication.getInstance(), R.string.no_other_app, new Object[0]));
}
return true;
}
if (!str.startsWith(WebView.SCHEME_TEL)) {
return false;
}
this.mContext.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
return true;
}
}