summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ben Kwa <kenobi@google.com> 2015-09-24 23:13:42 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-09-24 23:13:42 +0000
commit32a5776039ba6893fa9d331d8208b1d26fb88e11 (patch)
tree7e640eeb48036ad9aec28028487f8b10ef8dd3b7
parente25a8292f84bfea94737fa0294dd94fb835e7fbc (diff)
parent8923911c6911df59d9227056f3e5a107964632dc (diff)
Merge "Fix a crash when deleting documents."
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
index e77fe3fa6cdd..407601b3ee66 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
@@ -614,7 +614,6 @@ public class DirectoryFragment extends Fragment {
@Override
public void onItemStateChanged(int position, boolean selected) {
-
final Cursor cursor = mModel.getItem(position);
checkNotNull(cursor, "Cursor cannot be null.");
@@ -700,8 +699,9 @@ public class DirectoryFragment extends Fragment {
return true;
} else if (id == R.id.menu_delete) {
- deleteDocuments(selection);
+ // Exit selection mode first, so we avoid deselecting deleted documents.
mode.finish();
+ deleteDocuments(selection);
return true;
} else if (id == R.id.menu_copy_to) {
@@ -710,8 +710,9 @@ public class DirectoryFragment extends Fragment {
return true;
} else if (id == R.id.menu_move_to) {
- transferDocuments(selection, CopyService.TRANSFER_MODE_MOVE);
+ // Exit selection mode first, so we avoid deselecting deleted documents.
mode.finish();
+ transferDocuments(selection, CopyService.TRANSFER_MODE_MOVE);
return true;
} else if (id == R.id.menu_copy_to_clipboard) {