VMOS Pro v2.9.9版本的 MD5 值为:42f292af86d02c1a08555cf2d3982a52
以下内容为反编译后的 BbsWebViewFmt.java 源代码,内容仅作参考
package com.vmos.pro.modules.bbs;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
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.JavascriptInterface;
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 androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tencent.mars.xlog.Log;
import com.vmos.pro.R;
import com.vmos.pro.account.AccountHelper;
import com.vmos.pro.activities.login.LoginActivity;
import com.vmos.pro.bean.UserBean;
import com.vmos.pro.modules.BaseFragment;
import com.vmos.pro.modules.bbs.BbsWebViewFmt;
import com.vmos.pro.modules.bindphone.BindPhoneInputActivity;
public class BbsWebViewFmt extends BaseFragment {
public static final String f10316 = "key.arg.url";
public static final String f10317 = "BbsWebViewFmt";
public Handler f10318 = new Handler();
public WebView f10319;
public String f10320;
public boolean f10321;
public boolean f10322;
public class C1743 implements DownloadListener {
public C1743() {
}
@Override
public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
Log.i(BbsWebViewFmt.f10317, "onDownloadStart:" + str);
BbsWebViewFmt.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
}
}
public class C1744 extends WebViewClient {
public class RunnableC1745 implements Runnable {
public RunnableC1745() {
}
@Override
public void run() {
BbsWebViewFmt.this.missLoad();
}
}
public C1744() {
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
Log.i(BbsWebViewFmt.f10317, "onPageFinished:" + str);
BbsWebViewFmt bbsWebViewFmt = BbsWebViewFmt.this;
if (bbsWebViewFmt.f10322) {
bbsWebViewFmt.showNetworkErrorView();
} else {
bbsWebViewFmt.f10321 = 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}})()");
if (BbsWebViewFmt.this.m13403()) {
Log.i(BbsWebViewFmt.f10317, " Build.BRAND:" + Build.BRAND + " Build.MODE:" + Build.MODEL + " Build.VERSION.SDK_INT:" + Build.VERSION.SDK_INT);
webView.loadUrl("javascript:(function() {var metaList = document.getElementsByTagName('meta');\n\ntry{\nfor (var i = 0; i < metaList.length; i++) {\n if (metaList[i].name == 'viewport') {metaList[i].content = 'width=device-width, initial-scale=0.5, user-scalable=no, minimum-scale=0.5, maximum-scale=0.5';}}\n}catch(err){}})()");
}
BbsWebViewFmt.this.showDataView();
}
BbsWebViewFmt.this.missLoad();
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
super.onPageStarted(webView, str, bitmap);
BbsWebViewFmt bbsWebViewFmt = BbsWebViewFmt.this;
bbsWebViewFmt.f10322 = false;
if (bbsWebViewFmt.f10321) {
return;
}
bbsWebViewFmt.loading();
BbsWebViewFmt.this.f10318.postDelayed(new RunnableC1745(), 10000L);
}
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
Log.i(BbsWebViewFmt.f10317, "onReceivedError: s:" + str);
try {
if (TextUtils.equals(str, BbsWebViewFmt.this.f10320) || TextUtils.equals(BbsWebViewFmt.this.f10320, str2)) {
BbsWebViewFmt.this.f10322 = true;
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
Log.i(BbsWebViewFmt.f10317, "onReceivedHttpError: s:");
try {
if (TextUtils.equals(webResourceRequest.getUrl().toString(), BbsWebViewFmt.this.f10320)) {
BbsWebViewFmt.this.f10322 = true;
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
return super.shouldInterceptRequest(webView, str);
}
@Override
public boolean shouldOverrideKeyEvent(WebView webView, KeyEvent keyEvent) {
return super.shouldOverrideKeyEvent(webView, keyEvent);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
Log.i(BbsWebViewFmt.f10317, "shouldOverrideUrlLoading:" + str);
if (str != null && (TextUtils.equals(str, "") || TextUtils.equals(str, "") || TextUtils.equals(str, "") || str.startsWith(""))) {
webView.loadUrl(str);
return true;
}
Intent intent = new Intent(BbsWebViewFmt.this.getActivity(), BbsWebViewActivity.class);
intent.putExtra("intent.key.url", str);
intent.putExtra("intent.key.from.url", BbsWebViewFmt.this.f10320);
BbsWebViewFmt.this.startActivity(intent);
return true;
}
@Override
@Nullable
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
return super.shouldInterceptRequest(webView, webResourceRequest);
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super.onReceivedError(webView, webResourceRequest, webResourceError);
Log.i(BbsWebViewFmt.f10317, "onReceivedHttpError: s:");
try {
if (TextUtils.equals(webResourceRequest.getUrl().toString(), BbsWebViewFmt.this.f10320)) {
BbsWebViewFmt.this.f10322 = true;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class C1746 {
public Activity f10327;
public C1746(Activity activity) {
this.f10327 = activity;
}
@JavascriptInterface
public String getUserInfo() {
UserBean userConf = AccountHelper.get().getUserConf();
if (!AccountHelper.get().notLogin()) {
if (TextUtils.isEmpty(userConf.getMobilePhone())) {
final BbsWebViewFmt bbsWebViewFmt = BbsWebViewFmt.this;
bbsWebViewFmt.f10318.post(new Runnable() {
@Override
public final void run() {
BbsWebViewFmt.this.m13405();
}
});
return "";
}
return userConf.getAccessToken();
}
final BbsWebViewFmt bbsWebViewFmt2 = BbsWebViewFmt.this;
bbsWebViewFmt2.f10318.post(new Runnable() {
@Override
public final void run() {
BbsWebViewFmt.this.m13404();
}
});
return "";
}
}
public static BbsWebViewFmt m13398(String str) {
BbsWebViewFmt bbsWebViewFmt = new BbsWebViewFmt();
Bundle bundle = new Bundle();
bundle.putString(f10316, str);
bbsWebViewFmt.setArguments(bundle);
return bbsWebViewFmt;
}
@Override
public void getData() {
super.getData();
if (this.f10321) {
return;
}
this.f10319.loadUrl(this.f10320);
}
@Override
public void onActivityCreated(@Nullable Bundle bundle) {
super.onActivityCreated(bundle);
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
this.f10320 = getArguments().getString(f10316);
}
@Override
public View onCreateViewed(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
Log.d(f10317, "onCreateView mUrl:" + this.f10320);
View inflate = layoutInflater.inflate(R.layout.fmt_webview, (ViewGroup) null);
this.f10321 = false;
WebView webView = (WebView) inflate.findViewById(R.id.wv_content);
this.f10319 = webView;
webView.getSettings().setJavaScriptEnabled(true);
this.f10319.getSettings().setUseWideViewPort(true);
this.f10319.getSettings().setLoadWithOverviewMode(true);
this.f10319.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
this.f10319.getSettings().setTextZoom(100);
this.f10319.getSettings().setDomStorageEnabled(true);
this.f10319.addJavascriptInterface(new C1746(getActivity()), "vmos");
this.f10319.setInitialScale(39);
this.f10319.getSettings().setPluginState(WebSettings.PluginState.ON);
this.f10319.setScrollbarFadingEnabled(true);
this.f10319.setScrollBarStyle(0);
this.f10319.setDownloadListener(new C1743());
this.f10319.setWebViewClient(new C1744());
if (Build.VERSION.SDK_INT >= 19) {
WebView.setWebContentsDebuggingEnabled(true);
}
return inflate;
}
@Override
public void onResume() {
super.onResume();
getData();
}
public String m13401() {
return this.f10320;
}
public boolean m13402() {
return this.f10321;
}
public boolean m13403() {
return TextUtils.equals("Xiaomi", Build.BRAND);
}
public void m13404() {
Intent intent = new Intent(getActivity(), LoginActivity.class);
intent.addFlags(268435456);
startActivity(intent);
}
public void m13405() {
startActivity(new Intent(getActivity(), BindPhoneInputActivity.class));
}
}