正在查看: SpinDisplay v2.0.2.6 应用的 WebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: SpinDisplay v2.0.2.6 应用的 WebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.dmz.f20ad.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import b.b.k.l;
import b.u.y;
import butterknife.ButterKnife;
import com.dmz.f20ad.App;
import com.dmz.f20ad.activity.WebViewActivity;
import com.dmz.f20ad.model.Template;
import com.dmz.f20ad.utilities.BitmapUtils;
import com.zhihu.matisse.internal.ui.widget.CropImageView;
import com.zhihu.matisse.ui.MatisseActivity;
import d.a.a.f;
import d.e.a.g;
import d.e.a.v.s;
import d.m.a.e.a.e;
import g.a.e;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Set;
import java.util.concurrent.Callable;
import me.zhanghai.android.materialprogressbar.BuildConfig;
public class WebViewActivity extends l {
public Activity s;
public String t;
public TextView titleView;
public Template u;
public g.a.n.a v;
public String w;
public WebView webView;
public Bitmap x;
public Canvas y;
public d.e.a.a z;
public class a extends WebViewClient {
public a(WebViewActivity webViewActivity) {
}
@Override
public void onPageFinished(WebView webView, String str) {
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
}
@Override
public void onReceivedError(WebView webView, int i2, String str, String str2) {
Log.d("wyt WebViewActivity", "onReceivedError: " + str);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
webView.loadUrl(str);
return true;
}
}
public class b implements ValueCallback<String> {
public b(WebViewActivity webViewActivity) {
}
@Override
public void onReceiveValue(String str) {
}
}
public class c implements ValueCallback<String> {
public c(WebViewActivity webViewActivity) {
}
@Override
public void onReceiveValue(String str) {
}
}
public class d {
public int f3010a = 1;
public int f3011b = 1;
public class a implements Runnable {
public final int f3013b;
public a(int i2) {
this.f3013b = i2;
}
@Override
public void run() {
WebViewActivity.this.w();
Intent intent = new Intent();
intent.putExtra("frames", this.f3013b);
WebViewActivity.this.setResult(-1, intent);
WebViewActivity.this.onBackPressed();
}
}
public class b implements Runnable {
public b() {
}
@Override
public void run() {
d dVar = d.this;
WebViewActivity.this.b(dVar.f3010a, dVar.f3011b);
}
}
public class c implements Runnable {
public class a implements s.c {
public a() {
}
@Override
public void a(int i2) {
StringBuffer stringBuffer = new StringBuffer(Integer.toHexString(i2));
stringBuffer.delete(0, 2);
StringBuilder a2 = d.b.a.a.a.a("#");
a2.append(stringBuffer.toString());
String sb = a2.toString();
WebViewActivity.this.webView.loadUrl("javascript:selectColorBack('" + sb + "')");
}
}
public c() {
}
@Override
public void run() {
new s(WebViewActivity.this.s, new a(), -1).show();
}
}
public d() {
}
@JavascriptInterface
public void ClipEndResponse(int i2) {
Log.d("wyt WebViewActivity", "ClipEndResponse: " + i2);
WebViewActivity.this.runOnUiThread(new a(i2));
}
@JavascriptInterface
public void ClipResponse(int i2) {
Log.d("wyt WebViewActivity", "ClipResponse: " + i2);
WebViewActivity.this.e(i2);
}
@JavascriptInterface
public void ClipStartResponse(int i2) {
Log.d("wyt WebViewActivity", "ClipStartResponse: " + i2);
WebViewActivity webViewActivity = WebViewActivity.this;
webViewActivity.a(webViewActivity.webView);
WebViewActivity.this.e(i2);
}
@JavascriptInterface
public void SelectColor(String str) {
WebViewActivity.this.runOnUiThread(new c());
}
@JavascriptInterface
public void SelectPicture(String str) {
Log.d("wyt WebViewActivity", "SelectPicture: " + str);
this.f3010a = 1;
this.f3011b = 1;
if (str != BuildConfig.FLAVOR) {
String[] split = str.split(",");
if (split.length > 1) {
this.f3010a = Integer.parseInt(split[0]);
this.f3011b = Integer.parseInt(split[1]);
}
}
WebViewActivity.this.runOnUiThread(new b());
}
@JavascriptInterface
public void Toast(String str) {
y.d(str);
}
@JavascriptInterface
public void log(String str) {
Log.d("wyt WebViewActivity", "log: " + str);
}
}
public static void a(f fVar, d.a.a.b bVar) {
}
public static void b(Integer num) {
}
public Integer a(Bitmap bitmap, String str) {
FileOutputStream fileOutputStream;
BitmapUtils.transparent(bitmap, -16777216);
StringBuilder sb = new StringBuilder();
sb.append(this.t);
File file = new File(d.b.a.a.a.a(sb, File.separator, str));
FileOutputStream fileOutputStream2 = null;
try {
try {
try {
fileOutputStream = new FileOutputStream(file);
} catch (IOException e2) {
e = e2;
}
} catch (Throwable th) {
th = th;
fileOutputStream = fileOutputStream2;
}
} catch (IOException e3) {
e3.printStackTrace();
}
try {
if (bitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream)) {
fileOutputStream.flush();
}
fileOutputStream.close();
} catch (IOException e4) {
e = e4;
fileOutputStream2 = fileOutputStream;
e.printStackTrace();
if (fileOutputStream2 != null) {
fileOutputStream2.close();
}
return 0;
} catch (Throwable th2) {
th = th2;
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
throw th;
}
return 0;
}
public void a(final int i2, final int i3, f fVar, d.a.a.b bVar) {
this.v.c(new d.k.a.d(this).a("android.permission.WRITE_EXTERNAL_STORAGE").b(new g.a.p.b() {
@Override
public final void a(Object obj) {
WebViewActivity.this.a(i2, i3, (Boolean) obj);
}
}));
}
public void a(int i2, int i3, Boolean bool) {
if (bool.booleanValue()) {
c(i2, i3);
}
}
public void a(WebView webView) {
this.x = Bitmap.createBitmap(webView.getWidth(), webView.getWidth(), Bitmap.Config.ARGB_8888);
this.y = new Canvas(this.x);
}
public void a(Integer num) {
this.webView.loadUrl("javascript:clipImageNext()");
}
public void b(final int i2, final int i3) {
if (b.h.e.a.a(this, "android.permission.WRITE_EXTERNAL_STORAGE") == 0) {
c(i2, i3);
return;
}
f.b bVar = new f.b(this);
bVar.d(2131755232);
bVar.a(2131755233);
bVar.b(2131755075);
bVar.c(2131755081);
bVar.L = false;
bVar.M = false;
bVar.A = new f.k() {
@Override
public final void a(d.a.a.f fVar, d.a.a.b bVar2) {
WebViewActivity.this.a(i2, i3, fVar, bVar2);
}
};
bVar.B = new f.k() {
@Override
public final void a(d.a.a.f fVar, d.a.a.b bVar2) {
WebViewActivity.a(fVar, bVar2);
}
};
bVar.b();
}
@SuppressLint({"CheckResult"})
public void b(final Bitmap bitmap, final String str) {
e.a(new Callable() {
@Override
public final Object call() {
return WebViewActivity.this.a(bitmap, str);
}
}).b(g.a.s.b.b()).a(g.a.m.b.a.a()).a(new g.a.p.b() {
@Override
public final void a(Object obj) {
WebViewActivity.b((Integer) obj);
}
}, new d.e.a.r.f.a());
}
public void c(int i2, int i3) {
int d2 = y.d(this) - ((int) d.m.a.e.e.d.a(this, 50.0f));
int i4 = (i3 * d2) / i2;
if (i4 > y.b(this) - ((int) d.m.a.e.e.d.a(this, 400.0f))) {
i4 = y.b(this) - ((int) d.m.a.e.e.d.a(this, 400.0f));
d2 = (i2 * i4) / i3;
}
d.m.a.a a2 = d.m.a.a.a(this);
Set<d.m.a.b> a3 = d.m.a.b.a();
d.m.a.e.a.e eVar = e.b.f6049a;
eVar.f6035a = null;
eVar.f6036b = true;
eVar.f6037c = false;
eVar.f6038d = 2131820761;
eVar.f6039e = 0;
eVar.f6040f = false;
eVar.f6041g = 1;
eVar.f6042h = 0;
eVar.f6043i = 0;
eVar.f6044j = null;
eVar.f6045k = false;
eVar.f6047m = 3;
eVar.f6048n = 0;
eVar.o = 0.5f;
eVar.p = new d.m.a.c.b.a();
eVar.v = true;
eVar.w = false;
eVar.x = 300;
eVar.y = 300;
eVar.z = 0;
eVar.A = 0;
eVar.B = CropImageView.d.RECTANGLE;
eVar.r = false;
eVar.s = Integer.MAX_VALUE;
eVar.f6035a = a3;
eVar.f6036b = true;
eVar.f6039e = -1;
if (eVar.f6042h > 0 || eVar.f6043i > 0) {
throw new IllegalStateException("already set maxImageSelectable and maxVideoSelectable");
}
eVar.f6041g = 1;
eVar.f6040f = false;
eVar.f6037c = true;
eVar.v = true;
eVar.B = CropImageView.d.RECTANGLE;
eVar.w = true;
eVar.z = d2;
eVar.A = i4;
eVar.f6039e = 1;
eVar.p = new g();
eVar.u = 0;
Activity activity = a2.f6007a.get();
if (activity == null) {
return;
}
Intent intent = new Intent(activity, (Class<?>) MatisseActivity.class);
WeakReference<Fragment> weakReference = a2.f6008b;
Fragment fragment = weakReference != null ? weakReference.get() : null;
if (fragment != null) {
fragment.a(intent, 0);
} else {
activity.startActivityForResult(intent, 0);
}
}
public void doClick(View view) {
if (view.getId() != 2131296838) {
return;
}
x();
this.t = String.format("%s/%s", App.f2838g.d().getPath(), "tempimage");
File file = new File(this.t);
if (!file.exists()) {
file.mkdirs();
}
this.webView.evaluateJavascript("javascript:clipImageStart()", new c(this));
}
@SuppressLint({"CheckResult"})
public void e(final int i2) {
g.a.e.a(new Callable() {
@Override
public final Object call() {
return WebViewActivity.this.f(i2);
}
}).b(g.a.s.b.b()).a(g.a.m.b.a.a()).a(new g.a.p.b() {
@Override
public final void a(Object obj) {
WebViewActivity.this.a((Integer) obj);
}
}, new d.e.a.r.f.a());
}
public Integer f(int i2) {
this.webView.draw(this.y);
b(this.x.copy(Bitmap.Config.ARGB_8888, true), i2 + ".bin");
return 0;
}
@Override
public void onActivityResult(int i2, int i3, Intent intent) {
super.onActivityResult(i2, i3, intent);
if (i3 == -1 && i2 == 0) {
this.w = intent.getStringArrayListExtra("extra_result_selection_path").get(0);
this.webView.evaluateJavascript(d.b.a.a.a.a(d.b.a.a.a.a("javascript:imageBack('"), this.w, "')"), new b(this));
}
}
@Override
public void onCreate(Bundle bundle) {
TextView textView;
String name_en;
super.onCreate(bundle);
this.s = this;
this.u = (Template) getIntent().getParcelableExtra("com.dmz.f20ad.extra.TEMPLATE");
setContentView(2131492908);
ButterKnife.a(this);
this.v = new g.a.n.a();
if (App.f2838g.g()) {
textView = this.titleView;
name_en = this.u.getName();
} else {
textView = this.titleView;
name_en = this.u.getName_en();
}
textView.setText(name_en);
this.webView.setWebViewClient(new a(this));
this.webView.setBackgroundColor(0);
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setAllowFileAccess(true);
this.webView.getSettings().setAllowContentAccess(true);
this.webView.addJavascriptInterface(new d(), "androidmethod");
if (this.u.getType() == 1) {
WebView webView = this.webView;
StringBuilder a2 = d.b.a.a.a.a("file:///android_asset/");
a2.append(this.u.getDirectory());
a2.append("/");
a2.append(this.u.getUrl());
webView.loadUrl(a2.toString());
return;
}
StringBuilder a3 = d.b.a.a.a.a("file://");
a3.append(getExternalFilesDir(null).getPath());
a3.append(File.separator);
a3.append(this.u.getDirectory());
a3.append(File.separator);
a3.append(this.u.getUrl());
this.webView.loadUrl(a3.toString());
}
@Override
public void onDestroy() {
super.onDestroy();
this.v.a();
y.a(App.f2838g.getExternalCacheDir());
y.a(new File(getExternalFilesDir(null).getPath(), "Pictures"));
this.webView.destroy();
}
@Override
public void onResume() {
super.onResume();
}
public void w() {
d.e.a.a aVar = this.z;
if (aVar != null) {
aVar.dismiss();
}
}
public void x() {
if (this.z == null) {
this.z = new d.e.a.a(this, 2131492936, new int[0]);
this.z.setCancelable(false);
}
this.z.show();
}
}