正在查看: 用信花 v1.1.3 应用的 WebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 用信花 v1.1.3 应用的 WebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.duoshan.loan.ui.mine.activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.text.TextUtils;
import android.view.View;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.LinearLayout;
import androidx.annotation.RequiresApi;
import androidx.viewpager.widget.PagerAdapter;
import com.duoshan.loan.a;
import com.duoshan.loan.base.BaseActivity;
import com.duoshan.loan.base.BaseViewModel;
import com.duoshan.loan.databinding.ActivityWebViewBinding;
import com.duoshan.loan.dialog.DownloadCloseDialog;
import com.duoshan.loan.dialog.DownloadDialog;
import com.duoshan.loan.ui.mine.activity.WebViewActivity;
import com.just.agentweb.AgentWeb;
import com.just.agentweb.PermissionInterceptor;
import com.just.agentweb.WebViewClient;
import com.lxj.xpopup.core.BasePopupView;
import es.voghdev.pdfviewpager.library.RemotePDFViewPager;
import es.voghdev.pdfviewpager.library.adapter.PDFPagerAdapter;
import h4.k;
import l2.h;
import m4.c;
import p.f;
import q5.a;
import t5.b;
public class WebViewActivity extends BaseActivity<ActivityWebViewBinding, BaseViewModel> implements a.a {
public RemotePDFViewPager f2872i;
public PDFPagerAdapter f2873j;
public AgentWeb f2874k;
public BasePopupView f2875l;
public String f2876m;
public String f2868e = "";
public String f2869f = "";
public String f2870g = "";
public boolean f2871h = false;
public WebViewClient f2877n = new a();
public class a extends WebViewClient {
public a() {
}
public void b() {
WebViewActivity.this.D();
}
public void onPageFinished(WebView webView, String str) {
super/*com.just.agentweb.WebViewClientDelegate*/.onPageFinished(webView, str);
}
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
}
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super/*com.just.agentweb.WebViewClientDelegate*/.onReceivedError(webView, webResourceRequest, webResourceError);
h.o("onReceivedError url=" + webResourceRequest.getUrl().toString());
if (Build.VERSION.SDK_INT >= 23) {
h.o("errorCode =" + webResourceError.getErrorCode() + ",errorDescription =" + ((Object) webResourceError.getDescription()));
}
WebViewActivity.this.startActivity(new Intent("android.intent.action.VIEW", webResourceRequest.getUrl()));
}
@RequiresApi(api = 21)
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
String uri = webResourceRequest.getUrl().toString();
h.o("shouldOverrideUrlLoading url=" + uri);
if (uri.endsWith("logo.png")) {
WebViewActivity.this.f2869f = uri;
}
if (uri.endsWith(".apk") || uri.contains(".apk")) {
WebViewActivity.this.f2870g = uri;
}
if (!TextUtils.isEmpty(WebViewActivity.this.f2870g)) {
WebViewActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
WebViewActivity.a.this.b();
}
});
}
if (!TextUtils.isEmpty(uri) && uri.contains(".pdf")) {
WebViewActivity webViewActivity = WebViewActivity.this;
e2.a.J(webViewActivity, 4, webViewActivity.f2868e, uri);
}
return super/*com.just.agentweb.WebViewClientDelegate*/.shouldInterceptRequest(webView, webResourceRequest);
}
}
public void A(View view) {
x();
}
public void B(String str, View view) {
e2.a.K(this, "人工客服", str);
finish();
}
public static boolean C(String str, String[] strArr, String str2) {
return true;
}
public final void D() {
if (this.f2875l == null) {
c.b bVar = new c.b(this);
Boolean bool = Boolean.FALSE;
this.f2875l = bVar.M(bool).L(bool).r(new DownloadDialog(this, this.f2868e, this.f2870g, this.f2869f));
}
this.f2875l.J();
}
public final void E() {
c.b bVar = new c.b(this);
Boolean bool = Boolean.FALSE;
bVar.M(bool).L(bool).r(new DownloadCloseDialog(this, this.f2868e, this.f2870g)).J();
}
public void a(int i4, int i5) {
}
public void b(String str, String str2) {
PagerAdapter pDFPagerAdapter = new PDFPagerAdapter(this, b.b(str));
this.f2873j = pDFPagerAdapter;
this.f2872i.setAdapter(pDFPagerAdapter);
setContentView((View) this.f2872i);
}
@Override
public void g() {
this.f2876m = getIntent().getStringExtra("url");
if (getIntent().getIntExtra("type", 0) == 0) {
((ActivityWebViewBinding) this.f2431a).webView.setVisibility(8);
((ActivityWebViewBinding) this.f2431a).pdfView.setVisibility(8);
((ActivityWebViewBinding) this.f2431a).llWeb.setVisibility(0);
z(this.f2876m);
return;
}
if (getIntent().getIntExtra("type", 0) == 1) {
((ActivityWebViewBinding) this.f2431a).webView.setVisibility(0);
((ActivityWebViewBinding) this.f2431a).pdfView.setVisibility(8);
((ActivityWebViewBinding) this.f2431a).llWeb.setVisibility(8);
y(this.f2876m);
return;
}
if (getIntent().getIntExtra("type", 0) == 4) {
((ActivityWebViewBinding) this.f2431a).pdfView.setVisibility(0);
((ActivityWebViewBinding) this.f2431a).webView.setVisibility(8);
((ActivityWebViewBinding) this.f2431a).llWeb.setVisibility(8);
this.f2872i = new RemotePDFViewPager(this, this.f2876m, this);
}
}
@Override
public void initView() {
String stringExtra = getIntent().getStringExtra("title");
this.f2868e = stringExtra;
((ActivityWebViewBinding) this.f2431a).titleBar.setTitle(stringExtra);
((ActivityWebViewBinding) this.f2431a).titleBar.setBackClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WebViewActivity.this.A(view);
}
});
if (!TextUtils.isEmpty(this.f2868e)) {
final String stringExtra2 = getIntent().getStringExtra("rightUrl");
if (this.f2868e.contains("客服") && !TextUtils.isEmpty(stringExtra2)) {
((ActivityWebViewBinding) this.f2431a).titleBar.setRightTitle("转人工");
((ActivityWebViewBinding) this.f2431a).titleBar.setRightClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WebViewActivity.this.B(stringExtra2, view);
}
});
}
}
this.f2871h = getIntent().getBooleanExtra("showBackDialog", false);
}
@Override
public void onBackPressed() {
x();
}
@Override
public void onDestroy() {
AgentWeb agentWeb = this.f2874k;
if (agentWeb != null) {
agentWeb.getWebLifeCycle().onDestroy();
}
super.onDestroy();
PDFPagerAdapter pDFPagerAdapter = this.f2873j;
if (pDFPagerAdapter != null) {
pDFPagerAdapter.a();
}
}
public void onFailure(Exception exc) {
k.u("数据加载失败");
}
public final void x() {
if (!TextUtils.isEmpty(this.f2870g)) {
E();
} else if (this.f2871h) {
f2.c.e(this);
} else {
finish();
}
}
public final void y(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
((ActivityWebViewBinding) this.f2431a).webView.getSettings().setJavaScriptEnabled(true);
((ActivityWebViewBinding) this.f2431a).webView.getSettings().setBuiltInZoomControls(true);
((ActivityWebViewBinding) this.f2431a).webView.getSettings().setDisplayZoomControls(false);
((ActivityWebViewBinding) this.f2431a).webView.setScrollBarStyle(0);
((ActivityWebViewBinding) this.f2431a).webView.getSettings().setDefaultTextEncodingName(f.f5036a);
((ActivityWebViewBinding) this.f2431a).webView.getSettings().setBlockNetworkImage(false);
WebSettings settings = ((ActivityWebViewBinding) this.f2431a).webView.getSettings();
((ActivityWebViewBinding) this.f2431a).webView.getSettings();
settings.setMixedContentMode(0);
((ActivityWebViewBinding) this.f2431a).webView.loadDataWithBaseURL("", str, "text/html", "utf-8", null);
}
public final void z(String str) {
if (TextUtils.isEmpty(str)) {
k.u("url链接为null");
}
AgentWeb go = AgentWeb.with(this).setAgentWebParent(((ActivityWebViewBinding) this.f2431a).llWeb, new LinearLayout.LayoutParams(-1, -1)).useDefaultIndicator(getResources().getColor(a.f.color2785FF)).setWebViewClient(this.f2877n).setPermissionInterceptor(new PermissionInterceptor() {
public final boolean intercept(String str2, String[] strArr, String str3) {
boolean C;
C = WebViewActivity.C(str2, strArr, str3);
return C;
}
}).createAgentWeb().ready().go(str);
this.f2874k = go;
WebSettings webSettings = go.getAgentWebSettings().getWebSettings();
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
}
}