正在查看: Biko v2.0.23 应用的 CropImageActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 CropImageActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.aemerse.cropper;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
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.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.BlendModeColorFilterCompat;
import androidx.core.graphics.BlendModeCompat;
import com.aemerse.cropper.CropImage;
import com.aemerse.cropper.CropImageView;
import com.aemerse.cropper.databinding.CropImageActivityBinding;
import com.aemerse.cropper.utils.GetUriForFileKt;
import java.io.File;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
@Metadata(d1 = {"\u0000\u008e\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\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\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0016\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003:\u0001@B\u0005¢\u0006\u0002\u0010\u0004J\b\u0010\u0013\u001a\u00020\u0014H\u0016J*\u0010\u0015\u001a\u00020\u00162\b\u0010\u0017\u001a\u0004\u0018\u00010\n2\u000e\u0010\u0018\u001a\n\u0018\u00010\u0019j\u0004\u0018\u0001`\u001a2\u0006\u0010\u001b\u001a\u00020\u001cH\u0016J\b\u0010\u001d\u001a\u00020\nH\u0002J\b\u0010\u001e\u001a\u00020\u0014H\u0016J\u0012\u0010\u001f\u001a\u00020\u00142\b\u0010 \u001a\u0004\u0018\u00010!H\u0016J\u0010\u0010\"\u001a\u00020#2\u0006\u0010$\u001a\u00020%H\u0016J\u0018\u0010&\u001a\u00020\u00142\u0006\u0010'\u001a\u00020\f2\u0006\u0010(\u001a\u00020)H\u0016J\u0010\u0010*\u001a\u00020#2\u0006\u0010+\u001a\u00020,H\u0016J\u0012\u0010-\u001a\u00020\u00142\b\u0010.\u001a\u0004\u0018\u00010\nH\u0014J(\u0010/\u001a\u00020\u00142\u0006\u0010'\u001a\u00020\f2\u0006\u0010\u0017\u001a\u00020\n2\u000e\u0010\u0018\u001a\n\u0018\u00010\u0019j\u0004\u0018\u0001`\u001aH\u0016J\b\u00100\u001a\u00020\u0014H\u0016J\b\u00101\u001a\u00020\u0014H\u0016J\b\u00102\u001a\u00020\u0014H\u0002J\u0010\u00103\u001a\u00020\u00142\u0006\u00104\u001a\u000205H\u0002J\u0010\u00106\u001a\u00020\u00142\u0006\u00107\u001a\u00020\u001cH\u0016J\u0010\u00108\u001a\u00020\u00142\u0006\u0010\u000b\u001a\u00020\fH\u0016J*\u00109\u001a\u00020\u00142\b\u0010\u0017\u001a\u0004\u0018\u00010\n2\u000e\u0010\u0018\u001a\n\u0018\u00010\u0019j\u0004\u0018\u0001`\u001a2\u0006\u0010\u001b\u001a\u00020\u001cH\u0016J\b\u0010:\u001a\u00020\u0014H\u0016J\u001c\u0010;\u001a\u00020\u00142\u0012\u00103\u001a\u000e\u0012\u0004\u0012\u000205\u0012\u0004\u0012\u00020\u00140<H\u0016J \u0010=\u001a\u00020\u00142\u0006\u0010$\u001a\u00020%2\u0006\u0010>\u001a\u00020\u001c2\u0006\u0010?\u001a\u00020\u001cH\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082.¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u0004\u0018\u00010\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\r\u001a\u0004\u0018\u00010\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u000e\u001a\u0010\u0012\f\u0012\n \u0011*\u0004\u0018\u00010\u00100\u00100\u000fX\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010\u0012\u001a\u0010\u0012\f\u0012\n \u0011*\u0004\u0018\u00010\n0\n0\u000fX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006A"}, d2 = {"Lcom/aemerse/cropper/CropImageActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "Lcom/aemerse/cropper/CropImageView$OnSetImageUriCompleteListener;", "Lcom/aemerse/cropper/CropImageView$OnCropImageCompleteListener;", "()V", "binding", "Lcom/aemerse/cropper/databinding/CropImageActivityBinding;", "cropImageOptions", "Lcom/aemerse/cropper/CropImageOptions;", "cropImageUri", "Landroid/net/Uri;", "cropImageView", "Lcom/aemerse/cropper/CropImageView;", "latestTmpUri", "pickImageGallery", "Landroidx/activity/result/ActivityResultLauncher;", "", "kotlin.jvm.PlatformType", "takePicture", "cropImage", "", "getResultIntent", "Landroid/content/Intent;", "uri", "error", "Ljava/lang/Exception;", "Lkotlin/Exception;", "sampleSize", "", "getTmpFileUri", "onBackPressed", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onCreateOptionsMenu", "", "menu", "Landroid/view/Menu;", "onCropImageComplete", "view", "result", "Lcom/aemerse/cropper/CropImageView$CropResult;", "onOptionsItemSelected", "item", "Landroid/view/MenuItem;", "onPickImageResult", "resultUri", "onSetImageUriComplete", "onStart", "onStop", "openCamera", "openSource", "source", "Lcom/aemerse/cropper/CropImageActivity$Source;", "rotateImage", "degrees", "setCropImageView", "setResult", "setResultCancel", "showImageSourceDialog", "Lkotlin/Function1;", "updateMenuItemIconColor", "itemId", "color", "Source", "cropper_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
public class CropImageActivity extends AppCompatActivity implements CropImageView.OnSetImageUriCompleteListener, CropImageView.OnCropImageCompleteListener {
private CropImageActivityBinding binding;
private CropImageOptions cropImageOptions;
private Uri cropImageUri;
private CropImageView cropImageView;
private Uri latestTmpUri;
private final ActivityResultLauncher<String> pickImageGallery;
private final ActivityResultLauncher<Uri> takePicture;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0004\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004¨\u0006\u0005"}, d2 = {"Lcom/aemerse/cropper/CropImageActivity$Source;", "", "(Ljava/lang/String;I)V", "CAMERA", "GALLERY", "cropper_release"}, k = 1, mv = {1, 6, 0}, xi = 48)
public enum Source {
CAMERA,
GALLERY
}
@Metadata(k = 3, mv = {1, 6, 0}, xi = 48)
public class WhenMappings {
public static final int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Source.values().length];
iArr[Source.CAMERA.ordinal()] = 1;
iArr[Source.GALLERY.ordinal()] = 2;
$EnumSwitchMapping$0 = iArr;
}
}
public CropImageActivity() {
ActivityResultLauncher<String> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.GetContent(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
CropImageActivity.m2469pickImageGallery$lambda0(CropImageActivity.this, (Uri) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul…mageResult(uri)\n }");
this.pickImageGallery = registerForActivityResult;
ActivityResultLauncher<Uri> registerForActivityResult2 = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.TakePicture(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
CropImageActivity.m2471takePicture$lambda1(CropImageActivity.this, (Boolean) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult2, "registerForActivityResul…esult(latestTmpUri)\n }");
this.takePicture = registerForActivityResult2;
}
public static final void m2469pickImageGallery$lambda0(CropImageActivity cropImageActivity, Uri uri) {
Intrinsics.checkNotNullParameter(cropImageActivity, "this$0");
cropImageActivity.onPickImageResult(uri);
}
public static final void m2471takePicture$lambda1(CropImageActivity cropImageActivity, Boolean bool) {
Intrinsics.checkNotNullParameter(cropImageActivity, "this$0");
Intrinsics.checkNotNullExpressionValue(bool, "it");
if (bool.booleanValue()) {
cropImageActivity.onPickImageResult(cropImageActivity.latestTmpUri);
}
}
public void onCreate(Bundle savedInstanceState) {
String string;
super.onCreate(savedInstanceState);
CropImageActivityBinding inflate = CropImageActivityBinding.inflate(getLayoutInflater());
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
this.binding = inflate;
CropImageOptions cropImageOptions = null;
if (inflate == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
inflate = null;
}
setContentView(inflate.getRoot());
CropImageActivityBinding cropImageActivityBinding = this.binding;
if (cropImageActivityBinding == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
cropImageActivityBinding = null;
}
CropImageView cropImageView = cropImageActivityBinding.cropImageView;
Intrinsics.checkNotNullExpressionValue(cropImageView, "binding.cropImageView");
setCropImageView(cropImageView);
Bundle bundleExtra = getIntent().getBundleExtra(CropImage.CROP_IMAGE_EXTRA_BUNDLE);
this.cropImageUri = bundleExtra == null ? null : (Uri) bundleExtra.getParcelable(CropImage.CROP_IMAGE_EXTRA_SOURCE);
CropImageOptions cropImageOptions2 = bundleExtra == null ? null : (CropImageOptions) bundleExtra.getParcelable(CropImage.CROP_IMAGE_EXTRA_OPTIONS);
if (cropImageOptions2 == null) {
cropImageOptions2 = new CropImageOptions();
}
this.cropImageOptions = cropImageOptions2;
if (savedInstanceState == null) {
Uri uri = this.cropImageUri;
if (uri == null || Intrinsics.areEqual(uri, Uri.EMPTY)) {
CropImageOptions cropImageOptions3 = this.cropImageOptions;
if (cropImageOptions3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions3 = null;
}
if (cropImageOptions3.imageSourceIncludeGallery) {
CropImageOptions cropImageOptions4 = this.cropImageOptions;
if (cropImageOptions4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions4 = null;
}
if (cropImageOptions4.imageSourceIncludeCamera) {
showImageSourceDialog(new CropImageActivity$onCreate$1(this));
}
}
CropImageOptions cropImageOptions5 = this.cropImageOptions;
if (cropImageOptions5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions5 = null;
}
if (cropImageOptions5.imageSourceIncludeGallery) {
this.pickImageGallery.launch("image/*");
} else {
CropImageOptions cropImageOptions6 = this.cropImageOptions;
if (cropImageOptions6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions6 = null;
}
if (cropImageOptions6.imageSourceIncludeCamera) {
openCamera();
} else {
finish();
}
}
} else {
CropImageView cropImageView2 = this.cropImageView;
if (cropImageView2 != null) {
cropImageView2.setImageUriAsync(this.cropImageUri);
}
}
}
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar == null) {
return;
}
CropImageOptions cropImageOptions7 = this.cropImageOptions;
if (cropImageOptions7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions7 = null;
}
if (cropImageOptions7.activityTitle.length() > 0) {
CropImageOptions cropImageOptions8 = this.cropImageOptions;
if (cropImageOptions8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
} else {
cropImageOptions = cropImageOptions8;
}
string = cropImageOptions.activityTitle;
} else {
string = getResources().getString(R.string.crop_image_activity_title);
}
setTitle(string);
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
public final void openSource(Source source) {
int i = WhenMappings.$EnumSwitchMapping$0[source.ordinal()];
if (i == 1) {
openCamera();
} else {
if (i != 2) {
return;
}
this.pickImageGallery.launch("image/*");
}
}
private final void openCamera() {
Uri tmpFileUri = getTmpFileUri();
this.latestTmpUri = tmpFileUri;
this.takePicture.launch(tmpFileUri);
}
private final Uri getTmpFileUri() {
File createTempFile = File.createTempFile("tmp_image_file", ".png", getCacheDir());
createTempFile.createNewFile();
createTempFile.deleteOnExit();
Intrinsics.checkNotNullExpressionValue(createTempFile, "tmpFile");
return GetUriForFileKt.getUriForFile((Context) this, createTempFile);
}
public void showImageSourceDialog(final Function1<? super Source, Unit> openSource) {
Intrinsics.checkNotNullParameter(openSource, "openSource");
new AlertDialog.Builder((Context) this).setTitle(R.string.pick_image_chooser_title).setItems(new String[]{getString(R.string.pick_image_camera), getString(R.string.pick_image_gallery)}, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
CropImageActivity.m2470showImageSourceDialog$lambda5(openSource, dialogInterface, i);
}
}).show();
}
public static final void m2470showImageSourceDialog$lambda5(Function1 function1, DialogInterface dialogInterface, int i) {
Intrinsics.checkNotNullParameter(function1, "$openSource");
function1.invoke(i == 0 ? Source.CAMERA : Source.GALLERY);
}
public void onStart() {
super.onStart();
CropImageView cropImageView = this.cropImageView;
if (cropImageView != null) {
cropImageView.setOnSetImageUriCompleteListener(this);
}
CropImageView cropImageView2 = this.cropImageView;
if (cropImageView2 == null) {
return;
}
cropImageView2.setOnCropImageCompleteListener(this);
}
public void onStop() {
super.onStop();
CropImageView cropImageView = this.cropImageView;
if (cropImageView != null) {
cropImageView.setOnSetImageUriCompleteListener(null);
}
CropImageView cropImageView2 = this.cropImageView;
if (cropImageView2 == null) {
return;
}
cropImageView2.setOnCropImageCompleteListener(null);
}
public boolean onCreateOptionsMenu(android.view.Menu r9) {
throw new UnsupportedOperationException("Method not decompiled: com.aemerse.cropper.CropImageActivity.onCreateOptionsMenu(android.view.Menu):boolean");
}
public boolean onOptionsItemSelected(MenuItem item) {
Intrinsics.checkNotNullParameter(item, "item");
int itemId = item.getItemId();
if (itemId == R.id.crop_image_menu_crop) {
cropImage();
return true;
}
CropImageOptions cropImageOptions = null;
if (itemId == R.id.ic_rotate_left_24) {
CropImageOptions cropImageOptions2 = this.cropImageOptions;
if (cropImageOptions2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
} else {
cropImageOptions = cropImageOptions2;
}
rotateImage(-cropImageOptions.rotationDegrees);
return true;
}
if (itemId == R.id.ic_rotate_right_24) {
CropImageOptions cropImageOptions3 = this.cropImageOptions;
if (cropImageOptions3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
} else {
cropImageOptions = cropImageOptions3;
}
rotateImage(cropImageOptions.rotationDegrees);
return true;
}
if (itemId == R.id.ic_flip_24_horizontally) {
CropImageView cropImageView = this.cropImageView;
if (cropImageView == null) {
return true;
}
cropImageView.flipImageHorizontally();
return true;
}
if (itemId != R.id.ic_flip_24_vertically) {
if (itemId == 16908332) {
setResultCancel();
return true;
}
return super.onOptionsItemSelected(item);
}
CropImageView cropImageView2 = this.cropImageView;
if (cropImageView2 == null) {
return true;
}
cropImageView2.flipImageVertically();
return true;
}
public void onBackPressed() {
super.onBackPressed();
setResultCancel();
}
protected void onPickImageResult(Uri resultUri) {
if (resultUri == null) {
setResultCancel();
return;
}
this.cropImageUri = resultUri;
CropImageView cropImageView = this.cropImageView;
if (cropImageView == null) {
return;
}
cropImageView.setImageUriAsync(resultUri);
}
@Override
public void onSetImageUriComplete(CropImageView view, Uri uri, Exception error) {
CropImageView cropImageView;
CropImageView cropImageView2;
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(uri, "uri");
CropImageOptions cropImageOptions = null;
if (error == null) {
CropImageOptions cropImageOptions2 = this.cropImageOptions;
if (cropImageOptions2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions2 = null;
}
if (cropImageOptions2.initialCropWindowRectangle != null && (cropImageView2 = this.cropImageView) != null) {
CropImageOptions cropImageOptions3 = this.cropImageOptions;
if (cropImageOptions3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions3 = null;
}
cropImageView2.setCropRect(cropImageOptions3.initialCropWindowRectangle);
}
CropImageOptions cropImageOptions4 = this.cropImageOptions;
if (cropImageOptions4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions4 = null;
}
if (cropImageOptions4.initialRotation <= 0 || (cropImageView = this.cropImageView) == null) {
return;
}
CropImageOptions cropImageOptions5 = this.cropImageOptions;
if (cropImageOptions5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
} else {
cropImageOptions = cropImageOptions5;
}
cropImageView.setRotatedDegrees(cropImageOptions.initialRotation);
return;
}
setResult(null, error, 1);
}
@Override
public void onCropImageComplete(CropImageView view, CropImageView.CropResult result) {
Intrinsics.checkNotNullParameter(view, "view");
Intrinsics.checkNotNullParameter(result, "result");
setResult(result.getUriContent(), result.getError(), result.getSampleSize());
}
public void cropImage() {
CropImageOptions cropImageOptions = this.cropImageOptions;
CropImageOptions cropImageOptions2 = null;
if (cropImageOptions == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions = null;
}
if (cropImageOptions.noOutputImage) {
setResult(null, null, 1);
return;
}
CropImageView cropImageView = this.cropImageView;
if (cropImageView == null) {
return;
}
CropImageOptions cropImageOptions3 = this.cropImageOptions;
if (cropImageOptions3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions3 = null;
}
Bitmap.CompressFormat compressFormat = cropImageOptions3.outputCompressFormat;
CropImageOptions cropImageOptions4 = this.cropImageOptions;
if (cropImageOptions4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions4 = null;
}
int i = cropImageOptions4.outputCompressQuality;
CropImageOptions cropImageOptions5 = this.cropImageOptions;
if (cropImageOptions5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions5 = null;
}
int i2 = cropImageOptions5.outputRequestWidth;
CropImageOptions cropImageOptions6 = this.cropImageOptions;
if (cropImageOptions6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions6 = null;
}
int i3 = cropImageOptions6.outputRequestHeight;
CropImageOptions cropImageOptions7 = this.cropImageOptions;
if (cropImageOptions7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
cropImageOptions7 = null;
}
CropImageView.RequestSizeOptions requestSizeOptions = cropImageOptions7.outputRequestSizeOptions;
CropImageOptions cropImageOptions8 = this.cropImageOptions;
if (cropImageOptions8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("cropImageOptions");
} else {
cropImageOptions2 = cropImageOptions8;
}
cropImageView.croppedImageAsync(compressFormat, i, i2, i3, requestSizeOptions, cropImageOptions2.customOutputUri);
}
public void setCropImageView(CropImageView cropImageView) {
Intrinsics.checkNotNullParameter(cropImageView, "cropImageView");
this.cropImageView = cropImageView;
}
public void rotateImage(int degrees) {
CropImageView cropImageView = this.cropImageView;
if (cropImageView == null) {
return;
}
cropImageView.rotateImage(degrees);
}
public void setResult(Uri uri, Exception error, int sampleSize) {
setResult(error == null ? -1 : CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE, getResultIntent(uri, error, sampleSize));
finish();
}
public void setResultCancel() {
setResult(0);
finish();
}
public Intent getResultIntent(Uri uri, Exception error, int sampleSize) {
CropImageView cropImageView = this.cropImageView;
Uri imageUri = cropImageView == null ? null : cropImageView.getImageUri();
CropImageView cropImageView2 = this.cropImageView;
float[] cropPoints = cropImageView2 == null ? null : cropImageView2.getCropPoints();
CropImageView cropImageView3 = this.cropImageView;
Rect cropRect = cropImageView3 == null ? null : cropImageView3.getCropRect();
CropImageView cropImageView4 = this.cropImageView;
int mDegreesRotated = cropImageView4 == null ? 0 : cropImageView4.getMDegreesRotated();
CropImageView cropImageView5 = this.cropImageView;
CropImage.ActivityResult activityResult = new CropImage.ActivityResult(imageUri, uri, error, cropPoints, cropRect, mDegreesRotated, cropImageView5 == null ? null : cropImageView5.getWholeImageRect(), sampleSize);
Intent intent = new Intent();
intent.putExtras(getIntent());
intent.putExtra(CropImage.CROP_IMAGE_EXTRA_RESULT, activityResult);
return intent;
}
public void updateMenuItemIconColor(Menu menu, int itemId, int color) {
Drawable icon;
Intrinsics.checkNotNullParameter(menu, "menu");
MenuItem findItem = menu.findItem(itemId);
if (findItem == null || (icon = findItem.getIcon()) == null) {
return;
}
try {
icon.mutate();
icon.setColorFilter(BlendModeColorFilterCompat.createBlendModeColorFilterCompat(color, BlendModeCompat.SRC_ATOP));
findItem.setIcon(icon);
} catch (Exception e) {
Log.w("AIC", "Failed to update menu item color", e);
}
}
}