七色猫视频 v9.9.9版本的 MD5 值为:6e3740f68cd7a75ec951b5f356e1fd2c
以下内容为反编译后的 JSWebviewActivity.java 源代码,内容仅作参考
package com.rdweb.websdk;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.alipay.sdk.widget.j;
import org.json.JSONException;
import org.json.JSONObject;
import razerdp.basepopup.BasePopupFlag;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
public class JSWebviewActivity extends JSHtml5Activity {
private static String TAG = "com.rdweb.websdk.JSWebviewActivity";
private Bitmap bitmap;
private ConstraintLayout layout;
final int REQUEST_CODE_FILE_SAVE = 1;
final int REQUEST_CODE_FILE_CAPTURE = 2;
private String downUrl = null;
public static void loadWebview(Context context, String str, String str2) {
String str3;
Intent intent = new Intent(context, JSWebviewActivity.class);
int indexOf = str.indexOf(63);
AppUtils appUtils = new AppUtils(context);
if (indexOf == -1) {
str3 = str + "?fourdeviceid=" + appUtils.getUniqueID();
} else {
str3 = str + "&fourdeviceid=" + appUtils.getUniqueID();
}
intent.putExtra(IjkMediaPlayer.OnNativeInvokeListener.ARG_URL, str3);
intent.putExtra(j.k, str2);
intent.addFlags(BasePopupFlag.OVERLAY_MASK);
context.startActivity(intent);
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_webview);
this.layout = (ConstraintLayout) findViewById(R.id.bg_content);
Log.d(TAG, "启动了");
loadWebView();
setRequestedOrientation(1);
}
@Override
public void onPause() {
super.onPause();
runOnUiThread(new Runnable() {
@Override
public void run() {
if (JSWebviewActivity.this.webView != null) {
JSWebviewActivity.this.webView.evaluateJavascript("javascript:applicationDidEnterBackground()", null);
}
}
});
}
@Override
public void onResume() {
super.onResume();
runOnUiThread(new Runnable() {
@Override
public void run() {
if (JSWebviewActivity.this.webView != null) {
JSWebviewActivity.this.webView.evaluateJavascript("javascript:applicationWillEnterForeground()", null);
}
}
});
}
@Override
public void onDestroy() {
if (this.webView != null) {
this.layout.removeAllViews();
this.webView.removeAllViews();
this.webView.destroy();
this.webView = null;
}
Log.d(TAG, "销毁了");
super.onDestroy();
}
@Override
public void onBackPressed() {
this.webView.goBack();
}
private void loadWebView() {
this.webUrl = getIntent().getStringExtra(IjkMediaPlayer.OnNativeInvokeListener.ARG_URL);
String stringExtra = getIntent().getStringExtra(j.k);
if (!TextUtils.isEmpty(stringExtra)) {
setTitle(stringExtra);
}
if (this.webView != null) {
this.webView.removeAllViews();
this.webView.destroy();
this.webView = null;
}
this.webView = new JSWebView(this, this);
this.webView.addJavascriptInterface(new JSCallAndroid(this), "android");
this.webView.setLayoutParams(new CoordinatorLayout.LayoutParams(0, 0));
this.layout.addView(this.webView);
this.webView.setOnHtml5WebViewListener(this);
this.webView.getSettings().getUserAgentString();
Utils.getUniqueID(this);
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("apiurl", this.webUrl);
jSONObject.put("origindomain", "");
jSONObject.put("deviceid", Utils.getUniqueID(this));
jSONObject.put("PUBLIC_KEY", "");
jSONObject.put("version", "App(" + Utils.getVersionCode(this) + ")Res()");
} catch (JSONException unused) {
}
jSONObject.toString();
this.webView.loadUrl(this.webUrl);
}
private void downImage(final String str) {
new Thread(new Runnable() {
@Override
public void run() {
JSWebviewActivity jSWebviewActivity = JSWebviewActivity.this;
jSWebviewActivity.bitmap = jSWebviewActivity.GetImageInputStream(str);
JSWebviewActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (JSWebviewActivity.this.bitmap != null) {
JSWebviewActivity jSWebviewActivity2 = JSWebviewActivity.this;
Bitmap bitmap = JSWebviewActivity.this.bitmap;
jSWebviewActivity2.saveImage(bitmap, System.currentTimeMillis() + "");
}
}
});
}
}).start();
}
@Override
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
String str;
super.onRequestPermissionsResult(i, strArr, iArr);
if (iArr.length != 0 && iArr[0] == 0) {
if (i == 2) {
Bitmap captureWebView = Utils.captureWebView(this.webView);
saveImage(captureWebView, System.currentTimeMillis() + "");
} else if (i == 1 && (str = this.downUrl) != null) {
downImage(str);
this.downUrl = null;
}
Toast.makeText(this, "权限开启成功", 1).show();
return;
}
Toast.makeText(this, "权限开启失败", 1).show();
}
public void openNativeWeb(final String str) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(JSWebviewActivity.this, JSGameWebviewActivity.class);
intent.putExtra("NativeWebBean", str);
JSWebviewActivity.this.startActivity(intent);
}
});
}
public void openThirdWeb(final String str) {
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
String str2 = str;
JSWebviewActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("")));
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public void saveImageUrl(String str) {
if (ContextCompat.checkSelfPermission(this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0 || ContextCompat.checkSelfPermission(this, "android.permission.READ_EXTERNAL_STORAGE") != 0) {
this.downUrl = str;
ActivityCompat.requestPermissions(this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE"}, 1);
return;
}
downImage(str);
this.downUrl = str;
}
public void captureScreen() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (ContextCompat.checkSelfPermission(JSWebviewActivity.this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0 || ContextCompat.checkSelfPermission(JSWebviewActivity.this, "android.permission.READ_EXTERNAL_STORAGE") != 0) {
ActivityCompat.requestPermissions(JSWebviewActivity.this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE"}, 2);
return;
}
Bitmap captureWebView = Utils.captureWebView(JSWebviewActivity.this.webView);
JSWebviewActivity jSWebviewActivity = JSWebviewActivity.this;
jSWebviewActivity.saveImage(captureWebView, System.currentTimeMillis() + "");
}
});
}
}