From 17b7bfb4592b8c64d23f8725c7e129beeab18025 Mon Sep 17 00:00:00 2001 From: Jessie Chatham Spencer Date: Thu, 2 Aug 2018 19:56:12 +0200 Subject: [PATCH] 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. --- .../ui/dialog/RemoveFilesDialogFragment.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java b/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java index 8cac3dba9b..6f4846d044 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/RemoveFilesDialogFragment.java +++ b/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(); + } + } }