正在查看: Rilo v2.0.21 应用的 ImagePicker.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 ImagePicker.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.github.dhaval2404.imagepicker;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.facebook.share.internal.ShareConstants;
import com.github.dhaval2404.imagepicker.ImagePicker;
import com.github.dhaval2404.imagepicker.ImagePickerActivity;
import com.github.dhaval2404.imagepicker.constant.ImageProvider;
import com.github.dhaval2404.imagepicker.listener.DismissListener;
import com.github.dhaval2404.imagepicker.listener.ResultListener;
import com.github.dhaval2404.imagepicker.util.DialogHelper;
import com.github.florent37.inlineactivityresult.Result;
import com.github.florent37.inlineactivityresult.kotlin.KotlinActivityResult;
import com.github.florent37.inlineactivityresult.kotlin.Kotlin_activity_resultKt;
import com.google.android.gms.common.internal.ServiceSpecificExtraArgs;
import java.io.File;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0004\b\u0016\u0018\u0000 \u00042\u00020\u0001:\u0002\u0003\u0004B\u0005¢\u0006\u0002\u0010\u0002¨\u0006\u0005"}, d2 = {"Lcom/github/dhaval2404/imagepicker/ImagePicker;", "", "()V", "Builder", "Companion", "imagepicker_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public class ImagePicker {
public static final String ALLOW_MULTIPLE_FILES = "allow.multiple.files";
public static final Companion INSTANCE = new Companion(null);
public static final String EXTRA_CAMERA_DEVICE = "extra.camera_device";
public static final String EXTRA_CROP = "extra.crop";
public static final String EXTRA_CROP_X = "extra.crop_x";
public static final String EXTRA_CROP_Y = "extra.crop_y";
public static final String EXTRA_ERROR = "extra.error";
public static final String EXTRA_FILE_PATH = "extra.file_path";
public static final String EXTRA_IMAGE_MAX_SIZE = "extra.image_max_size";
public static final String EXTRA_IMAGE_PROVIDER = "extra.image_provider";
public static final String EXTRA_MAX_HEIGHT = "extra.max_height";
public static final String EXTRA_MAX_WIDTH = "extra.max_width";
public static final String EXTRA_MIME_TYPES = "extra.mime_types";
public static final String EXTRA_SAVE_DIRECTORY = "extra.save_directory";
public static final int REQUEST_CODE = 2404;
public static final int RESULT_ERROR = 64;
@JvmStatic
public static final String getError(Intent intent) {
return INSTANCE.getError(intent);
}
@JvmStatic
public static final Builder with(Activity activity) {
return INSTANCE.with(activity);
}
@JvmStatic
public static final Builder with(Fragment fragment) {
return INSTANCE.with(fragment);
}
@Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\r\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0012\u0010\u0014\u001a\u00020\u00042\b\u0010\u0015\u001a\u0004\u0018\u00010\u0016H\u0007J\u0010\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u001aH\u0007J\u0010\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u001b\u001a\u00020\u001cH\u0007R\u000e\u0010\u0003\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0004X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0012X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0012X\u0086T¢\u0006\u0002\n\u0000¨\u0006\u001d"}, d2 = {"Lcom/github/dhaval2404/imagepicker/ImagePicker$Companion;", "", "()V", "ALLOW_MULTIPLE_FILES", "", "EXTRA_CAMERA_DEVICE", "EXTRA_CROP", "EXTRA_CROP_X", "EXTRA_CROP_Y", "EXTRA_ERROR", "EXTRA_FILE_PATH", "EXTRA_IMAGE_MAX_SIZE", "EXTRA_IMAGE_PROVIDER", "EXTRA_MAX_HEIGHT", "EXTRA_MAX_WIDTH", "EXTRA_MIME_TYPES", "EXTRA_SAVE_DIRECTORY", "REQUEST_CODE", "", "RESULT_ERROR", "getError", ShareConstants.WEB_DIALOG_PARAM_DATA, "Landroid/content/Intent;", "with", "Lcom/github/dhaval2404/imagepicker/ImagePicker$Builder;", "activity", "Landroid/app/Activity;", "fragment", "Landroidx/fragment/app/Fragment;", "imagepicker_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
@JvmStatic
public final Builder with(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
return new Builder(activity);
}
@JvmStatic
public final Builder with(Fragment fragment) {
Intrinsics.checkNotNullParameter(fragment, "fragment");
return new Builder(fragment);
}
@JvmStatic
public final String getError(Intent data) {
String stringExtra = data != null ? data.getStringExtra("extra.error") : null;
return stringExtra != null ? stringExtra : "Unknown Error!";
}
}
@Metadata(d1 = {"\u0000\u0086\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\u0018\u00002\u00020\u0001B\u000f\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004B\r\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\u0006\u0010\u001f\u001a\u00020\u0000J\u0006\u0010 \u001a\u00020\u0000J\u000e\u0010!\u001a\u00020\u00002\u0006\u0010\u0017\u001a\u00020\u0016J\b\u0010\"\u001a\u00020#H\u0002J\u001a\u0010\"\u001a\u00020\u00142\u0012\u0010$\u001a\u000e\u0012\u0004\u0012\u00020#\u0012\u0004\u0012\u00020\u00140\u0013J\u0006\u0010\n\u001a\u00020\u0000J\u0016\u0010\n\u001a\u00020\u00002\u0006\u0010%\u001a\u00020\f2\u0006\u0010&\u001a\u00020\fJ\u0006\u0010'\u001a\u00020\u0000J\u0019\u0010(\u001a\u00020\u00002\f\u0010\u001a\u001a\b\u0012\u0004\u0012\u00020\u001c0\u001b¢\u0006\u0002\u0010)J\u0006\u0010*\u001a\u00020\u0000J\b\u0010+\u001a\u00020,H\u0002J\u0016\u0010-\u001a\u00020\u00002\u0006\u0010.\u001a\u00020\u00162\u0006\u0010/\u001a\u00020\u0016J\u000e\u00100\u001a\u00020\u00002\u0006\u0010\u0010\u001a\u00020\u0011J\u000e\u0010\u001e\u001a\u00020\u00002\u0006\u00101\u001a\u000202J\u000e\u0010\u001e\u001a\u00020\u00002\u0006\u00103\u001a\u00020\u001cJ\u0014\u00104\u001a\u00020\u00002\f\u00105\u001a\b\u0012\u0004\u0012\u00020\u001406J\u000e\u00104\u001a\u00020\u00002\u0006\u00105\u001a\u00020\u000fJ\u001a\u00107\u001a\u00020\u00002\u0012\u00108\u001a\u000e\u0012\u0004\u0012\u00020\u0011\u0012\u0004\u0012\u00020\u00140\u0013JF\u00109\u001a\u00020\u00142<\b\u0002\u0010:\u001a6\u0012\u0013\u0012\u00110\u0016¢\u0006\f\b<\u0012\b\b=\u0012\u0004\b\b(>\u0012\u0015\u0012\u0013\u0018\u00010#¢\u0006\f\b<\u0012\b\b=\u0012\u0004\b\b(?\u0012\u0004\u0012\u00020\u0014\u0018\u00010;H\u0002J\u0010\u00109\u001a\u00020\u00142\u0006\u0010@\u001a\u00020\u0016H\u0002J\u0006\u0010A\u001a\u00020\u0014JD\u0010A\u001a\u00020\u00142<\b\u0002\u0010:\u001a6\u0012\u0013\u0012\u00110\u0016¢\u0006\f\b<\u0012\b\b=\u0012\u0004\b\b(>\u0012\u0015\u0012\u0013\u0018\u00010#¢\u0006\f\b<\u0012\b\b=\u0012\u0004\b\b(?\u0012\u0004\u0012\u00020\u0014\u0018\u00010;J\u000e\u0010A\u001a\u00020\u00142\u0006\u0010@\u001a\u00020\u0016JF\u0010B\u001a\u00020\u00142<\b\u0002\u0010:\u001a6\u0012\u0013\u0012\u00110\u0016¢\u0006\f\b<\u0012\b\b=\u0012\u0004\b\b(>\u0012\u0015\u0012\u0013\u0018\u00010#¢\u0006\f\b<\u0012\b\b=\u0012\u0004\b\b(?\u0012\u0004\u0012\u00020\u0014\u0018\u00010;H\u0002J\u0010\u0010B\u001a\u00020\u00142\u0006\u0010@\u001a\u00020\u0016H\u0002R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000e\u001a\u0004\u0018\u00010\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u0012\u001a\u0010\u0012\u0004\u0012\u00020\u0011\u0012\u0004\u0012\u00020\u0014\u0018\u00010\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u0016X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u0018X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u0016X\u0082\u000e¢\u0006\u0002\n\u0000R\u0016\u0010\u001a\u001a\b\u0012\u0004\u0012\u00020\u001c0\u001bX\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u001dR\u0010\u0010\u001e\u001a\u0004\u0018\u00010\u001cX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006C"}, d2 = {"Lcom/github/dhaval2404/imagepicker/ImagePicker$Builder;", "", "fragment", "Landroidx/fragment/app/Fragment;", "(Landroidx/fragment/app/Fragment;)V", "activity", "Landroid/app/Activity;", "(Landroid/app/Activity;)V", "allowMultipleFiles", "", "crop", "cropX", "", "cropY", "dismissListener", "Lcom/github/dhaval2404/imagepicker/listener/DismissListener;", "imageProvider", "Lcom/github/dhaval2404/imagepicker/constant/ImageProvider;", "imageProviderInterceptor", "Lkotlin/Function1;", "", "maxHeight", "", "maxSize", "", "maxWidth", "mimeTypes", "", "", "[Ljava/lang/String;", "saveDir", "allowMultiple", "cameraOnly", "compress", "createIntent", "Landroid/content/Intent;", "onResult", "x", "y", "cropSquare", "galleryMimeTypes", "([Ljava/lang/String;)Lcom/github/dhaval2404/imagepicker/ImagePicker$Builder;", "galleryOnly", "getBundle", "Landroid/os/Bundle;", "maxResultSize", "width", "height", "provider", "file", "Ljava/io/File;", "path", "setDismissListener", ServiceSpecificExtraArgs.CastExtraArgs.LISTENER, "Lkotlin/Function0;", "setImageProviderInterceptor", "interceptor", "showImageProviderDialog", "completionHandler", "Lkotlin/Function2;", "Lkotlin/ParameterName;", "name", "resultCode", ShareConstants.WEB_DIALOG_PARAM_DATA, "reqCode", "start", "startActivity", "imagepicker_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class Builder {
private final Activity activity;
private boolean allowMultipleFiles;
private boolean crop;
private float cropX;
private float cropY;
private DismissListener dismissListener;
private Fragment fragment;
private ImageProvider imageProvider;
private Function1<? super ImageProvider, Unit> imageProviderInterceptor;
private int maxHeight;
private long maxSize;
private int maxWidth;
private String[] mimeTypes;
private String saveDir;
public Builder(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
this.activity = activity;
this.imageProvider = ImageProvider.BOTH;
this.mimeTypes = new String[0];
}
public Builder(androidx.fragment.app.Fragment r3) {
throw new UnsupportedOperationException("Method not decompiled: com.github.dhaval2404.imagepicker.ImagePicker.Builder.<init>(androidx.fragment.app.Fragment):void");
}
public final Builder provider(ImageProvider imageProvider) {
Intrinsics.checkNotNullParameter(imageProvider, "imageProvider");
this.imageProvider = imageProvider;
return this;
}
public final Builder cameraOnly() {
this.imageProvider = ImageProvider.CAMERA;
return this;
}
public final Builder galleryOnly() {
this.imageProvider = ImageProvider.GALLERY;
return this;
}
public final Builder allowMultiple() {
this.allowMultipleFiles = true;
return this;
}
public final Builder galleryMimeTypes(String[] mimeTypes) {
Intrinsics.checkNotNullParameter(mimeTypes, "mimeTypes");
this.mimeTypes = mimeTypes;
return this;
}
public final Builder crop(float x, float y) {
this.cropX = x;
this.cropY = y;
return crop();
}
public final Builder crop() {
this.crop = true;
return this;
}
public final Builder cropSquare() {
return crop(1.0f, 1.0f);
}
public final Builder maxResultSize(int width, int height) {
this.maxWidth = width;
this.maxHeight = height;
return this;
}
public final Builder compress(int maxSize) {
this.maxSize = maxSize * 1024;
return this;
}
public final Builder saveDir(String path) {
Intrinsics.checkNotNullParameter(path, "path");
this.saveDir = path;
return this;
}
public final Builder saveDir(File file) {
Intrinsics.checkNotNullParameter(file, "file");
this.saveDir = file.getAbsolutePath();
return this;
}
public final Builder setImageProviderInterceptor(Function1<? super ImageProvider, Unit> interceptor) {
Intrinsics.checkNotNullParameter(interceptor, "interceptor");
this.imageProviderInterceptor = interceptor;
return this;
}
public final Builder setDismissListener(DismissListener listener) {
Intrinsics.checkNotNullParameter(listener, ServiceSpecificExtraArgs.CastExtraArgs.LISTENER);
this.dismissListener = listener;
return this;
}
public final Builder setDismissListener(final Function0<Unit> listener) {
Intrinsics.checkNotNullParameter(listener, ServiceSpecificExtraArgs.CastExtraArgs.LISTENER);
this.dismissListener = new DismissListener() {
@Override
public void onDismiss() {
listener.invoke();
}
};
return this;
}
public final void start() {
start(ImagePicker.REQUEST_CODE);
}
public final void start(int reqCode) {
if (this.imageProvider == ImageProvider.BOTH) {
showImageProviderDialog(reqCode);
} else {
startActivity(reqCode);
}
}
public static void start$default(Builder builder, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
function2 = null;
}
builder.start((Function2<? super Integer, ? super Intent, Unit>) function2);
}
public final void start(Function2<? super Integer, ? super Intent, Unit> completionHandler) {
if (this.imageProvider == ImageProvider.BOTH) {
showImageProviderDialog(completionHandler);
} else {
startActivity(completionHandler);
}
}
public final Intent createIntent() {
Intent intent = new Intent(this.activity, (Class<?>) ImagePickerActivity.class);
intent.putExtras(getBundle());
return intent;
}
public final void createIntent(final Function1<? super Intent, Unit> onResult) {
Intrinsics.checkNotNullParameter(onResult, "onResult");
if (this.imageProvider == ImageProvider.BOTH) {
DialogHelper.INSTANCE.showChooseAppDialog(this.activity, new ResultListener<ImageProvider>() {
@Override
public void onResult(ImageProvider t) {
Function1 function1;
Intent createIntent;
ImageProvider imageProvider;
if (t != null) {
ImagePicker.Builder builder = ImagePicker.Builder.this;
Function1<Intent, Unit> function12 = onResult;
builder.imageProvider = t;
function1 = builder.imageProviderInterceptor;
if (function1 != null) {
imageProvider = builder.imageProvider;
function1.invoke(imageProvider);
}
createIntent = builder.createIntent();
function12.invoke(createIntent);
}
}
}, this.dismissListener);
} else {
onResult.invoke(createIntent());
}
}
private final void showImageProviderDialog(final int reqCode) {
DialogHelper.INSTANCE.showChooseAppDialog(this.activity, new ResultListener<ImageProvider>() {
@Override
public void onResult(ImageProvider t) {
Function1 function1;
ImageProvider imageProvider;
if (t != null) {
ImagePicker.Builder builder = ImagePicker.Builder.this;
int i = reqCode;
builder.imageProvider = t;
function1 = builder.imageProviderInterceptor;
if (function1 != null) {
imageProvider = builder.imageProvider;
function1.invoke(imageProvider);
}
builder.startActivity(i);
}
}
}, this.dismissListener);
}
static void showImageProviderDialog$default(Builder builder, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
function2 = null;
}
builder.showImageProviderDialog((Function2<? super Integer, ? super Intent, Unit>) function2);
}
private final void showImageProviderDialog(final Function2<? super Integer, ? super Intent, Unit> completionHandler) {
DialogHelper.INSTANCE.showChooseAppDialog(this.activity, new ResultListener<ImageProvider>() {
@Override
public void onResult(ImageProvider t) {
Activity activity;
Function1 function1;
ImageProvider imageProvider;
if (t != null) {
ImagePicker.Builder.this.imageProvider = t;
function1 = ImagePicker.Builder.this.imageProviderInterceptor;
if (function1 != null) {
imageProvider = ImagePicker.Builder.this.imageProvider;
function1.invoke(imageProvider);
}
ImagePicker.Builder.this.startActivity((Function2<? super Integer, ? super Intent, Unit>) completionHandler);
return;
}
ImagePickerActivity.Companion companion = ImagePickerActivity.INSTANCE;
activity = ImagePicker.Builder.this.activity;
Intent cancelledIntent$imagepicker_release = companion.getCancelledIntent$imagepicker_release(activity);
Function2<Integer, Intent, Unit> function2 = completionHandler;
if (function2 != null) {
function2.invoke(0, cancelledIntent$imagepicker_release);
}
}
}, this.dismissListener);
}
private final Bundle getBundle() {
Bundle bundle = new Bundle();
bundle.putSerializable("extra.image_provider", this.imageProvider);
bundle.putStringArray("extra.mime_types", this.mimeTypes);
bundle.putBoolean("extra.crop", this.crop);
bundle.putFloat("extra.crop_x", this.cropX);
bundle.putFloat("extra.crop_y", this.cropY);
bundle.putInt("extra.max_width", this.maxWidth);
bundle.putInt("extra.max_height", this.maxHeight);
bundle.putLong(ImagePicker.EXTRA_IMAGE_MAX_SIZE, this.maxSize);
bundle.putString(ImagePicker.EXTRA_SAVE_DIRECTORY, this.saveDir);
bundle.putBoolean(ImagePicker.ALLOW_MULTIPLE_FILES, this.allowMultipleFiles);
return bundle;
}
static void startActivity$default(Builder builder, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
function2 = null;
}
builder.startActivity((Function2<? super Integer, ? super Intent, Unit>) function2);
}
public final void startActivity(final Function2<? super Integer, ? super Intent, Unit> completionHandler) {
Activity activity;
KotlinActivityResult startForResult;
try {
Intent intent = new Intent(this.activity, (Class<?>) ImagePickerActivity.class);
intent.putExtras(getBundle());
Fragment fragment = this.fragment;
if (fragment == null) {
FragmentActivity fragmentActivity = this.activity;
Intrinsics.checkNotNull(fragmentActivity, "null cannot be cast to non-null type androidx.appcompat.app.AppCompatActivity");
Kotlin_activity_resultKt.startForResult(fragmentActivity, intent, (Function1<? super Result, Unit>) new Function1<Result, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Result) obj);
return Unit.INSTANCE;
}
public final void invoke(Result result) {
Intrinsics.checkNotNullParameter(result, "result");
Function2<Integer, Intent, Unit> function2 = completionHandler;
if (function2 != null) {
function2.invoke(Integer.valueOf(result.getResultCode()), result.getData());
}
}
}).onFailed(new Function1<Result, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Result) obj);
return Unit.INSTANCE;
}
public final void invoke(Result result) {
Intrinsics.checkNotNullParameter(result, "result");
Function2<Integer, Intent, Unit> function2 = completionHandler;
if (function2 != null) {
function2.invoke(Integer.valueOf(result.getResultCode()), result.getData());
}
}
});
} else if (fragment != null && (startForResult = Kotlin_activity_resultKt.startForResult(fragment, intent, new Function1<Result, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Result) obj);
return Unit.INSTANCE;
}
public final void invoke(Result result) {
Intrinsics.checkNotNullParameter(result, "result");
Function2<Integer, Intent, Unit> function2 = completionHandler;
if (function2 != null) {
function2.invoke(Integer.valueOf(result.getResultCode()), result.getData());
}
}
})) != null) {
startForResult.onFailed(new Function1<Result, Unit>() {
{
super(1);
}
public Object invoke(Object obj) {
invoke((Result) obj);
return Unit.INSTANCE;
}
public final void invoke(Result result) {
Intrinsics.checkNotNullParameter(result, "result");
Function2<Integer, Intent, Unit> function2 = completionHandler;
if (function2 != null) {
function2.invoke(Integer.valueOf(result.getResultCode()), result.getData());
}
}
});
}
} catch (Exception e) {
if (e instanceof ClassNotFoundException) {
Fragment fragment2 = this.fragment;
if (fragment2 != null) {
Intrinsics.checkNotNull(fragment2);
activity = fragment2.getContext();
} else {
activity = this.activity;
}
Toast.makeText(activity, "InlineActivityResult library not installed falling back to default method, please install it from https://github.com/florent37/InlineActivityResult if you want to get inline activity results.", 1).show();
startActivity(ImagePicker.REQUEST_CODE);
}
}
}
public final void startActivity(int reqCode) {
Intent intent = new Intent(this.activity, (Class<?>) ImagePickerActivity.class);
intent.putExtras(getBundle());
Fragment fragment = this.fragment;
if (fragment == null) {
this.activity.startActivityForResult(intent, reqCode);
} else if (fragment != null) {
fragment.startActivityForResult(intent, reqCode);
}
}
}
}