|
@@ -46,6 +46,7 @@ public class ImageRecoverViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
private final SingleLiveEvent<ImageDeepDetector.ImageFile> previewEvent = new SingleLiveEvent<>();
|
|
private final SingleLiveEvent<ImageDeepDetector.ImageFile> previewEvent = new SingleLiveEvent<>();
|
|
|
private final SingleLiveEvent<?> detectedFinish = new SingleLiveEvent<>();
|
|
private final SingleLiveEvent<?> detectedFinish = new SingleLiveEvent<>();
|
|
|
|
|
+ private final SingleLiveEvent<?> showClearDialog = new SingleLiveEvent<>();
|
|
|
private final SingleLiveEvent<Boolean> showScanDialogEvent = new SingleLiveEvent<>();
|
|
private final SingleLiveEvent<Boolean> showScanDialogEvent = new SingleLiveEvent<>();
|
|
|
private final SingleLiveEvent<Boolean> showLoadingEvent = new SingleLiveEvent<>();
|
|
private final SingleLiveEvent<Boolean> showLoadingEvent = new SingleLiveEvent<>();
|
|
|
private final SingleLiveEvent<?> notifyList = new SingleLiveEvent<>();
|
|
private final SingleLiveEvent<?> notifyList = new SingleLiveEvent<>();
|
|
@@ -67,6 +68,10 @@ public class ImageRecoverViewModel extends BaseViewModel {
|
|
|
initLiveData();
|
|
initLiveData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public LiveData<?> getShowClearDialog() {
|
|
|
|
|
+ return showClearDialog;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public LiveData<?> getNotifyList() {
|
|
public LiveData<?> getNotifyList() {
|
|
|
return notifyList;
|
|
return notifyList;
|
|
|
}
|
|
}
|
|
@@ -269,13 +274,13 @@ public class ImageRecoverViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
public void onOperationClick() {
|
|
public void onOperationClick() {
|
|
|
if (type == ImageRecoverActivity.Type.DELETE) {
|
|
if (type == ImageRecoverActivity.Type.DELETE) {
|
|
|
- onDeleteClick();
|
|
|
|
|
|
|
+ showClearDialog.call();
|
|
|
} else {
|
|
} else {
|
|
|
onExportClick();
|
|
onExportClick();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void onDeleteClick() {
|
|
|
|
|
|
|
+ public void executeImageDelete() {
|
|
|
List<ImageDeepDetector.ImageFile> list = getList(selectedList);
|
|
List<ImageDeepDetector.ImageFile> list = getList(selectedList);
|
|
|
if (list.size() == 0) {
|
|
if (list.size() == 0) {
|
|
|
return;
|
|
return;
|
|
@@ -303,6 +308,7 @@ public class ImageRecoverViewModel extends BaseViewModel {
|
|
|
showLoadingEvent.setValue(false);
|
|
showLoadingEvent.setValue(false);
|
|
|
ToastUtil.show(R.string.delete_success, ToastUtil.LENGTH_SHORT);
|
|
ToastUtil.show(R.string.delete_success, ToastUtil.LENGTH_SHORT);
|
|
|
list.clear();
|
|
list.clear();
|
|
|
|
|
+ selectedList.setValue(list);
|
|
|
notifyList.call();
|
|
notifyList.call();
|
|
|
}, throwable -> {
|
|
}, throwable -> {
|
|
|
showLoadingEvent.setValue(false);
|
|
showLoadingEvent.setValue(false);
|
|
@@ -328,6 +334,7 @@ public class ImageRecoverViewModel extends BaseViewModel {
|
|
|
showLoadingEvent.setValue(false);
|
|
showLoadingEvent.setValue(false);
|
|
|
ToastUtil.show(R.string.export_success, ToastUtil.LENGTH_SHORT);
|
|
ToastUtil.show(R.string.export_success, ToastUtil.LENGTH_SHORT);
|
|
|
list.clear();
|
|
list.clear();
|
|
|
|
|
+ selectedList.setValue(list);
|
|
|
}, throwable -> {
|
|
}, throwable -> {
|
|
|
showLoadingEvent.setValue(false);
|
|
showLoadingEvent.setValue(false);
|
|
|
ToastUtil.show(R.string.export_fail, ToastUtil.LENGTH_SHORT);
|
|
ToastUtil.show(R.string.export_fail, ToastUtil.LENGTH_SHORT);
|