Эх сурвалжийг харах

Clear selection when deleting local files

The selection was not cleared when deleting a file locally.

Now the selection mode is cleared after deleting files locally.
Jessie Chatham Spencer 6 жил өмнө
parent
commit
17b7bfb459

+ 13 - 7
src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java

@@ -158,13 +158,7 @@ public class RemoveFilesDialogFragment extends ConfirmationDialogFragment implem
     public void onConfirmation(String callerTag) {
         ComponentsGetter cg = (ComponentsGetter) getActivity();
         cg.getFileOperationsHelper().removeFiles(mTargetFiles, false, false);
-
-        // This is used when finishing an actionMode,
-        // for example if we want to exit the selection mode
-        // after deleting the target files.
-        if (actionMode != null) {
-            actionMode.finish();
-        }
+        finishActionMode();
     }
     
     /**
@@ -174,6 +168,7 @@ public class RemoveFilesDialogFragment extends ConfirmationDialogFragment implem
     public void onCancel(String callerTag) {
         ComponentsGetter cg = (ComponentsGetter) getActivity();
         cg.getFileOperationsHelper().removeFiles(mTargetFiles, true, false);
+        finishActionMode();
     }
 
     @Override
@@ -184,4 +179,15 @@ public class RemoveFilesDialogFragment extends ConfirmationDialogFragment implem
     private void setActionMode(ActionMode actionMode) {
         this.actionMode = actionMode;
     }
+
+    /**
+     * This is used when finishing an actionMode,
+     * for example if we want to exit the selection mode
+     * after deleting the target files.
+     */
+    private void finishActionMode() {
+        if (actionMode != null) {
+            actionMode.finish();
+        }
+    }
 }