正在查看: 万能钥匙 v1.1.23 应用的 FreeCropActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 万能钥匙 v1.1.23 应用的 FreeCropActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.wifitutu.widget.imagepicker.ui;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.wifitutu.widget.imagepicker.bean.ImageItem;
import com.wifitutu.widget.simplecropview.FreeCropImageView;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import x60.f;
import x60.g;
import x60.h;
public class FreeCropActivity extends ImageBaseActivity implements View.OnClickListener {
public static ChangeQuickRedirect changeQuickRedirect;
public ArrayList<ImageItem> P;
public x60.c Q;
public FreeCropImageView R;
public String S;
public View V;
public Bitmap.CompressFormat T = Bitmap.CompressFormat.JPEG;
public Uri U = null;
public final s80.c W = new a();
public final s80.b X = new b();
public final s80.d Y = new c();
public class a implements s80.c {
public static ChangeQuickRedirect changeQuickRedirect;
public a() {
}
@Override
public void onError(Throwable th) {
}
@Override
public void onSuccess() {
}
}
public class b implements s80.b {
public static ChangeQuickRedirect changeQuickRedirect;
public b() {
}
@Override
public void a(Bitmap bitmap) {
if (PatchProxy.proxy(new Object[]{bitmap}, this, changeQuickRedirect, false, 37090, new Class[]{Bitmap.class}, Void.TYPE).isSupported) {
return;
}
FreeCropActivity.this.R.save(bitmap).b(FreeCropActivity.this.T).c(FreeCropActivity.this.R(), FreeCropActivity.this.Y);
}
@Override
public void onError(Throwable th) {
if (PatchProxy.proxy(new Object[]{th}, this, changeQuickRedirect, false, 37091, new Class[]{Throwable.class}, Void.TYPE).isSupported) {
return;
}
FreeCropActivity.this.V.setVisibility(8);
}
}
public class c implements s80.d {
public static ChangeQuickRedirect changeQuickRedirect;
public c() {
}
@Override
public void b(Uri uri) {
if (PatchProxy.proxy(new Object[]{uri}, this, changeQuickRedirect, false, 37092, new Class[]{Uri.class}, Void.TYPE).isSupported) {
return;
}
FreeCropActivity.this.V.setVisibility(8);
FreeCropActivity.this.P.remove(0);
ImageItem imageItem = new ImageItem();
imageItem.b = uri.getPath();
imageItem.c = uri;
FreeCropActivity.this.P.add(imageItem);
Intent intent = new Intent();
intent.putExtra("extra_result_items", FreeCropActivity.this.P);
FreeCropActivity.this.setResult(1004, intent);
FreeCropActivity.this.finish();
}
@Override
public void onError(Throwable th) {
if (PatchProxy.proxy(new Object[]{th}, this, changeQuickRedirect, false, 37093, new Class[]{Throwable.class}, Void.TYPE).isSupported) {
return;
}
FreeCropActivity.this.V.setVisibility(8);
}
}
public static class d {
public static final int[] a;
static {
int[] iArr = new int[Bitmap.CompressFormat.values().length];
a = iArr;
try {
iArr[Bitmap.CompressFormat.JPEG.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[Bitmap.CompressFormat.PNG.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public static Uri createNewUri(Context context, Bitmap.CompressFormat compressFormat) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{context, compressFormat}, (Object) null, changeQuickRedirect, true, 37087, new Class[]{Context.class, Bitmap.CompressFormat.class}, Uri.class);
if (proxy.isSupported) {
return (Uri) proxy.result;
}
return Uri.fromFile(new File(x60.c.l().g(context), "scv" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date(System.currentTimeMillis())) + "." + getMimeType(compressFormat)));
}
public static String getDirPath() {
File file;
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], (Object) null, changeQuickRedirect, true, 37088, new Class[0], String.class);
if (proxy.isSupported) {
return (String) proxy.result;
}
File externalStoragePublicDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
if (externalStoragePublicDirectory.canWrite()) {
file = new File(externalStoragePublicDirectory.getPath() + "/crop_pic");
} else {
file = null;
}
if (file == null) {
return "";
}
if (!file.exists()) {
file.mkdirs();
}
return file.canWrite() ? file.getPath() : "";
}
public static String getMimeType(Bitmap.CompressFormat compressFormat) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{compressFormat}, (Object) null, changeQuickRedirect, true, 37089, new Class[]{Bitmap.CompressFormat.class}, String.class);
if (proxy.isSupported) {
return (String) proxy.result;
}
t80.a.c("getMimeType CompressFormat = " + compressFormat);
return d.a[compressFormat.ordinal()] != 1 ? "png" : "jpeg";
}
public Uri R() {
PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 37086, new Class[0], Uri.class);
return proxy.isSupported ? (Uri) proxy.result : createNewUri(this, this.T);
}
@Override
public void onClick(View view) {
if (PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 37085, new Class[]{View.class}, Void.TYPE).isSupported) {
return;
}
int id = view.getId();
if (id == f.btn_back) {
setResult(0);
finish();
} else if (id == f.btn_ok) {
this.V.setVisibility(0);
this.R.crop(this.U).b(this.X);
}
}
@Override
public void onCreate(Bundle bundle) {
if (PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 37084, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
return;
}
super.onCreate(bundle);
setContentView(g.activity_image_free_crop);
this.Q = x60.c.l();
this.R = (FreeCropImageView) findViewById(f.freeCropImageView);
findViewById(f.btn_back).setOnClickListener(this);
Button button = (Button) findViewById(f.btn_ok);
button.setText(getString(h.ip_complete));
button.setOnClickListener(this);
this.V = findViewById(f.ip_rl_box);
ArrayList<ImageItem> q = this.Q.q();
this.P = q;
this.S = q.get(0).b;
this.U = Uri.fromFile(new File(this.S));
this.R.setCropMode(this.Q.n);
this.R.load(this.U).b(0.5f).c(true).a(this.W);
}
}