Fix archive menu item open issue

Per UX: hide archive on tablet, disable it on phone
fixes b/6497472 update menus in mail to match jb specs

Change-Id: I202a6151f673b32206fc89907cbe5febd21d85a0
diff --git a/res/values-sw600dp/constants.xml b/res/values-sw600dp/constants.xml
index 8bb7f20..1d60b17 100644
--- a/res/values-sw600dp/constants.xml
+++ b/res/values-sw600dp/constants.xml
@@ -29,4 +29,7 @@
 
     <!-- Whether to show single or 2 pane search results -->
     <bool name="show_two_pane_search_results">true</bool>
+
+    <!-- Whether to show the archive item as disabled rather than hiding it entirely -->
+    <bool name="show_disabled_archive_menu_item">false</bool>
 </resources>
diff --git a/res/values/constants.xml b/res/values/constants.xml
index a6c5011..d4d1038 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -59,6 +59,9 @@
     <!-- Whether to show single or 2 pane search results -->
     <bool name="show_two_pane_search_results">false</bool>
 
+    <!-- Whether to show the archive item as disabled rather than hiding it entirely -->
+    <bool name="show_disabled_archive_menu_item">true</bool>
+
     <!-- Whether to show conversation subject in conversation view -->
     <bool name="show_conversation_subject">true</bool>
 
diff --git a/src/com/android/mail/browse/SelectedConversationsActionMenu.java b/src/com/android/mail/browse/SelectedConversationsActionMenu.java
index 25b99d6..4dfbae4 100644
--- a/src/com/android/mail/browse/SelectedConversationsActionMenu.java
+++ b/src/com/android/mail/browse/SelectedConversationsActionMenu.java
@@ -355,7 +355,8 @@
         // We only ever show one of:
         // 1) remove folder
         // 2) archive
-        // If we show neither archive or remove folder, then show a disabled archive icon.
+        // 3) If we show neither archive or remove folder, then show a disabled
+        // archive icon if the setting for that is true.
         final MenuItem removeFolder = menu.findItem(R.id.remove_folder);
         final boolean showRemoveFolder = mFolder != null && mFolder.type == FolderType.DEFAULT
                 && mFolder.supportsCapability(FolderCapabilities.CAN_ACCEPT_MOVED_MESSAGES)
@@ -374,7 +375,8 @@
         } else {
             archive.setVisible(showArchive);
         }
-        if (!showRemoveFolder && !showArchive) {
+        if (!showRemoveFolder && !showArchive
+                && Utils.shouldShowDisabledArchiveIcon(mActivity.getActivityContext())) {
             archive.setEnabled(false);
             archive.setVisible(true);
         }
diff --git a/src/com/android/mail/utils/Utils.java b/src/com/android/mail/utils/Utils.java
index 2fbdc72..cf7d9d6 100644
--- a/src/com/android/mail/utils/Utils.java
+++ b/src/com/android/mail/utils/Utils.java
@@ -987,4 +987,12 @@
     public static boolean showTwoPaneSearchResults(Context context) {
         return context.getResources().getBoolean(R.bool.show_two_pane_search_results);
     }
+
+    /**
+     * Return whether menus should show the disabled archive menu item or just
+     * remove it when archive is not available.
+     */
+    public static boolean shouldShowDisabledArchiveIcon(Context context) {
+        return context.getResources().getBoolean(R.bool.show_disabled_archive_menu_item);
+    }
 }