|
|
@@ -7,7 +7,6 @@ import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.view.KeyEvent;
|
|
|
|
|
|
-import androidx.annotation.IntDef;
|
|
|
import androidx.annotation.NonNull;
|
|
|
import androidx.annotation.Nullable;
|
|
|
import androidx.recyclerview.widget.ConcatAdapter;
|
|
|
@@ -21,6 +20,7 @@ import com.datarecovery.master.databinding.ItemTabImageRecoverBinding;
|
|
|
import com.datarecovery.master.dialog.CommonLoadingDialog;
|
|
|
import com.datarecovery.master.dialog.CommonSureDialog;
|
|
|
import com.datarecovery.master.dialog.ScanProgressDialog;
|
|
|
+import com.datarecovery.master.module.member.MemberType;
|
|
|
import com.datarecovery.master.module.preview.PreviewActivity;
|
|
|
import com.datarecovery.master.utils.BoxingUtil;
|
|
|
import com.datarecovery.master.utils.FilePermissionHelper;
|
|
|
@@ -29,9 +29,8 @@ import com.datarecovery.master.utils.ImageDeepDetector;
|
|
|
import com.google.android.material.tabs.TabLayout;
|
|
|
import com.gyf.immersionbar.ImmersionBar;
|
|
|
|
|
|
-import java.lang.annotation.Retention;
|
|
|
-import java.lang.annotation.RetentionPolicy;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
import dagger.hilt.android.AndroidEntryPoint;
|
|
|
|
|
|
@@ -42,12 +41,6 @@ public class ImageRecoverActivity extends BaseActivity<ActivityImageRecoverBindi
|
|
|
|
|
|
private ConcatAdapter concatAdapter;
|
|
|
|
|
|
- @IntDef({Type.RECOVER, Type.DELETE})
|
|
|
- @Retention(RetentionPolicy.SOURCE)
|
|
|
- public @interface Type {
|
|
|
- int RECOVER = 1;
|
|
|
- int DELETE = 2;
|
|
|
- }
|
|
|
|
|
|
private static final String TYPE = "type";
|
|
|
ImageRecoverViewModel imageRecoverViewModel;
|
|
|
@@ -64,7 +57,7 @@ public class ImageRecoverActivity extends BaseActivity<ActivityImageRecoverBindi
|
|
|
private ImageItemAdapter otherAdapter;
|
|
|
private GridLayoutManager gridLayoutManager;
|
|
|
|
|
|
- public static void start(Context context, @Type int type) {
|
|
|
+ public static void start(Context context, @MemberType String type) {
|
|
|
Intent intent = new Intent(context, ImageRecoverActivity.class);
|
|
|
if (!(context instanceof Activity)) {
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
@@ -83,7 +76,7 @@ public class ImageRecoverActivity extends BaseActivity<ActivityImageRecoverBindi
|
|
|
}
|
|
|
|
|
|
private void initPermission() {
|
|
|
- new FilePermissionHelper().requestDataFilePermission(this, (imageRecoverViewModel.getType() == Type.RECOVER) ? "hf11001" : "hf11013", new FilePermissionHelper.NextStepCallback() {
|
|
|
+ new FilePermissionHelper().requestDataFilePermission(this, imageRecoverViewModel.getType(), new FilePermissionHelper.NextStepCallback() {
|
|
|
@Override
|
|
|
public void onNextStep() {
|
|
|
imageRecoverViewModel.startImageScanning();
|
|
|
@@ -99,7 +92,7 @@ public class ImageRecoverActivity extends BaseActivity<ActivityImageRecoverBindi
|
|
|
private void initData() {
|
|
|
Intent intent = getIntent();
|
|
|
if (intent != null) {
|
|
|
- imageRecoverViewModel.setOperationType(intent.getIntExtra(TYPE, Type.RECOVER));
|
|
|
+ imageRecoverViewModel.setType(intent.getStringExtra(TYPE));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -205,7 +198,7 @@ public class ImageRecoverActivity extends BaseActivity<ActivityImageRecoverBindi
|
|
|
if (imageFile == null) {
|
|
|
return;
|
|
|
}
|
|
|
- if (imageRecoverViewModel.getType() == Type.DELETE) {
|
|
|
+ if (Objects.equals(imageRecoverViewModel.getType(), MemberType.APP_IMAGE_CLEAN)) {
|
|
|
imageRecoverViewModel.setItemCheck(imageFile);
|
|
|
} else {
|
|
|
imageRecoverViewModel.checkPreview(imageFile);
|
|
|
@@ -334,7 +327,7 @@ public class ImageRecoverActivity extends BaseActivity<ActivityImageRecoverBindi
|
|
|
if (BoxingUtil.boxing(show)) {
|
|
|
if (loadingDialog == null) {
|
|
|
loadingDialog = new CommonLoadingDialog(this);
|
|
|
- loadingDialog.setMessage((imageRecoverViewModel.getType()) == Type.DELETE ? R.string.deleting : R.string.exporting);
|
|
|
+ loadingDialog.setMessage(Objects.equals(imageRecoverViewModel.getType(), MemberType.APP_IMAGE_CLEAN) ? R.string.deleting : R.string.exporting);
|
|
|
}
|
|
|
loadingDialog.show();
|
|
|
} else {
|