正在查看: Rilo v2.0.21 应用的 ImagePickerActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 ImagePickerActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.github.drjacky.imagepicker;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.OnBackPressedDispatcher;
import androidx.activity.OnBackPressedDispatcherKt;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.LifecycleOwner;
import com.facebook.share.internal.ShareConstants;
import com.github.drjacky.imagepicker.constant.ImageProvider;
import com.github.drjacky.imagepicker.provider.CameraProvider;
import com.github.drjacky.imagepicker.provider.CompressionProvider;
import com.github.drjacky.imagepicker.provider.CropProvider;
import com.github.drjacky.imagepicker.provider.GalleryProvider;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@Metadata(d1 = {"\u0000~\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0015\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\n\u0018\u0000 @2\u00020\u0001:\u0001@B\u0005¢\u0006\u0002\u0010\u0002J\u0012\u0010\u001e\u001a\u00020\u001f2\b\u0010 \u001a\u0004\u0018\u00010!H\u0002J\u0012\u0010\"\u001a\u00020\u001f2\b\u0010 \u001a\u0004\u0018\u00010!H\u0014J+\u0010#\u001a\u00020\u001f2\u0006\u0010$\u001a\u00020\u00192\f\u0010%\u001a\b\u0012\u0004\u0012\u00020'0&2\u0006\u0010(\u001a\u00020)H\u0016¢\u0006\u0002\u0010*J\u0010\u0010+\u001a\u00020\u001f2\u0006\u0010,\u001a\u00020!H\u0016J\u0012\u0010-\u001a\u00020\u001f2\b\u0010 \u001a\u0004\u0018\u00010!H\u0002J\u000e\u0010.\u001a\u00020\u001f2\u0006\u0010/\u001a\u000200J\u000e\u00101\u001a\u00020\u001f2\u0006\u00102\u001a\u00020\nJ\u000e\u00103\u001a\u00020\u001f2\u0006\u00104\u001a\u00020'J\u0016\u00105\u001a\u00020\u001f2\u0006\u00102\u001a\u00020\n2\u0006\u00106\u001a\u000207J\u000e\u00108\u001a\u00020\u001f2\u0006\u00102\u001a\u00020\nJ\u0010\u00109\u001a\u00020\u001f2\u0006\u00102\u001a\u00020\nH\u0002J\u001e\u0010:\u001a\u00020\u001f2\u0016\u0010;\u001a\u0012\u0012\u0004\u0012\u00020\n0\tj\b\u0012\u0004\u0012\u00020\n`\u0014J \u0010<\u001a\u00020\u001f2\u0016\u0010=\u001a\u0012\u0012\u0004\u0012\u00020\n0\tj\b\u0012\u0004\u0012\u00020\n`\u0014H\u0002J\u0010\u0010>\u001a\u00020\u001f2\u0006\u00102\u001a\u00020\nH\u0002J\u0006\u0010?\u001a\u00020\u001fR\u001c\u0010\u0003\u001a\u0010\u0012\f\u0012\n \u0006*\u0004\u0018\u00010\u00050\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010\u0007\u001a\u0010\u0012\f\u0012\n \u0006*\u0004\u0018\u00010\u00050\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\b\u001a\b\u0012\u0004\u0012\u00020\n0\tX\u0082.¢\u0006\u0002\n\u0000R\u001c\u0010\u000b\u001a\u0010\u0012\f\u0012\n \u0006*\u0004\u0018\u00010\u00050\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\f\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0011X\u0082.¢\u0006\u0002\n\u0000R\u0010\u0010\u0012\u001a\u0004\u0018\u00010\nX\u0082\u000e¢\u0006\u0002\n\u0000R\"\u0010\u0013\u001a\u0016\u0012\u0004\u0012\u00020\n\u0018\u00010\tj\n\u0012\u0004\u0012\u00020\n\u0018\u0001`\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0015\u001a\u0004\u0018\u00010\u0016X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0017\u001a\u0004\u0018\u00010\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u0018\u001a\u00020\u0019X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001a\u0010\u001b\"\u0004\b\u001c\u0010\u001d¨\u0006A"}, d2 = {"Lcom/github/drjacky/imagepicker/ImagePickerActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "cameraLauncher", "Landroidx/activity/result/ActivityResultLauncher;", "Landroid/content/Intent;", "kotlin.jvm.PlatformType", "cropLauncher", "fileToCrop", "Ljava/util/ArrayList;", "Landroid/net/Uri;", "galleryLauncher", "mCameraProvider", "Lcom/github/drjacky/imagepicker/provider/CameraProvider;", "mCompressionProvider", "Lcom/github/drjacky/imagepicker/provider/CompressionProvider;", "mCropProvider", "Lcom/github/drjacky/imagepicker/provider/CropProvider;", "mCropUri", "mCroppedImageList", "Lkotlin/collections/ArrayList;", "mGalleryProvider", "Lcom/github/drjacky/imagepicker/provider/GalleryProvider;", "mImageUri", "selectedNumberOfImages", "", "getSelectedNumberOfImages", "()I", "setSelectedNumberOfImages", "(I)V", "loadBundle", "", "savedInstanceState", "Landroid/os/Bundle;", "onCreate", "onRequestPermissionsResult", "requestCode", "permissions", "", "", "grantResults", "", "(I[Ljava/lang/String;[I)V", "onSaveInstanceState", "outState", "restoreInstanceState", "setCompressedImage", "file", "Ljava/io/File;", "setCropImage", ShareConstants.MEDIA_URI, "setError", ShareConstants.WEB_DIALOG_PARAM_MESSAGE, "setImage", "isCamera", "", "setMultipleCropImage", "setMultipleCropper", "setMultipleImage", "fileList", "setMultipleImageResult", "uris", "setResult", "setResultCancel", "Companion", "imagepicker_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
public final class ImagePickerActivity extends AppCompatActivity {
public static final Companion INSTANCE = new Companion(null);
private static final String STATE_IMAGE_URI = "state.image_uri";
private static final String TAG = "image_picker";
public Map<Integer, View> _$_findViewCache = new LinkedHashMap();
private final ActivityResultLauncher<Intent> cameraLauncher;
private final ActivityResultLauncher<Intent> cropLauncher;
private ArrayList<Uri> fileToCrop;
private final ActivityResultLauncher<Intent> galleryLauncher;
private CameraProvider mCameraProvider;
private CompressionProvider mCompressionProvider;
private CropProvider mCropProvider;
private Uri mCropUri;
private ArrayList<Uri> mCroppedImageList;
private GalleryProvider mGalleryProvider;
private Uri mImageUri;
private int selectedNumberOfImages;
@Metadata(k = 3, mv = {1, 7, 1}, xi = 48)
public class WhenMappings {
public static final int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[ImageProvider.values().length];
try {
iArr[ImageProvider.GALLERY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[ImageProvider.CAMERA.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[ImageProvider.FRONT_CAMERA.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
$EnumSwitchMapping$0 = iArr;
}
}
public void _$_clearFindViewByIdCache() {
this._$_findViewCache.clear();
}
public View _$_findCachedViewById(int i) {
Map<Integer, View> map = this._$_findViewCache;
View view = map.get(Integer.valueOf(i));
if (view != null) {
return view;
}
View findViewById = findViewById(i);
if (findViewById == null) {
return null;
}
map.put(Integer.valueOf(i), findViewById);
return findViewById;
}
public ImagePickerActivity() {
ActivityResultLauncher<Intent> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
ImagePickerActivity.galleryLauncher$lambda$0(ImagePickerActivity.this, (ActivityResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul…andleResult(it)\n }");
this.galleryLauncher = registerForActivityResult;
ActivityResultLauncher<Intent> registerForActivityResult2 = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
ImagePickerActivity.cameraLauncher$lambda$1(ImagePickerActivity.this, (ActivityResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult2, "registerForActivityResul…andleResult(it)\n }");
this.cameraLauncher = registerForActivityResult2;
ActivityResultLauncher<Intent> registerForActivityResult3 = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
ImagePickerActivity.cropLauncher$lambda$2(ImagePickerActivity.this, (ActivityResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult3, "registerForActivityResul…andleResult(it)\n }");
this.cropLauncher = registerForActivityResult3;
}
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0015\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\tH\u0000¢\u0006\u0002\b\nR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u000b"}, d2 = {"Lcom/github/drjacky/imagepicker/ImagePickerActivity$Companion;", "", "()V", "STATE_IMAGE_URI", "", "TAG", "getCancelledIntent", "Landroid/content/Intent;", "context", "Landroid/content/Context;", "getCancelledIntent$imagepicker_release", "imagepicker_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final Intent getCancelledIntent$imagepicker_release(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
Intent intent = new Intent();
String string = context.getString(R.string.error_task_cancelled);
Intrinsics.checkNotNullExpressionValue(string, "context.getString(R.string.error_task_cancelled)");
intent.putExtra("extra.error", string);
return intent;
}
}
public final int getSelectedNumberOfImages() {
return this.selectedNumberOfImages;
}
public final void setSelectedNumberOfImages(int i) {
this.selectedNumberOfImages = i;
}
public static final void galleryLauncher$lambda$0(ImagePickerActivity imagePickerActivity, ActivityResult activityResult) {
Intrinsics.checkNotNullParameter(imagePickerActivity, "this$0");
GalleryProvider galleryProvider = imagePickerActivity.mGalleryProvider;
if (galleryProvider != null) {
Intrinsics.checkNotNullExpressionValue(activityResult, "it");
galleryProvider.handleResult(activityResult);
}
}
public static final void cameraLauncher$lambda$1(ImagePickerActivity imagePickerActivity, ActivityResult activityResult) {
Intrinsics.checkNotNullParameter(imagePickerActivity, "this$0");
CameraProvider cameraProvider = imagePickerActivity.mCameraProvider;
if (cameraProvider != null) {
Intrinsics.checkNotNullExpressionValue(activityResult, "it");
cameraProvider.handleResult(activityResult);
}
}
public static final void cropLauncher$lambda$2(ImagePickerActivity imagePickerActivity, ActivityResult activityResult) {
Intrinsics.checkNotNullParameter(imagePickerActivity, "this$0");
CropProvider cropProvider = imagePickerActivity.mCropProvider;
if (cropProvider == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider = null;
}
Intrinsics.checkNotNullExpressionValue(activityResult, "it");
cropProvider.handleResult(activityResult);
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
restoreInstanceState(savedInstanceState);
loadBundle(savedInstanceState);
OnBackPressedDispatcher onBackPressedDispatcher = getOnBackPressedDispatcher();
Intrinsics.checkNotNullExpressionValue(onBackPressedDispatcher, "onBackPressedDispatcher");
OnBackPressedDispatcherKt.addCallback$default(onBackPressedDispatcher, (LifecycleOwner) this, false, new Function1<OnBackPressedCallback, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((OnBackPressedCallback) obj);
return Unit.INSTANCE;
}
public final void invoke(OnBackPressedCallback onBackPressedCallback) {
Intrinsics.checkNotNullParameter(onBackPressedCallback, "$this$addCallback");
ImagePickerActivity.this.setResultCancel();
}
}, 2, (Object) null);
}
private final void restoreInstanceState(Bundle savedInstanceState) {
if (savedInstanceState != null) {
this.mImageUri = (Uri) savedInstanceState.getParcelable(STATE_IMAGE_URI);
}
}
public void onSaveInstanceState(Bundle outState) {
Intrinsics.checkNotNullParameter(outState, "outState");
outState.putParcelable(STATE_IMAGE_URI, this.mImageUri);
CameraProvider cameraProvider = this.mCameraProvider;
if (cameraProvider != null) {
cameraProvider.onSaveInstanceState(outState);
}
CropProvider cropProvider = this.mCropProvider;
if (cropProvider == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider = null;
}
cropProvider.onSaveInstanceState(outState);
super.onSaveInstanceState(outState);
}
private final void loadBundle(Bundle savedInstanceState) {
CameraProvider cameraProvider;
CameraProvider cameraProvider2;
CropProvider cropProvider = new CropProvider(this, new Function1<Intent, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Intent) obj);
return Unit.INSTANCE;
}
public final void invoke(Intent intent) {
ActivityResultLauncher activityResultLauncher;
Intrinsics.checkNotNullParameter(intent, "it");
activityResultLauncher = ImagePickerActivity.this.cropLauncher;
activityResultLauncher.launch(intent);
}
});
this.mCropProvider = cropProvider;
cropProvider.onRestoreInstanceState(savedInstanceState);
this.mCompressionProvider = new CompressionProvider(this);
this.mCroppedImageList = new ArrayList<>();
Intent intent = getIntent();
ImageProvider imageProvider = (ImageProvider) (intent != null ? intent.getSerializableExtra("extra.image_provider") : null);
int i = imageProvider == null ? -1 : WhenMappings.$EnumSwitchMapping$0[imageProvider.ordinal()];
if (i == 1) {
GalleryProvider galleryProvider = new GalleryProvider(this, new Function1<Intent, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Intent) obj);
return Unit.INSTANCE;
}
public final void invoke(Intent intent2) {
ActivityResultLauncher activityResultLauncher;
Intrinsics.checkNotNullParameter(intent2, "it");
activityResultLauncher = ImagePickerActivity.this.galleryLauncher;
activityResultLauncher.launch(intent2);
}
});
this.mGalleryProvider = galleryProvider;
if (savedInstanceState == null) {
galleryProvider.startIntent();
Unit unit = Unit.INSTANCE;
return;
}
return;
}
if (i == 2) {
CameraProvider cameraProvider3 = new CameraProvider(this, false, new Function1<Intent, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Intent) obj);
return Unit.INSTANCE;
}
public final void invoke(Intent intent2) {
ActivityResultLauncher activityResultLauncher;
Intrinsics.checkNotNullParameter(intent2, "it");
activityResultLauncher = ImagePickerActivity.this.cameraLauncher;
activityResultLauncher.launch(intent2);
}
});
this.mCameraProvider = cameraProvider3;
cameraProvider3.onRestoreInstanceState(savedInstanceState);
if (savedInstanceState != null || (cameraProvider = this.mCameraProvider) == null) {
return;
}
cameraProvider.startIntent();
Unit unit2 = Unit.INSTANCE;
return;
}
if (i == 3) {
CameraProvider cameraProvider4 = new CameraProvider(this, true, new Function1<Intent, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Intent) obj);
return Unit.INSTANCE;
}
public final void invoke(Intent intent2) {
ActivityResultLauncher activityResultLauncher;
Intrinsics.checkNotNullParameter(intent2, "it");
activityResultLauncher = ImagePickerActivity.this.cameraLauncher;
activityResultLauncher.launch(intent2);
}
});
this.mCameraProvider = cameraProvider4;
cameraProvider4.onRestoreInstanceState(savedInstanceState);
if (savedInstanceState != null || (cameraProvider2 = this.mCameraProvider) == null) {
return;
}
cameraProvider2.startIntent();
Unit unit3 = Unit.INSTANCE;
return;
}
Log.e(TAG, "Image provider can not be null");
String string = getString(R.string.error_task_cancelled);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.error_task_cancelled)");
setError(string);
}
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
Intrinsics.checkNotNullParameter(permissions, "permissions");
Intrinsics.checkNotNullParameter(grantResults, "grantResults");
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
CameraProvider cameraProvider = this.mCameraProvider;
if (cameraProvider != null) {
cameraProvider.onRequestPermissionsResult(requestCode);
}
GalleryProvider galleryProvider = this.mGalleryProvider;
if (galleryProvider != null) {
galleryProvider.onRequestPermissionsResult(requestCode);
}
}
public final void setImage(Uri uri, boolean isCamera) throws IOException {
CropProvider cropProvider;
Intrinsics.checkNotNullParameter(uri, ShareConstants.MEDIA_URI);
this.mImageUri = uri;
CropProvider cropProvider2 = this.mCropProvider;
CropProvider cropProvider3 = null;
if (cropProvider2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider2 = null;
}
if (cropProvider2.getCrop()) {
CropProvider cropProvider4 = this.mCropProvider;
if (cropProvider4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider = null;
} else {
cropProvider = cropProvider4;
}
CropProvider cropProvider5 = this.mCropProvider;
if (cropProvider5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider5 = null;
}
boolean cropOval = cropProvider5.getCropOval();
CropProvider cropProvider6 = this.mCropProvider;
if (cropProvider6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider6 = null;
}
boolean cropFreeStyle = cropProvider6.getCropFreeStyle();
CropProvider cropProvider7 = this.mCropProvider;
if (cropProvider7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
} else {
cropProvider3 = cropProvider7;
}
cropProvider.startIntent(uri, cropOval, cropFreeStyle, isCamera, false, cropProvider3.getOutputFormat());
return;
}
CompressionProvider compressionProvider = this.mCompressionProvider;
if (compressionProvider == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCompressionProvider");
compressionProvider = null;
}
if (compressionProvider.isResizeRequired(uri)) {
CompressionProvider compressionProvider2 = this.mCompressionProvider;
if (compressionProvider2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCompressionProvider");
compressionProvider2 = null;
}
CropProvider cropProvider8 = this.mCropProvider;
if (cropProvider8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
} else {
cropProvider3 = cropProvider8;
}
compressionProvider2.compress(uri, cropProvider3.getOutputFormat());
return;
}
setResult(uri);
}
public final void setMultipleImage(ArrayList<Uri> fileList) {
Intrinsics.checkNotNullParameter(fileList, "fileList");
this.fileToCrop = fileList;
if (fileList.isEmpty()) {
return;
}
Uri uri = fileList.get(0);
Intrinsics.checkNotNullExpressionValue(uri, "fileList[0]");
setMultipleCropper(uri);
try {
fileList.remove(fileList.get(0));
} catch (Exception e) {
e.printStackTrace();
}
}
private final void setMultipleCropper(Uri uri) {
CropProvider cropProvider;
this.mImageUri = uri;
CropProvider cropProvider2 = this.mCropProvider;
CropProvider cropProvider3 = null;
if (cropProvider2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider2 = null;
}
if (cropProvider2.getCrop()) {
CropProvider cropProvider4 = this.mCropProvider;
if (cropProvider4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider = null;
} else {
cropProvider = cropProvider4;
}
CropProvider cropProvider5 = this.mCropProvider;
if (cropProvider5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider5 = null;
}
boolean cropOval = cropProvider5.getCropOval();
CropProvider cropProvider6 = this.mCropProvider;
if (cropProvider6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
cropProvider6 = null;
}
boolean cropFreeStyle = cropProvider6.getCropFreeStyle();
CropProvider cropProvider7 = this.mCropProvider;
if (cropProvider7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
} else {
cropProvider3 = cropProvider7;
}
cropProvider.startIntent(uri, cropOval, cropFreeStyle, false, true, cropProvider3.getOutputFormat());
return;
}
CompressionProvider compressionProvider = this.mCompressionProvider;
if (compressionProvider == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCompressionProvider");
compressionProvider = null;
}
if (compressionProvider.isResizeRequired(uri)) {
CompressionProvider compressionProvider2 = this.mCompressionProvider;
if (compressionProvider2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCompressionProvider");
compressionProvider2 = null;
}
CropProvider cropProvider8 = this.mCropProvider;
if (cropProvider8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
} else {
cropProvider3 = cropProvider8;
}
compressionProvider2.compress(uri, cropProvider3.getOutputFormat());
}
}
public final void setCropImage(Uri uri) {
Intrinsics.checkNotNullParameter(uri, ShareConstants.MEDIA_URI);
this.mCropUri = uri;
CropProvider cropProvider = null;
if (this.mCameraProvider != null) {
uri.getPath();
this.mImageUri = null;
}
CompressionProvider compressionProvider = this.mCompressionProvider;
if (compressionProvider == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCompressionProvider");
compressionProvider = null;
}
if (compressionProvider.isResizeRequired(uri)) {
CompressionProvider compressionProvider2 = this.mCompressionProvider;
if (compressionProvider2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCompressionProvider");
compressionProvider2 = null;
}
CropProvider cropProvider2 = this.mCropProvider;
if (cropProvider2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mCropProvider");
} else {
cropProvider = cropProvider2;
}
compressionProvider2.compress(uri, cropProvider.getOutputFormat());
return;
}
setResult(uri);
}
public final void setMultipleCropImage(Uri uri) {
Intrinsics.checkNotNullParameter(uri, ShareConstants.MEDIA_URI);
ArrayList<Uri> arrayList = this.mCroppedImageList;
if (arrayList != null) {
arrayList.add(uri);
}
ArrayList<Uri> arrayList2 = this.mCroppedImageList;
boolean z = false;
if (arrayList2 != null && arrayList2.size() == this.selectedNumberOfImages) {
z = true;
}
if (z) {
ArrayList<Uri> arrayList3 = this.mCroppedImageList;
Intrinsics.checkNotNull(arrayList3);
setMultipleImageResult(arrayList3);
} else {
ArrayList<Uri> arrayList4 = this.fileToCrop;
if (arrayList4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("fileToCrop");
arrayList4 = null;
}
setMultipleImage(arrayList4);
}
}
public final void setCompressedImage(File file) {
String path;
Intrinsics.checkNotNullParameter(file, "file");
if (this.mCameraProvider != null) {
file.delete();
}
Uri uri = this.mCropUri;
if (uri != null && (path = uri.getPath()) != null) {
new File(path).delete();
}
this.mCropUri = null;
Intrinsics.checkNotNull((Object) null);
setResult(null);
}
private final void setResult(Uri uri) {
Intent intent = new Intent();
intent.setData(uri);
intent.putExtra("extra.file_path", uri.getPath());
setResult(-1, intent);
finish();
}
private final void setMultipleImageResult(ArrayList<Uri> uris) {
Intent intent = new Intent();
intent.putExtra(ImagePicker.MULTIPLE_FILES_PATH, uris);
setResult(-1, intent);
finish();
}
public final void setResultCancel() {
setResult(0, INSTANCE.getCancelledIntent$imagepicker_release((Context) this));
finish();
}
public final void setError(String message) {
Intrinsics.checkNotNullParameter(message, ShareConstants.WEB_DIALOG_PARAM_MESSAGE);
Intent intent = new Intent();
intent.putExtra("extra.error", message);
setResult(64, intent);
finish();
}
}