VMOS Pro v2.9.9版本的 MD5 值为:ef77d106fdbb0e499b9232be74ffc054
以下内容为反编译后的 BbsOutWebViewActivity.java 源代码,内容仅作参考
package com.vmos.pro.modules.bbs;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.AnimationDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.tencent.mars.xlog.Log;
import com.vmos.commonuilibrary.C1417;
import com.vmos.commonuilibrary.View$OnClickListenerC1406;
import com.vmos.pro.R;
import com.vmos.pro.activities.renderer.PagePermissionHelper;
import com.vmos.pro.modules.BaseActivity;
import com.vmos.pro.modules.bbs.BbsOutWebViewActivity;
import com.vmos.pro.modules.mydownload.MyDownloadActivity2;
import defpackage.tq0;
import java.net.URLDecoder;
public class BbsOutWebViewActivity extends BaseActivity {
public static final String f10249 = "intent.key.url";
public static final String f10250 = "intent.key.from.url";
public static final String f10251 = "intent.key.from.title";
public static final String f10252 = "intent.key.from.desc";
public static final String f10253 = "BbsOutWebViewActivity";
public tq0 f10255;
public WebView f10256;
public ImageView f10257;
public TextView f10258;
public AnimationDrawable f10259;
public boolean f10260;
public RelativeLayout f10261;
public String f10262;
public String f10263;
public String f10264;
public String f10265;
public boolean f10266;
public String f10267;
public String f10268;
public Handler f10254 = new Handler();
public String f10269 = "";
public class View$OnClickListenerC1727 implements View.OnClickListener {
public View$OnClickListenerC1727() {
}
@Override
public void onClick(View view) {
BbsOutWebViewActivity.this.finish();
}
}
public class RunnableC1728 implements Runnable {
public RunnableC1728() {
}
@Override
public void run() {
BbsOutWebViewActivity.this.finish();
}
}
public class C1729 implements tq0.InterfaceC5613 {
public final String f10275;
public class RunnableC1730 implements Runnable {
public RunnableC1730() {
}
@Override
public void run() {
BbsOutWebViewActivity.this.finish();
}
}
public class RunnableC1731 implements Runnable {
public RunnableC1731() {
}
@Override
public void run() {
BbsOutWebViewActivity.this.finish();
}
}
public C1729(String str) {
this.f10275 = str;
}
@Override
public void mo13370(tq0 tq0Var) {
s83 s83Var = new s83();
BbsOutWebViewActivity bbsOutWebViewActivity = BbsOutWebViewActivity.this;
s83Var.f33538 = bbsOutWebViewActivity.f10269;
s83Var.f33523 = this.f10275;
s83Var.f33529 = bbsOutWebViewActivity.f10263;
s83Var.f33530 = bbsOutWebViewActivity.f10264;
s83Var.f33539 = bbsOutWebViewActivity.f10265;
x65.m49793().m49801(s83Var);
C1417.m8789((FrameLayout) BbsOutWebViewActivity.this.getWindow().getDecorView(), BbsOutWebViewActivity.this.getString(R.string.my_downloaded_notify)).m8791();
tq0Var.dismiss();
if (TextUtils.equals(this.f10275, BbsOutWebViewActivity.this.f10262)) {
BbsOutWebViewActivity.this.f10257.postDelayed(new RunnableC1730(), 500L);
}
}
@Override
public void mo13371(tq0 tq0Var) {
tq0Var.dismiss();
if (TextUtils.equals(this.f10275, BbsOutWebViewActivity.this.f10262)) {
BbsOutWebViewActivity.this.f10257.postDelayed(new RunnableC1731(), 500L);
}
}
}
public class View$OnClickListenerC1732 implements View.OnClickListener {
public View$OnClickListenerC1732() {
}
@Override
public void onClick(View view) {
Intent intent = new Intent(BbsOutWebViewActivity.this, MyDownloadActivity2.class);
intent.putExtra(MyDownloadActivity2.f11030, 2);
BbsOutWebViewActivity.this.startActivity(intent);
}
}
public class C1733 extends WebChromeClient {
public C1733() {
}
@Override
public void onProgressChanged(WebView webView, int i) {
}
@Override
public void onReceivedTitle(WebView webView, String str) {
BbsOutWebViewActivity.this.f10258.setText(str);
}
}
public class C1734 implements DownloadListener {
public C1734() {
}
@Override
public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
BbsOutWebViewActivity bbsOutWebViewActivity = BbsOutWebViewActivity.this;
bbsOutWebViewActivity.f10267 = str;
bbsOutWebViewActivity.f10268 = str3;
if (bbsOutWebViewActivity.hasPermissionStorage()) {
BbsOutWebViewActivity.this.m13369(str, str3);
}
}
}
public void lambda$startDialogStoragePermission$0(View$OnClickListenerC1406 view$OnClickListenerC1406) {
if (!ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.WRITE_EXTERNAL_STORAGE")) {
new PagePermissionHelper(this).jumpPermissionPage();
} else {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 110);
}
view$OnClickListenerC1406.m8768();
}
public boolean hasPermissionStorage() {
boolean z = ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0;
if (!z) {
if (!ActivityCompat.shouldShowRequestPermissionRationale(this, "android.permission.WRITE_EXTERNAL_STORAGE")) {
startDialogStoragePermission();
} else {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 110);
}
}
return z;
}
@Override
public void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_webview);
this.f10266 = false;
this.f10255 = new tq0(this);
this.f10262 = getIntent().getStringExtra("intent.key.url");
this.f10263 = getIntent().getStringExtra("intent.key.from.url");
this.f10264 = getIntent().getStringExtra("intent.key.from.title");
this.f10265 = getIntent().getStringExtra("intent.key.from.desc");
Log.i(f10253, "onCreate rootUrl:" + this.f10262);
if (TextUtils.isEmpty(this.f10262)) {
finish();
return;
}
this.f10261 = (RelativeLayout) findViewById(R.id.rl_root);
this.f10256 = (WebView) findViewById(R.id.wv_commonWebView);
ImageView imageView = (ImageView) findViewById(R.id.iv_download);
this.f10257 = imageView;
this.f10259 = (AnimationDrawable) imageView.getDrawable();
this.f10258 = (TextView) findViewById(R.id.tv_wv_title);
this.f10257.setOnClickListener(new View$OnClickListenerC1732());
View findViewById = findViewById(R.id.iv_back);
WebSettings settings = this.f10256.getSettings();
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
settings.setJavaScriptEnabled(true);
settings.setSaveFormData(false);
settings.setSupportZoom(false);
settings.setAllowFileAccess(false);
settings.setAllowContentAccess(false);
settings.setDomStorageEnabled(true);
this.f10256.setWebChromeClient(new C1733());
this.f10256.setDownloadListener(new C1734());
this.f10256.setWebViewClient(new C1725());
findViewById.setOnClickListener(new View$OnClickListenerC1727());
mo13334();
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i == 4 && this.f10256.canGoBack()) {
this.f10256.goBack();
return true;
}
return super.onKeyDown(i, keyEvent);
}
@Override
public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
if (i == 110) {
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0) {
m13369(this.f10267, this.f10268);
} else {
finish();
}
}
}
@Override
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
if (z) {
ey4.m19871(getWindow(), true, false);
}
}
public final void startDialogStoragePermission() {
String string = getString(R.string.file_permission_name);
View$OnClickListenerC1406.m8743(this.f10256).m8756(R.mipmap.img_common_dialog_vm).m8762(ij5.m25090(String.format(getString(R.string.file_permission), string), string, bm4.m3643(R.color.common_pro_blue)), 14).m8752(getString(R.string.common_go_auth), new View$OnClickListenerC1406.InterfaceC1410() {
@Override
public final void onPositiveBtnClick(View$OnClickListenerC1406 view$OnClickListenerC1406) {
BbsOutWebViewActivity.this.lambda$startDialogStoragePermission$0(view$OnClickListenerC1406);
}
}).m8757();
}
public void m13369(String str, String str2) {
if (TextUtils.isEmpty(str)) {
return;
}
this.f10269 = "";
if (!TextUtils.isEmpty(str2)) {
String replaceFirst = str2.replaceFirst("(?i)^.*filename=\"?([^\"]+)\"?.*$", "$1");
this.f10269 = replaceFirst;
if (!TextUtils.isEmpty(replaceFirst)) {
try {
String trim = URLDecoder.decode(this.f10269, "utf-8").trim();
this.f10269 = trim;
if (trim.indexOf(";") > 0) {
String str3 = this.f10269;
this.f10269 = str3.substring(0, str3.indexOf(";"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
if (TextUtils.isEmpty(this.f10269)) {
this.f10269 = str.substring(str.lastIndexOf("/") + 1);
}
s83 s83Var = new s83();
s83Var.f33538 = this.f10269;
s83Var.f33523 = str;
s83Var.f33529 = this.f10263;
s83Var.f33530 = this.f10264;
s83Var.f33539 = this.f10265;
if (x65.m49793().m49799(s83Var)) {
C1417.m8789((FrameLayout) getWindow().getDecorView(), getString(R.string.my_downloaded_notify)).m8791();
this.f10259.stop();
this.f10259.start();
if (TextUtils.equals(str, this.f10262)) {
this.f10257.postDelayed(new RunnableC1728(), 500L);
}
} else if (this.f10255.isShowing()) {
} else {
this.f10255.m43544(new C1729(str));
this.f10255.show();
}
}
@Override
public void mo13334() {
super.mo13334();
if (this.f10266) {
return;
}
this.f10256.loadUrl(this.f10262);
}
@Override
public int mo13335() {
return R.id.ll_content;
}
public class C1725 extends WebViewClient {
public class RunnableC1726 implements Runnable {
public RunnableC1726() {
}
@Override
public void run() {
BbsOutWebViewActivity.this.hideLoading();
}
}
public C1725() {
}
@Override
public void onPageFinished(WebView webView, String str) {
Log.i(BbsOutWebViewActivity.f10253, "onPageFinished:" + str + "\n" + webView.getUrl());
super.onPageFinished(webView, str);
BbsOutWebViewActivity bbsOutWebViewActivity = BbsOutWebViewActivity.this;
if (bbsOutWebViewActivity.f10260) {
bbsOutWebViewActivity.m13344();
} else {
bbsOutWebViewActivity.f10266 = true;
webView.loadUrl("javascript:(function() { var body = document.getElementsByTagName('body');\nvar cl = document.getElementsByClassName('cl'); \nvar hot_group = document.getElementsByClassName('hot-group');\nvar forumListTab = document.getElementsByClassName('forumListTab');\nvar container = document.getElementsByClassName('container');\nvar bottom_tab = document.getElementsByClassName('bottom-tab');\ntry{\nbody[0].removeChild(cl[0]);\n}catch(err){\n}\ntry{\nbody[0].removeChild(hot_group[0]);\n}catch(err){\n}\ntry{\nbody[0].removeChild(forumListTab[0]);\n}catch(err){\n}\ntry{\nbody[0].removeChild(bottom_tab[0]);\n}catch(err){ \n}})()");
BbsOutWebViewActivity.this.m13339();
}
BbsOutWebViewActivity.this.hideLoading();
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
super.onPageStarted(webView, str, bitmap);
BbsOutWebViewActivity bbsOutWebViewActivity = BbsOutWebViewActivity.this;
bbsOutWebViewActivity.f10260 = false;
if (bbsOutWebViewActivity.f10266) {
return;
}
bbsOutWebViewActivity.m13342();
BbsOutWebViewActivity.this.f10254.postDelayed(new RunnableC1726(), 10000L);
}
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
Log.i(BbsOutWebViewActivity.f10253, "onReceivedError: s:" + str);
try {
if (TextUtils.equals(str, BbsOutWebViewActivity.this.f10262) || TextUtils.equals(str, str2)) {
BbsOutWebViewActivity.this.f10260 = true;
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
Log.i(BbsOutWebViewActivity.f10253, "onReceivedHttpError: s:");
try {
if (TextUtils.equals(webResourceRequest.getUrl().toString(), BbsOutWebViewActivity.this.f10262)) {
BbsOutWebViewActivity.this.f10260 = true;
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
Log.i(BbsOutWebViewActivity.f10253, "shouldOverrideUrlLoading:" + str + "\n" + webView.getUrl());
if (str.startsWith("")) {
return true;
}
if (str.startsWith(wy1.f40130)) {
webView.loadUrl(str);
} else {
try {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
BbsOutWebViewActivity.this.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
return true;
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super.onReceivedError(webView, webResourceRequest, webResourceError);
Log.i(BbsOutWebViewActivity.f10253, "onReceivedHttpError: s:");
try {
if (TextUtils.equals(webResourceRequest.getUrl().toString(), BbsOutWebViewActivity.this.f10262)) {
BbsOutWebViewActivity.this.f10260 = true;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}