OSDN Git Service

Fix 6046544: Deleting a photo takes multiple steps and the flow is inconsistent with...
authorRay Chen <raychen@google.com>
Tue, 15 May 2012 03:22:21 +0000 (11:22 +0800)
committerRay Chen <raychen@google.com>
Wed, 16 May 2012 01:16:13 +0000 (09:16 +0800)
Per request, change the confirm dialog message to "Delete the selected item(s)?"

b: 6046544

Change-Id: I46f7fd42a9f9fbf2399aca78ed9b2e67a15acb65

res/values/strings.xml
src/com/android/gallery3d/app/PhotoPage.java
src/com/android/gallery3d/ui/ActionModeHandler.java
src/com/android/gallery3d/ui/MenuExecutor.java

index 96176d5..bba7e33 100644 (file)
@@ -61,7 +61,7 @@
 
     <!-- Title of a menu item to indicate performing the image crop operation
          [CHAR LIMIT=20] -->
-    <string name="crop_save_text">OK</string>
+    <string name="ok">OK</string>
     <!-- Button indicating that the cropped image should be reverted back to the original -->
     <!-- Hint that appears when cropping an image with more than one face -->
     <string name="multiface_crop_help">Touch a face to begin.</string>
 
     <!-- Details dialog "OK" button. Dismisses dialog. -->
     <string name="delete">Delete</string>
-    <string name="confirm_action">Confirm deletion?</string>
+    <!-- String Delete the selected media item(s) [CHAR LIMIT=30] -->
+    <plurals name="delete_selection">
+        <item quantity="one">Delete selected item?</item>
+        <item quantity="other">Delete selected items?</item>
+    </plurals>
     <string name="confirm">Confirm</string>
     <string name="cancel">Cancel</string>
     <string name="share">Share</string>
index 3f9f057..52f7c41 100644 (file)
@@ -525,7 +525,7 @@ public class PhotoPage extends ActivityState implements
 
         DataManager manager = mActivity.getDataManager();
         int action = item.getItemId();
-        boolean needsConfirm = false;
+        String confirmMsg = null;
         switch (action) {
             case android.R.id.home: {
                 onUpPressed();
@@ -568,19 +568,20 @@ public class PhotoPage extends ActivityState implements
                 return true;
             }
             case R.id.action_delete:
-                needsConfirm = true;
+                confirmMsg = mActivity.getResources().getQuantityString(
+                        R.plurals.delete_selection, 1);
             case R.id.action_setas:
             case R.id.action_rotate_ccw:
             case R.id.action_rotate_cw:
             case R.id.action_show_on_map:
                 mSelectionManager.deSelectAll();
                 mSelectionManager.toggle(path);
-                mMenuExecutor.onMenuClicked(item, needsConfirm, null);
+                mMenuExecutor.onMenuClicked(item, confirmMsg, null);
                 return true;
             case R.id.action_import:
                 mSelectionManager.deSelectAll();
                 mSelectionManager.toggle(path);
-                mMenuExecutor.onMenuClicked(item, needsConfirm,
+                mMenuExecutor.onMenuClicked(item, confirmMsg,
                         new ImportCompleteListener(mActivity));
                 return true;
             default :
index d8e60d3..c5773ed 100644 (file)
@@ -125,14 +125,15 @@ public class ActionModeHandler implements ActionMode.Callback {
                 }
             }
             ProgressListener listener = null;
-            boolean needsConfirm = false;
+            String confirmMsg = null;
             int action = item.getItemId();
             if (action == R.id.action_import) {
                 listener = new ImportCompleteListener(mActivity);
             } else if (item.getItemId() == R.id.action_delete) {
-                needsConfirm = true;
+                confirmMsg = mActivity.getResources().getQuantityString(
+                        R.plurals.delete_selection, mSelectionManager.getSelectedCount());
             }
-            mMenuExecutor.onMenuClicked(item, needsConfirm, listener);
+            mMenuExecutor.onMenuClicked(item, confirmMsg, listener);
             if (action == R.id.action_select_all) {
                 updateSupportedOperation();
                 updateSelectionMenu();
index 636da39..14bdc4d 100644 (file)
@@ -232,14 +232,14 @@ public class MenuExecutor {
         startAction(action, title, listener);
     }
 
-    public void onMenuClicked(MenuItem menuItem, boolean needsConfirm,
+    public void onMenuClicked(MenuItem menuItem, String confirmMsg,
             final ProgressListener listener) {
         final int action = menuItem.getItemId();
 
-        if (needsConfirm) {
+        if (confirmMsg != null) {
             new AlertDialog.Builder(mActivity.getAndroidContext())
-                    .setMessage(R.string.confirm_action)
-                    .setPositiveButton(R.string.confirm, new OnClickListener() {
+                    .setMessage(confirmMsg)
+                    .setPositiveButton(R.string.ok, new OnClickListener() {
                             public void onClick(DialogInterface dialog, int which) {
                                 onMenuClicked(action, listener);
                             }