正在查看: Hyouka private v5.8.9 应用的 CropImage.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hyouka private v5.8.9 应用的 CropImage.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.theartofdev.edmodo.cropper;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.MediaStore;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.f;
import com.theartofdev.edmodo.cropper.CropImageView;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public final class CropImage {
public static final class ActivityResult extends CropImageView.b implements Parcelable {
public static final Parcelable.Creator<ActivityResult> CREATOR = new a();
static class a implements Parcelable.Creator<ActivityResult> {
a() {
}
@Override
public ActivityResult createFromParcel(Parcel parcel) {
return new ActivityResult(parcel);
}
@Override
public ActivityResult[] newArray(int i2) {
return new ActivityResult[i2];
}
}
public ActivityResult(Uri uri, Uri uri2, Exception exc, float[] fArr, Rect rect, int i2, Rect rect2, int i3) {
super(null, uri, null, uri2, exc, fArr, rect, rect2, i2, i3);
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i2) {
parcel.writeParcelable(d(), i2);
parcel.writeParcelable(g(), i2);
parcel.writeSerializable(c());
parcel.writeFloatArray(a());
parcel.writeParcelable(b(), i2);
parcel.writeParcelable(h(), i2);
parcel.writeInt(e());
parcel.writeInt(f());
}
protected ActivityResult(Parcel parcel) {
super(null, (Uri) parcel.readParcelable(Uri.class.getClassLoader()), null, (Uri) parcel.readParcelable(Uri.class.getClassLoader()), (Exception) parcel.readSerializable(), parcel.createFloatArray(), (Rect) parcel.readParcelable(Rect.class.getClassLoader()), (Rect) parcel.readParcelable(Rect.class.getClassLoader()), parcel.readInt(), parcel.readInt());
}
}
public static final class b {
private final Uri f5936a;
private final CropImageOptions f5937b;
public Intent a(Context context) {
return b(context, CropImageActivity.class);
}
public Intent b(Context context, Class<?> cls) {
this.f5937b.a();
Intent intent = new Intent();
intent.setClass(context, cls);
Bundle bundle = new Bundle();
bundle.putParcelable("CROP_IMAGE_EXTRA_SOURCE", this.f5936a);
bundle.putParcelable("CROP_IMAGE_EXTRA_OPTIONS", this.f5937b);
intent.putExtra("CROP_IMAGE_EXTRA_BUNDLE", bundle);
return intent;
}
public void c(Activity activity) {
this.f5937b.a();
activity.startActivityForResult(a(activity), 203);
}
public void d(Context context, Fragment fragment) {
fragment.startActivityForResult(a(context), 203);
}
private b(Uri uri) {
this.f5936a = uri;
this.f5937b = new CropImageOptions();
}
}
public static b a(Uri uri) {
return new b(uri);
}
public static ActivityResult b(Intent intent) {
if (intent != null) {
return (ActivityResult) intent.getParcelableExtra("CROP_IMAGE_EXTRA_RESULT");
}
return null;
}
public static List<Intent> c(Context context, PackageManager packageManager) {
ArrayList arrayList = new ArrayList();
Uri d2 = d(context);
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(intent, 0)) {
Intent intent2 = new Intent(intent);
ActivityInfo activityInfo = resolveInfo.activityInfo;
intent2.setComponent(new ComponentName(activityInfo.packageName, activityInfo.name));
intent2.setPackage(resolveInfo.activityInfo.packageName);
if (d2 != null) {
intent2.putExtra("output", d2);
}
arrayList.add(intent2);
}
return arrayList;
}
public static Uri d(Context context) {
File externalCacheDir = context.getExternalCacheDir();
if (externalCacheDir != null) {
return Uri.fromFile(new File(externalCacheDir.getPath(), "pickImageResult.jpeg"));
}
return null;
}
public static List<Intent> e(PackageManager packageManager, String str, boolean z2) {
ArrayList arrayList = new ArrayList();
Intent intent = str == "android.intent.action.GET_CONTENT" ? new Intent(str) : new Intent(str, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(intent, 0)) {
Intent intent2 = new Intent(intent);
ActivityInfo activityInfo = resolveInfo.activityInfo;
intent2.setComponent(new ComponentName(activityInfo.packageName, activityInfo.name));
intent2.setPackage(resolveInfo.activityInfo.packageName);
arrayList.add(intent2);
}
if (!z2) {
Iterator it = arrayList.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Intent intent3 = (Intent) it.next();
if (intent3.getComponent().getClassName().equals("com.android.documentsui.DocumentsActivity")) {
arrayList.remove(intent3);
break;
}
}
}
return arrayList;
}
public static Intent f(Context context) {
return g(context, context.getString(k.pick_image_intent_chooser_title), false, true);
}
public static Intent g(Context context, CharSequence charSequence, boolean z2, boolean z3) {
Intent intent;
ArrayList arrayList = new ArrayList();
PackageManager packageManager = context.getPackageManager();
if (!j(context) && z3) {
arrayList.addAll(c(context, packageManager));
}
List<Intent> e2 = e(packageManager, "android.intent.action.GET_CONTENT", z2);
if (e2.size() == 0) {
e2 = e(packageManager, "android.intent.action.PICK", z2);
}
arrayList.addAll(e2);
if (arrayList.isEmpty()) {
intent = new Intent();
} else {
intent = (Intent) arrayList.get(arrayList.size() - 1);
arrayList.remove(arrayList.size() - 1);
}
Intent createChooser = Intent.createChooser(intent, charSequence);
createChooser.putExtra("android.intent.extra.INITIAL_INTENTS", (Parcelable[]) arrayList.toArray(new Parcelable[arrayList.size()]));
return createChooser;
}
public static Uri h(Context context, Intent intent) {
String action;
boolean z2 = true;
if (intent != null && intent.getData() != null && ((action = intent.getAction()) == null || !action.equals("android.media.action.IMAGE_CAPTURE"))) {
z2 = false;
}
return (z2 || intent.getData() == null) ? d(context) : intent.getData();
}
public static boolean i(Context context, String str) {
try {
String[] strArr = context.getPackageManager().getPackageInfo(context.getPackageName(), 4096).requestedPermissions;
if (strArr != null && strArr.length > 0) {
for (String str2 : strArr) {
if (str2.equalsIgnoreCase(str)) {
return true;
}
}
}
} catch (PackageManager.NameNotFoundException unused) {
}
return false;
}
public static boolean j(Context context) {
int checkSelfPermission;
if (Build.VERSION.SDK_INT >= 23 && i(context, "android.permission.CAMERA")) {
checkSelfPermission = context.checkSelfPermission("android.permission.CAMERA");
if (checkSelfPermission != 0) {
return true;
}
}
return false;
}
public static boolean k(Context context, Uri uri) {
int checkSelfPermission;
if (Build.VERSION.SDK_INT >= 23) {
checkSelfPermission = context.checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE");
if (checkSelfPermission != 0 && l(context, uri)) {
return true;
}
}
return false;
}
public static boolean l(Context context, Uri uri) {
try {
InputStream openInputStream = context.getContentResolver().openInputStream(uri);
if (openInputStream == null) {
return false;
}
openInputStream.close();
return false;
} catch (Exception unused) {
return true;
}
}
public static void m(Activity activity) {
activity.startActivityForResult(f(activity), f.e.DEFAULT_DRAG_ANIMATION_DURATION);
}
}