diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2013-10-31 09:21:53 +0800 |
---|---|---|
committer | emancebo <emancebo@cyngn.com> | 2014-09-04 10:40:16 -0700 |
commit | e3d11d4419104226e84ac21c92d675d4bbbe67db (patch) | |
tree | 8e83544e45c08d85d978b8acab6dd9f517dc383b /src | |
parent | e78bf0d1427d0d5a089d44f87e0aa9906bbf5c87 (diff) | |
download | android_packages_apps_Gallery2-e3d11d4419104226e84ac21c92d675d4bbbe67db.tar.gz android_packages_apps_Gallery2-e3d11d4419104226e84ac21c92d675d4bbbe67db.tar.bz2 android_packages_apps_Gallery2-e3d11d4419104226e84ac21c92d675d4bbbe67db.zip |
Gallery2: The menu bar will not flicker.
When select/unselect items,the operation of menu bar is set
visible or invisible repeatly which cause the menu bar flicker.
Add a condition to judge whether the menu bar should invisible at the
beginning. And make the Share operation invisible only when the num of
selection picture is over 300.
CRs-Fixed: 567580
Change-Id: I58c724f7426a33f8b94bac174fc4d512a7aa6c49
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/ui/ActionModeHandler.java | 12 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/SelectionManager.java | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/ui/ActionModeHandler.java b/src/com/android/gallery3d/ui/ActionModeHandler.java index 6b4f10312..4544d5b16 100644 --- a/src/com/android/gallery3d/ui/ActionModeHandler.java +++ b/src/com/android/gallery3d/ui/ActionModeHandler.java @@ -400,6 +400,11 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi // Disable share actions until share intent is in good shape if (mSharePanoramaMenuItem != null) mSharePanoramaMenuItem.setEnabled(false); if (mShareMenuItem != null) mShareMenuItem.setEnabled(false); + if ((mSelectionManager.getSelectedCount() == mSelectionManager.getTotalCount()) + && (mSelectionManager.getSelectedCount() > MAX_SELECTED_ITEMS_FOR_SHARE_INTENT)) + { + MenuExecutor.updateMenuOperation(mMenu, MediaObject.SUPPORT_DELETE); + } // Generate sharing intent and update supported operations in the background // The task can take a long time and be canceled in the mean time. @@ -472,7 +477,12 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi mSharePanoramaActionProvider.setShareIntent(share_panorama_intent); } if (mShareMenuItem != null) { - mShareMenuItem.setEnabled(canShare); + if (share_intent.getAction() == null) { + mShareMenuItem.setVisible(false); + } else { + mShareMenuItem.setEnabled(canShare); + mShareMenuItem.setVisible(canShare); + } mShareActionProvider.setShareIntent(share_intent); } } diff --git a/src/com/android/gallery3d/ui/SelectionManager.java b/src/com/android/gallery3d/ui/SelectionManager.java index e1f2bc914..5bad693c9 100644 --- a/src/com/android/gallery3d/ui/SelectionManager.java +++ b/src/com/android/gallery3d/ui/SelectionManager.java @@ -110,7 +110,7 @@ public class SelectionManager { return mInverseSelection ^ mClickedSet.contains(itemId); } - private int getTotalCount() { + public int getTotalCount() { if (mSourceMediaSet == null) return -1; // Sometimes mSourceMediaSet is updated for database change, so mTotal should also be updated. |