OSDN Git Service

Disable operations when no item is selected
authorDoris Liu <tianliu@google.com>
Wed, 31 Oct 2012 23:25:23 +0000 (16:25 -0700)
committerDoris Liu <tianliu@google.com>
Wed, 31 Oct 2012 23:25:23 +0000 (16:25 -0700)
Bug: 7441208
Change-Id: I2f435ad8aa0b578ecfec426f7ad6287f0f210f48

src/com/android/gallery3d/ui/ActionModeHandler.java

index d418a33..0a3318d 100644 (file)
@@ -408,6 +408,15 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi
                 // Pass1: Deal with unexpanded media object list for menu operation.
                 ArrayList<MediaObject> selected = getSelectedMediaObjects(jc);
                 if (selected == null) {
+                    mMainHandler.post(new Runnable() {
+                        @Override
+                        public void run() {
+                            mMenuTask = null;
+                            if (jc.isCancelled()) return;
+                            // Disable all the operations when no item is selected
+                            MenuExecutor.updateMenuOperation(mMenu, 0);
+                        }
+                    });
                     return null;
                 }
                 final int operation = computeMenuOptions(selected);