导航菜单

页面标题

页面副标题

Rilo v2.0.21 - SExtendActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 SExtendActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package in.onato.imageeditor.editor;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import androidx.core.app.ActivityCompat;
import com.canhub.cropper.CropImage;
import com.canhub.cropper.CropImageActivity;
import com.canhub.cropper.CropImageView;
import in.onato.imageeditor.databinding.ExtendedActivityBinding;
import in.onato.imageeditor.domian.SExtendContract;
import in.onato.imageeditor.presenter.SExtendPresenter;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;

@Metadata(d1 = {"\u0000n\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\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\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\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0000\u0018\u0000 +2\u00020\u00012\u00020\u0002:\u0001+B\u0005¢\u0006\u0002\u0010\u0003J$\u0010\b\u001a\u00020\t2\b\u0010\n\u001a\u0004\u0018\u00010\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\r2\u0006\u0010\u000e\u001a\u00020\u000fH\u0016J\u0012\u0010\u0010\u001a\u00020\u00112\b\u0010\u0012\u001a\u0004\u0018\u00010\u0013H\u0016J\b\u0010\u0014\u001a\u00020\u0011H\u0014J\u0012\u0010\u0015\u001a\u00020\u00112\b\u0010\u0016\u001a\u0004\u0018\u00010\u000bH\u0014J\u0010\u0010\u0017\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020\u000fH\u0016J\u0010\u0010\u0019\u001a\u00020\u00112\u0006\u0010\u001a\u001a\u00020\u001bH\u0016J\b\u0010\u001c\u001a\u00020\u0011H\u0002J*\u0010\u001d\u001a\u00020\u00112\b\u0010\n\u001a\u0004\u0018\u00010\u000b2\u000e\u0010\f\u001a\n\u0018\u00010\rj\u0004\u0018\u0001`\u001e2\u0006\u0010\u000e\u001a\u00020\u000fH\u0016J\b\u0010\u001f\u001a\u00020\u0011H\u0016J\u001c\u0010 \u001a\u00020\u00112\u0012\u0010!\u001a\u000e\u0012\u0004\u0012\u00020#\u0012\u0004\u0012\u00020\u00110\"H\u0016J \u0010$\u001a\u00020\u00112\u0006\u0010%\u001a\u00020&2\u0006\u0010'\u001a\u00020\u000f2\u0006\u0010(\u001a\u00020\u000fH\u0016J\u0010\u0010)\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020*H\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006,"}, d2 = {"Lin/onato/imageeditor/editor/SExtendActivity;", "Lcom/canhub/cropper/CropImageActivity;", "Lin/onato/imageeditor/domian/SExtendContract$View;", "()V", "binding", "Lin/onato/imageeditor/databinding/ExtendedActivityBinding;", "presenter", "Lin/onato/imageeditor/domian/SExtendContract$Presenter;", "getResultIntent", "Landroid/content/Intent;", "uri", "Landroid/net/Uri;", "error", "Ljava/lang/Exception;", "sampleSize", "", "onCreate", "", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onPickImageResult", "resultUri", "rotate", "counter", "setContentView", "view", "Landroid/view/View;", "setImage", "setResult", "Lkotlin/Exception;", "setResultCancel", "showImageSourceDialog", "openSource", "Lkotlin/Function1;", "Lcom/canhub/cropper/CropImageActivity$Source;", "updateMenuItemIconColor", "menu", "Landroid/view/Menu;", "itemId", "color", "updateRotationCounter", "", "Companion", "imageEditor_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class SExtendActivity extends CropImageActivity implements SExtendContract.View {

    public static final Companion INSTANCE = new Companion(null);
    public static final int SUCCESS = 101;
    private static Uri uri;
    private ExtendedActivityBinding binding;
    private final SExtendContract.Presenter presenter = new SExtendPresenter();

    public void showImageSourceDialog(Function1<? super CropImageActivity.Source, Unit> openSource) {
        Intrinsics.checkNotNullParameter(openSource, "openSource");
    }

    @Override
    public void updateRotationCounter(String counter) {
        Intrinsics.checkNotNullParameter(counter, "counter");
    }

    @Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\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\u001a\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\n\b\u0002\u0010\u000f\u001a\u0004\u0018\u00010\u0006R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u001c\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\n¨\u0006\u0010"}, d2 = {"Lin/onato/imageeditor/editor/SExtendActivity$Companion;", "", "()V", "SUCCESS", "", "uri", "Landroid/net/Uri;", "getUri", "()Landroid/net/Uri;", "setUri", "(Landroid/net/Uri;)V", "start", "", "activity", "Landroid/app/Activity;", "imageUri", "imageEditor_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }

        public final Uri getUri() {
            return SExtendActivity.uri;
        }

        public final void setUri(Uri uri) {
            SExtendActivity.uri = uri;
        }

        public static void start$default(Companion companion, Activity activity, Uri uri, int i2, Object obj) {
            if ((i2 & 2) != 0) {
                uri = null;
            }
            companion.start(activity, uri);
        }

        public final void start(Activity activity, Uri imageUri) {
            Intrinsics.checkNotNullParameter(activity, "activity");
            ActivityCompat.startActivityForResult(activity, new Intent(activity, (Class<?>) SExtendActivity.class), 101, (Bundle) null);
            setUri(imageUri);
        }
    }

    public void onCreate(Bundle savedInstanceState) {
        ExtendedActivityBinding inflate = ExtendedActivityBinding.inflate(getLayoutInflater());
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        this.binding = inflate;
        super.onCreate(savedInstanceState);
        this.presenter.bindView(this);
        ExtendedActivityBinding extendedActivityBinding = this.binding;
        ExtendedActivityBinding extendedActivityBinding2 = null;
        if (extendedActivityBinding == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding = null;
        }
        extendedActivityBinding.saveBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SExtendActivity.onCreate$lambda$0(SExtendActivity.this, view);
            }
        });
        ExtendedActivityBinding extendedActivityBinding3 = this.binding;
        if (extendedActivityBinding3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding3 = null;
        }
        extendedActivityBinding3.backBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SExtendActivity.onCreate$lambda$1(SExtendActivity.this, view);
            }
        });
        ExtendedActivityBinding extendedActivityBinding4 = this.binding;
        if (extendedActivityBinding4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding4 = null;
        }
        extendedActivityBinding4.rotate.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SExtendActivity.onCreate$lambda$2(SExtendActivity.this, view);
            }
        });
        ExtendedActivityBinding extendedActivityBinding5 = this.binding;
        if (extendedActivityBinding5 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
        } else {
            extendedActivityBinding2 = extendedActivityBinding5;
        }
        CropImageView cropImageView = extendedActivityBinding2.cropImageView;
        Intrinsics.checkNotNullExpressionValue(cropImageView, "binding.cropImageView");
        setCropImageView(cropImageView);
        setImage();
    }

    public static final void onCreate$lambda$0(SExtendActivity sExtendActivity, View view) {
        Intrinsics.checkNotNullParameter(sExtendActivity, "this$0");
        sExtendActivity.cropImage();
    }

    public static final void onCreate$lambda$1(SExtendActivity sExtendActivity, View view) {
        Intrinsics.checkNotNullParameter(sExtendActivity, "this$0");
        sExtendActivity.onBackPressed();
    }

    public static final void onCreate$lambda$2(SExtendActivity sExtendActivity, View view) {
        Intrinsics.checkNotNullParameter(sExtendActivity, "this$0");
        sExtendActivity.presenter.onRotateClick();
    }

    private final void setImage() {
        if (uri != null) {
            Log.e("TAG", "setImage: " + uri);
            ExtendedActivityBinding extendedActivityBinding = this.binding;
            if (extendedActivityBinding == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
                extendedActivityBinding = null;
            }
            extendedActivityBinding.cropImageView.setImageUriAsync(uri);
        }
    }

    public void setContentView(View view) {
        Intrinsics.checkNotNullParameter(view, "view");
        ExtendedActivityBinding extendedActivityBinding = this.binding;
        if (extendedActivityBinding == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding = null;
        }
        super.setContentView(extendedActivityBinding.getRoot());
    }

    protected void onDestroy() {
        this.presenter.unbindView();
        super.onDestroy();
    }

    @Override
    public void rotate(int counter) {
        ExtendedActivityBinding extendedActivityBinding = this.binding;
        if (extendedActivityBinding == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding = null;
        }
        extendedActivityBinding.cropImageView.rotateImage(counter);
    }

    protected void onPickImageResult(Uri resultUri) {
        super.onPickImageResult(resultUri);
        if (resultUri != null) {
            ExtendedActivityBinding extendedActivityBinding = this.binding;
            if (extendedActivityBinding == null) {
                Intrinsics.throwUninitializedPropertyAccessException("binding");
                extendedActivityBinding = null;
            }
            extendedActivityBinding.cropImageView.setImageUriAsync(resultUri);
        }
    }

    public Intent getResultIntent(Uri uri2, Exception error, int sampleSize) {
        Intent putExtra = super.getResultIntent(uri2, error, sampleSize).putExtra("EXTRA_KEY", "Extra data");
        Intrinsics.checkNotNullExpressionValue(putExtra, "result.putExtra(\"EXTRA_KEY\", \"Extra data\")");
        return putExtra;
    }

    public void setResult(Uri uri2, Exception error, int sampleSize) {
        ExtendedActivityBinding extendedActivityBinding = this.binding;
        if (extendedActivityBinding == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding = null;
        }
        Uri imageUri = extendedActivityBinding.cropImageView.getImageUri();
        ExtendedActivityBinding extendedActivityBinding2 = this.binding;
        if (extendedActivityBinding2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding2 = null;
        }
        float[] cropPoints = extendedActivityBinding2.cropImageView.getCropPoints();
        ExtendedActivityBinding extendedActivityBinding3 = this.binding;
        if (extendedActivityBinding3 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding3 = null;
        }
        Rect cropRect = extendedActivityBinding3.cropImageView.getCropRect();
        ExtendedActivityBinding extendedActivityBinding4 = this.binding;
        if (extendedActivityBinding4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding4 = null;
        }
        int rotatedDegrees = extendedActivityBinding4.cropImageView.getRotatedDegrees();
        ExtendedActivityBinding extendedActivityBinding5 = this.binding;
        if (extendedActivityBinding5 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            extendedActivityBinding5 = null;
        }
        CropImageView.CropResult activityResult = new CropImage.ActivityResult(imageUri, uri2, error, cropPoints, cropRect, rotatedDegrees, extendedActivityBinding5.cropImageView.getWholeImageRect(), sampleSize);
        Log.v("File Path", String.valueOf(CropImageView.CropResult.getUriFilePath$default(activityResult, (Context) this, false, 2, (Object) null)));
        if (activityResult.isSuccessful()) {
            Intent intent = new Intent();
            intent.putExtra("imageUri", StringsKt.replace$default(String.valueOf(activityResult.getUriContent()), "file:", "", false, 4, (Object) null));
            Unit unit = Unit.INSTANCE;
            setResult(-1, intent);
        } else {
            setResult(0);
        }
        onBackPressed();
    }

    public void setResultCancel() {
        Log.i("extend", "User this override to change behaviour when cancel");
        super.setResultCancel();
    }

    public void updateMenuItemIconColor(Menu menu, int itemId, int color) {
        Intrinsics.checkNotNullParameter(menu, "menu");
        Log.i("extend", "If not using your layout, this can be one option to change colours. Check README and wiki for more");
        super.updateMenuItemIconColor(menu, itemId, color);
    }
}