145 lines
5.3 KiB
Java
145 lines
5.3 KiB
Java
package com.ubt.jimu.shop;
|
|
|
|
import android.content.Intent;
|
|
import android.graphics.Bitmap;
|
|
import android.net.MailTo;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.view.View;
|
|
import android.webkit.WebChromeClient;
|
|
import android.webkit.WebSettings;
|
|
import android.webkit.WebView;
|
|
import android.webkit.WebViewClient;
|
|
import android.widget.ImageView;
|
|
import android.widget.ProgressBar;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.base.SuperActivity;
|
|
import com.ubt.jimu.utils.LogUtils;
|
|
|
|
@Deprecated
|
|
/* loaded from: classes2.dex */
|
|
public class WebViewActivity extends SuperActivity implements View.OnClickListener {
|
|
private String a;
|
|
private String b;
|
|
ImageView im_web_back;
|
|
ProgressBar pb_web;
|
|
RelativeLayout rl_web_error;
|
|
TextView tv_web_title;
|
|
WebView web_view;
|
|
|
|
private void D0() {
|
|
if (Build.VERSION.SDK_INT >= 11) {
|
|
this.web_view.removeJavascriptInterface("searchBoxJavaBridge_");
|
|
this.web_view.removeJavascriptInterface("accessibility");
|
|
this.web_view.removeJavascriptInterface("accessibilityTraversal");
|
|
}
|
|
WebSettings settings = this.web_view.getSettings();
|
|
settings.setJavaScriptEnabled(true);
|
|
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
|
settings.setAllowFileAccess(true);
|
|
settings.setSupportZoom(true);
|
|
settings.setCacheMode(-1);
|
|
settings.setBuiltInZoomControls(false);
|
|
settings.setLoadsImagesAutomatically(true);
|
|
settings.setDefaultTextEncodingName("UTF-8");
|
|
settings.setLoadWithOverviewMode(true);
|
|
this.web_view.setWebChromeClient(new WebChromeClient() { // from class: com.ubt.jimu.shop.WebViewActivity.1
|
|
@Override // android.webkit.WebChromeClient
|
|
public void onProgressChanged(WebView webView, int i) {
|
|
if (i == 100) {
|
|
WebViewActivity.this.pb_web.setVisibility(8);
|
|
} else {
|
|
if (WebViewActivity.this.pb_web.getVisibility() == 8) {
|
|
WebViewActivity.this.pb_web.setVisibility(0);
|
|
}
|
|
WebViewActivity.this.pb_web.setProgress(i);
|
|
}
|
|
super.onProgressChanged(webView, i);
|
|
}
|
|
|
|
@Override // android.webkit.WebChromeClient
|
|
public void onReceivedTitle(WebView webView, String str) {
|
|
super.onReceivedTitle(webView, str);
|
|
}
|
|
});
|
|
this.web_view.setWebViewClient(new WebViewClient() { // from class: com.ubt.jimu.shop.WebViewActivity.2
|
|
@Override // android.webkit.WebViewClient
|
|
public void onPageFinished(WebView webView, String str) {
|
|
super.onPageFinished(webView, str);
|
|
LogUtils.c("url:" + str);
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
|
|
super.onPageStarted(webView, str, bitmap);
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public void onReceivedError(WebView webView, int i, String str, String str2) {
|
|
super.onReceivedError(webView, i, str, str2);
|
|
LogUtils.c("errorCode:" + i);
|
|
WebViewActivity.this.E0();
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
|
|
if (str.startsWith("tel:")) {
|
|
WebViewActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
|
|
return true;
|
|
}
|
|
if (str.startsWith("mailto:")) {
|
|
MailTo.parse(str);
|
|
webView.reload();
|
|
return true;
|
|
}
|
|
webView.loadUrl(str);
|
|
LogUtils.c("url:" + str);
|
|
return true;
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void E0() {
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.SuperActivity
|
|
protected void initData() {
|
|
this.a = getIntent().getStringExtra("url");
|
|
this.b = getIntent().getStringExtra("title");
|
|
this.tv_web_title.setText(this.b + "");
|
|
this.web_view.loadUrl(this.a);
|
|
D0();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.SuperActivity
|
|
protected void initEvent() {
|
|
this.im_web_back.setOnClickListener(this);
|
|
}
|
|
|
|
@Override // com.ubt.jimu.base.SuperActivity
|
|
public View initView() {
|
|
return View.inflate(this, R.layout.activity_shop_webview, null);
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (view.getId() != R.id.im_web_back) {
|
|
return;
|
|
}
|
|
finish();
|
|
}
|
|
|
|
@Override // com.ubt.jimu.BaseActivity, com.ubt.jimu.ScreenRotationManageActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
protected void onDestroy() {
|
|
super.onDestroy();
|
|
this.web_view.getSettings().setJavaScriptEnabled(false);
|
|
this.web_view.clearHistory();
|
|
this.web_view.removeAllViews();
|
|
this.web_view.destroy();
|
|
this.web_view = null;
|
|
}
|
|
}
|