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.
This commit is contained in:
Jessie Chatham Spencer 2018-08-02 19:56:12 +02:00 committed by AndyScherzinger
parent ada2f4698a
commit 17b7bfb459
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -158,13 +158,7 @@ public class RemoveFilesDialogFragment extends ConfirmationDialogFragment implem
public void onConfirmation(String callerTag) { public void onConfirmation(String callerTag) {
ComponentsGetter cg = (ComponentsGetter) getActivity(); ComponentsGetter cg = (ComponentsGetter) getActivity();
cg.getFileOperationsHelper().removeFiles(mTargetFiles, false, false); cg.getFileOperationsHelper().removeFiles(mTargetFiles, false, false);
finishActionMode();
// 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();
}
} }
/** /**
@ -174,6 +168,7 @@ public class RemoveFilesDialogFragment extends ConfirmationDialogFragment implem
public void onCancel(String callerTag) { public void onCancel(String callerTag) {
ComponentsGetter cg = (ComponentsGetter) getActivity(); ComponentsGetter cg = (ComponentsGetter) getActivity();
cg.getFileOperationsHelper().removeFiles(mTargetFiles, true, false); cg.getFileOperationsHelper().removeFiles(mTargetFiles, true, false);
finishActionMode();
} }
@Override @Override
@ -184,4 +179,15 @@ public class RemoveFilesDialogFragment extends ConfirmationDialogFragment implem
private void setActionMode(ActionMode actionMode) { private void setActionMode(ActionMode actionMode) {
this.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();
}
}
} }