Clear selection after copy and when back is pressed.
Change-Id: I5240c825016b9e21bc147591b72bb969eb765597
diff --git a/src/com/android/documentsui/dirlist/DirectoryFragment.java b/src/com/android/documentsui/dirlist/DirectoryFragment.java
index f57aa4b..2aabc99 100644
--- a/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -642,10 +642,7 @@
return true;
case R.id.menu_copy_to_clipboard:
- if (!selection.isEmpty()) {
- copySelectionToClipboard(selection);
- mode.finish();
- }
+ copySelectedToClipboard();
return true;
case R.id.menu_select_all:
@@ -664,6 +661,15 @@
}
}
+ public final boolean onBackPressed() {
+ if (mSelectionManager.hasSelection()) {
+ if (DEBUG) Log.d(TAG, "Clearing selection on back pressed.");
+ mSelectionManager.clearSelection();
+ return true;
+ }
+ return false;
+ }
+
private void cancelThumbnailTask(View view) {
final ImageView iconThumb = (ImageView) view.findViewById(R.id.icon_thumb);
if (iconThumb != null) {
@@ -993,6 +999,7 @@
Selection selection = mSelectionManager.getSelection(new Selection());
if (!selection.isEmpty()) {
copySelectionToClipboard(selection);
+ mSelectionManager.clearSelection();
}
}