summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Chen <raychen@google.com>2011-09-14 09:41:28 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-14 09:41:28 -0700
commitd3ec7831835a9f656ff72b05a5b3bc01a8c56a4a (patch)
tree1b5df20f770b3cf9b5acaaa822c3ce47ac5e77e9
parent765dcecfb188b48705939c8b8ffb332ea4c07d2d (diff)
parente3c968f892585490b938ea2bcef81f8dca4a81f8 (diff)
downloadandroid_packages_apps_Gallery2-d3ec7831835a9f656ff72b05a5b3bc01a8c56a4a.tar.gz
android_packages_apps_Gallery2-d3ec7831835a9f656ff72b05a5b3bc01a8c56a4a.tar.bz2
android_packages_apps_Gallery2-d3ec7831835a9f656ff72b05a5b3bc01a8c56a4a.zip
Merge "Fix 5288270 PTP camera gallery launch, prompts the user to "select all" instead if "Deselect all""
-rw-r--r--src/com/android/gallery3d/ui/ActionModeHandler.java28
-rw-r--r--src/com/android/gallery3d/ui/SelectionManager.java2
2 files changed, 17 insertions, 13 deletions
diff --git a/src/com/android/gallery3d/ui/ActionModeHandler.java b/src/com/android/gallery3d/ui/ActionModeHandler.java
index fbe582523..91a98ceb4 100644
--- a/src/com/android/gallery3d/ui/ActionModeHandler.java
+++ b/src/com/android/gallery3d/ui/ActionModeHandler.java
@@ -86,6 +86,7 @@ public class ActionModeHandler implements ActionMode.Callback {
mSelectionMenu = customMenu.addDropDownMenu(
(Button) customView.findViewById(R.id.selection_menu),
R.menu.selection);
+ updateSelectAllTitle();
customMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
return onActionItemClicked(actionMode, item);
@@ -118,21 +119,24 @@ public class ActionModeHandler implements ActionMode.Callback {
result = mMenuExecutor.onMenuClicked(item, listener);
if (item.getItemId() == R.id.action_select_all) {
updateSupportedOperation();
+ updateSelectAllTitle();
+ }
+ return result;
+ }
- // For clients who call SelectionManager.selectAll() directly, we need to ensure the
- // menu status is consistent with selection manager.
- item = mSelectionMenu.findItem(R.id.action_select_all);
- if (item != null) {
- if (mSelectionManager.inSelectAllMode()) {
- item.setChecked(true);
- item.setTitle(R.string.deselect_all);
- } else {
- item.setChecked(false);
- item.setTitle(R.string.select_all);
- }
+ private void updateSelectAllTitle() {
+ // For clients who call SelectionManager.selectAll() directly, we need to ensure the
+ // menu status is consistent with selection manager.
+ MenuItem item = mSelectionMenu.findItem(R.id.action_select_all);
+ if (item != null) {
+ if (mSelectionManager.inSelectAllMode()) {
+ item.setChecked(true);
+ item.setTitle(R.string.deselect_all);
+ } else {
+ item.setChecked(false);
+ item.setTitle(R.string.select_all);
}
}
- return result;
}
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
diff --git a/src/com/android/gallery3d/ui/SelectionManager.java b/src/com/android/gallery3d/ui/SelectionManager.java
index b85ca7a41..9599f5b3f 100644
--- a/src/com/android/gallery3d/ui/SelectionManager.java
+++ b/src/com/android/gallery3d/ui/SelectionManager.java
@@ -73,9 +73,9 @@ public class SelectionManager {
}
public void selectAll() {
- enterSelectionMode();
mInverseSelection = true;
mClickedSet.clear();
+ enterSelectionMode();
if (mListener != null) mListener.onSelectionModeChange(SELECT_ALL_MODE);
}