正在查看: 95爱播免登录版 v3.1.9 应用的 ShowWebviewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 95爱播免登录版 v3.1.9 应用的 ShowWebviewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.showself.ui;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.JavascriptInterface;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.mifeng.ui.R;
import com.showself.utils.Utils;
import com.showself.utils.o;
import java.util.List;
public class ShowWebviewActivity extends com.showself.ui.c implements View.OnClickListener {
private String a;
private String b;
private TextView c;
private WebView d;
private LinearLayout f2869e;
private Button f2870f;
private WebChromeClient f2871g = new a();
class a extends WebChromeClient {
private View a = null;
private WebChromeClient.CustomViewCallback b = null;
a() {
}
@Override
public void onHideCustomView() {
if (this.a != null) {
WebChromeClient.CustomViewCallback customViewCallback = this.b;
if (customViewCallback != null) {
customViewCallback.onCustomViewHidden();
this.b = null;
}
ViewGroup viewGroup = (ViewGroup) this.a.getParent();
viewGroup.removeView(this.a);
viewGroup.addView(ShowWebviewActivity.this.d);
this.a = null;
}
}
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
WebChromeClient.CustomViewCallback customViewCallback2 = this.b;
if (customViewCallback2 != null) {
customViewCallback2.onCustomViewHidden();
this.b = null;
return;
}
ViewGroup viewGroup = (ViewGroup) ShowWebviewActivity.this.d.getParent();
viewGroup.removeView(ShowWebviewActivity.this.d);
viewGroup.addView(view);
this.a = view;
this.b = customViewCallback;
}
}
public class b {
private Context a;
public b(Context context) {
this.a = context;
}
private boolean a() {
List<PackageInfo> installedPackages = this.a.getPackageManager().getInstalledPackages(0);
if (installedPackages != null) {
for (int i2 = 0; i2 < installedPackages.size(); i2++) {
String str = installedPackages.get(i2).packageName;
if (str.equalsIgnoreCase("com.tencent.qqlite") || str.equalsIgnoreCase("com.tencent.mobileqq")) {
return true;
}
}
}
return false;
}
private boolean b() {
try {
return 5 == ((TelephonyManager) ShowWebviewActivity.this.getSystemService("phone")).getSimState();
} catch (Exception e2) {
e2.printStackTrace();
return false;
}
}
@JavascriptInterface
public void startQQ(String str) {
String str2 = "mqqwpa://im/chat?chat_type=wpa&uin=" + str;
if (a()) {
ShowWebviewActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str2)));
} else {
Toast.makeText(this.a, "您还没有安装QQ,请先安装QQ客户端", 0).show();
}
}
@JavascriptInterface
public void startTel(String str) {
if (str == null || str.trim().length() <= 0) {
return;
}
if (!b()) {
Toast.makeText(this.a, "SIM卡不可用", 0).show();
return;
}
ShowWebviewActivity.this.startActivity(new Intent("android.intent.action.DIAL", Uri.parse(com.tencent.smtt.sdk.WebView.SCHEME_TEL + str.trim())));
}
}
public class c extends WebViewClient {
private Context a;
public c(Context context) {
this.a = context;
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
Utils.n(this.a);
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
Utils.U0(this.a);
super.onPageStarted(webView, str, bitmap);
}
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
com.p.a.b.n(0, "h5 ssl error", webView.getUrl(), "HTML_ShowWebViewActivity");
sslErrorHandler.proceed();
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
if (str.equalsIgnoreCase("yujia://webview/exit")) {
ShowWebviewActivity.this.finish();
return true;
}
if (str.contains("yujia://startPerform")) {
return true;
}
if (str.startsWith("showself")) {
Intent intent = null;
try {
intent = o.e(str, ShowWebviewActivity.this);
} catch (Exception e2) {
e2.printStackTrace();
}
if (intent != null) {
o.h(ShowWebviewActivity.this, intent);
}
return true;
}
if (str.startsWith("http:") || str.startsWith("https:")) {
webView.loadUrl(str);
return false;
}
ShowWebviewActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
return true;
}
}
@Override
@SuppressLint({"JavascriptInterface", "SetJavaScriptEnabled"})
@TargetApi(19)
public void init() {
this.a = getIntent().getStringExtra("title");
this.b = getIntent().getStringExtra("url");
TextView textView = (TextView) findViewById(R.id.tv_nav_title);
this.c = textView;
textView.setText(this.a);
this.c.setSelected(true);
this.d = new WebView(this);
this.d.setWebViewClient(new c(this));
this.d.getSettings().setPluginState(WebSettings.PluginState.ON);
this.d.getSettings().setSupportZoom(true);
this.d.getSettings().setBuiltInZoomControls(true);
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 21) {
this.d.getSettings().setMixedContentMode(0);
}
if (i2 >= 26) {
this.d.getSettings().setSafeBrowsingEnabled(false);
}
this.d.setWebChromeClient(this.f2871g);
this.d.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
this.d.getSettings().setJavaScriptEnabled(true);
this.d.addJavascriptInterface(new b(this), "mifeng");
this.d.loadUrl(this.b);
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.setting_help_html);
this.f2869e = linearLayout;
linearLayout.addView(this.d);
Button button = (Button) findViewById(R.id.btn_nav_left);
this.f2870f = button;
button.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (view.getId() != 2131296486) {
return;
}
finish();
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.htmldisplay);
init();
}
@Override
protected void onDestroy() {
this.d.removeAllViews();
this.f2869e.removeAllViews();
this.d.destroy();
this.d = null;
super.onDestroy();
CookieSyncManager.createInstance(getApplicationContext());
CookieManager.getInstance().removeAllCookie();
}
public boolean onKeyDown(int i2, KeyEvent keyEvent) {
if (i2 != 4 || !this.d.canGoBack()) {
return super/*android.app.Activity*/.onKeyDown(i2, keyEvent);
}
this.d.goBack();
return true;
}
@Override
protected void onPause() {
try {
this.d.getClass().getMethod("onPause", new Class[0]).invoke(this.d, null);
} catch (Exception e2) {
e2.printStackTrace();
}
super.onPause();
}
@Override
protected void onResume() {
try {
this.d.getClass().getMethod("onResume", new Class[0]).invoke(this.d, null);
} catch (Exception e2) {
e2.printStackTrace();
}
super.onResume();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
public void refresh(Object... objArr) {
}
}