summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ben Kwa <kenobi@google.com> 2015-09-25 14:58:42 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-09-25 14:58:42 +0000
commit6fd4f7f7c34dbe3db52ceb54307469dff4bcdc99 (patch)
treedccab7ea502a7ef7fe979f566313baebc509cd14
parent49966d67a8e10d111b72b41732277894cd8d4884 (diff)
parentbd7da4c44ed0adac9eff0cc55a7c6f3b05f0a955 (diff)
Merge "Activate selection mode when selecting via mouse."
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/MultiSelectManager.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/MultiSelectManager.java b/packages/DocumentsUI/src/com/android/documentsui/MultiSelectManager.java
index 583994351a0c..858fb423fe06 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/MultiSelectManager.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/MultiSelectManager.java
@@ -365,8 +365,8 @@ public final class MultiSelectManager {
// To make this more correct, we'd need to update the Ranger class to return
// information about what has changed.
notifySelectionChanged();
- } else if (toggleSelection(input.getItemPosition())) {
- notifySelectionChanged();
+ } else {
+ toggleSelection(input.getItemPosition());
}
}
@@ -375,14 +375,13 @@ public final class MultiSelectManager {
* a new Ranger (range selection manager) at that point is created.
*
* @param position
- * @return True if state changed.
*/
- private boolean toggleSelection(int position) {
+ private void toggleSelection(int position) {
// Position may be special "no position" during certain
// transitional phases. If so, skip handling of the event.
if (position == RecyclerView.NO_POSITION) {
if (DEBUG) Log.d(TAG, "Ignoring toggle for element with no position.");
- return false;
+ return;
}
boolean changed = false;
@@ -391,7 +390,7 @@ public final class MultiSelectManager {
} else {
boolean canSelect = notifyBeforeItemStateChange(position, true);
if (!canSelect) {
- return false;
+ return;
}
if (mSingleSelect && !mSelection.isEmpty()) {
clearSelectionQuietly();
@@ -407,7 +406,9 @@ public final class MultiSelectManager {
changed = true;
}
- return changed;
+ if (changed) {
+ notifySelectionChanged();
+ }
}
/**