|
|
@@ -6,7 +6,6 @@ import androidx.lifecycle.Transformations;
|
|
|
|
|
|
import com.atmob.app.lib.base.BaseViewModel;
|
|
|
import com.atmob.app.lib.livedata.SingleLiveEvent;
|
|
|
-import com.atmob.common.logging.AtmobLog;
|
|
|
import com.atmob.common.runtime.ActivityUtil;
|
|
|
import com.atmob.common.runtime.ContextUtil;
|
|
|
import com.datarecovery.master.R;
|
|
|
@@ -19,7 +18,6 @@ import com.datarecovery.master.sdk.bugly.BuglyHelper;
|
|
|
import com.datarecovery.master.utils.BoxingUtil;
|
|
|
import com.datarecovery.master.utils.FileUtil;
|
|
|
import com.datarecovery.master.utils.FilesSearch;
|
|
|
-import com.datarecovery.master.utils.ImageDeepDetector;
|
|
|
import com.datarecovery.master.utils.Maps;
|
|
|
import com.datarecovery.master.utils.MediaStoreHelper;
|
|
|
import com.datarecovery.master.utils.ReportUtil;
|
|
|
@@ -30,7 +28,6 @@ import org.reactivestreams.Subscription;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import javax.inject.Inject;
|
|
|
@@ -53,10 +50,11 @@ public class FileRecoverViewModel extends BaseViewModel {
|
|
|
private final List<MutableLiveData<Boolean>> checkList = new ArrayList<>();
|
|
|
private final MutableLiveData<List<FilesSearch.DocumentFile>> detectedWordList = new MutableLiveData<>(new ArrayList<>());
|
|
|
private final MutableLiveData<List<FilesSearch.DocumentFile>> detectedExcelList = new MutableLiveData<>(new ArrayList<>());
|
|
|
- private final SingleLiveEvent<?> scrollTop = new SingleLiveEvent<>();
|
|
|
private final MutableLiveData<List<FilesSearch.DocumentFile>> detectedPPTList = new MutableLiveData<>(new ArrayList<>());
|
|
|
private final MutableLiveData<List<FilesSearch.DocumentFile>> detectedPDFList = new MutableLiveData<>(new ArrayList<>());
|
|
|
private final MutableLiveData<List<FilesSearch.DocumentFile>> selectedList = new MutableLiveData<>(new ArrayList<>());
|
|
|
+
|
|
|
+ private final SingleLiveEvent<?> scrollTop = new SingleLiveEvent<>();
|
|
|
private final MutableLiveData<Boolean> showTrialView = new MutableLiveData<>();
|
|
|
private final MutableLiveData<String> detectedLastFileName = new MutableLiveData<>();
|
|
|
private final MutableLiveData<Integer> checkPosition = new MutableLiveData<>();
|
|
|
@@ -65,8 +63,6 @@ public class FileRecoverViewModel extends BaseViewModel {
|
|
|
private final SingleLiveEvent<Boolean> showLoadingEvent = new SingleLiveEvent<>();
|
|
|
private final SingleLiveEvent<Boolean> showScanDialogEvent = new SingleLiveEvent<>();
|
|
|
private final DeviceFuncRepository deviceFuncRepository;
|
|
|
- private int totalCount = 0;
|
|
|
- private final MutableLiveData<Integer> totalDetectedCount = new MutableLiveData<>();
|
|
|
private final LiveData<String> selectedCountTxt;
|
|
|
private Disposable scanDisposable;
|
|
|
private boolean isTrial;
|
|
|
@@ -139,10 +135,6 @@ public class FileRecoverViewModel extends BaseViewModel {
|
|
|
return showLoadingEvent;
|
|
|
}
|
|
|
|
|
|
- public LiveData<Integer> getTotalDetectedCount() {
|
|
|
- return totalDetectedCount;
|
|
|
- }
|
|
|
-
|
|
|
public LiveData<List<FilesSearch.DocumentFile>> getSelectedList() {
|
|
|
return selectedList;
|
|
|
}
|
|
|
@@ -175,8 +167,6 @@ public class FileRecoverViewModel extends BaseViewModel {
|
|
|
scanDisposable = Disposable.fromSubscription(s);
|
|
|
addDisposable(scanDisposable);
|
|
|
showScanDialogEvent.setValue(true);
|
|
|
- totalCount = 0;
|
|
|
- totalDetectedCount.setValue(0);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -184,10 +174,8 @@ public class FileRecoverViewModel extends BaseViewModel {
|
|
|
if (documentFiles == null || documentFiles.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- totalCount += documentFiles.size();
|
|
|
- totalDetectedCount.setValue(totalCount);
|
|
|
+ MutableLiveData<List<FilesSearch.DocumentFile>> liveData = null;
|
|
|
for (FilesSearch.DocumentFile item : documentFiles) {
|
|
|
- MutableLiveData<List<FilesSearch.DocumentFile>> liveData = null;
|
|
|
if (item.getCategory() == FilesSearch.DocumentFile.WORD) {
|
|
|
liveData = detectedWordList;
|
|
|
} else if (item.getCategory() == FilesSearch.DocumentFile.EXCEL) {
|
|
|
@@ -232,19 +220,19 @@ public class FileRecoverViewModel extends BaseViewModel {
|
|
|
if (isTrial) {
|
|
|
showTrialView.setValue(true);
|
|
|
List<FilesSearch.DocumentFile> list = getList(detectedWordList);
|
|
|
- if (list.size() > 0) {
|
|
|
+ if (!list.isEmpty()) {
|
|
|
list.get(0).setTrial(true);
|
|
|
}
|
|
|
list = getList(detectedExcelList);
|
|
|
- if (list.size() > 0) {
|
|
|
+ if (!list.isEmpty()) {
|
|
|
list.get(0).setTrial(true);
|
|
|
}
|
|
|
list = getList(detectedPPTList);
|
|
|
- if (list.size() > 0) {
|
|
|
+ if (!list.isEmpty()) {
|
|
|
list.get(0).setTrial(true);
|
|
|
}
|
|
|
list = getList(detectedPDFList);
|
|
|
- if (list.size() > 0) {
|
|
|
+ if (!list.isEmpty()) {
|
|
|
list.get(0).setTrial(true);
|
|
|
}
|
|
|
}
|
|
|
@@ -301,7 +289,7 @@ public class FileRecoverViewModel extends BaseViewModel {
|
|
|
|
|
|
public void onExportClick() {
|
|
|
List<FilesSearch.DocumentFile> list = selectedList.getValue();
|
|
|
- if (list == null || list.size() == 0) {
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
if (isTrial) {
|