Show unread count in CAB mode. b/17204324

Change-Id: I20b01e7b018f625646349e9a11df630d70ba35d1
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b9003c8..d9986e5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -287,9 +287,6 @@
     <string name="contextmenu_feedback">Send feedback</string>
 
     <!-- Browse list item strings -->
-    <!-- Text indicating how many messages are selected in the top action bar
-    [CHAR LIMIT=40] -->
-    <string name="num_selected"><xliff:g id="number" example="7">%d</xliff:g></string>
     <!-- Formatting string for the content description field of a conversation list item when device is in accessibility mode. [CHAR LIMIT=250] -->
     <string name="content_description"><xliff:g id="toHeader">%1$s</xliff:g><xliff:g id="participant">%2$s</xliff:g> about <xliff:g id="subject">%3$s</xliff:g>, <xliff:g id="snippet">%4$s</xliff:g> on <xliff:g id="date">%5$s</xliff:g>, <xliff:g id="readstate">%6$s</xliff:g></string>
     <!-- Formatting string for the content description field of a conversation list item when device is in accessibility mode and the message was received today. [CHAR LIMI=250] -->
diff --git a/src/com/android/mail/browse/SelectedConversationsActionMenu.java b/src/com/android/mail/browse/SelectedConversationsActionMenu.java
index fd0933f..e3b9581 100644
--- a/src/com/android/mail/browse/SelectedConversationsActionMenu.java
+++ b/src/com/android/mail/browse/SelectedConversationsActionMenu.java
@@ -349,6 +349,7 @@
         final MenuInflater inflater = mActivity.getMenuInflater();
         inflater.inflate(R.menu.conversation_list_selection_actions_menu, menu);
         mActionMode = mode;
+        updateCount();
         return true;
     }
 
@@ -520,6 +521,7 @@
         if (set.isEmpty()) {
             return;
         }
+        updateCount();
 
         if (mFolder.isType(FolderType.OUTBOX) && mDiscardOutboxMenuItem != null) {
             mDiscardOutboxMenuItem.setEnabled(shouldEnableDiscardOutbox(set.values()));
@@ -527,6 +529,15 @@
     }
 
     /**
+     * Updates the visible count of how many conversations are selected.
+     */
+    private void updateCount() {
+        if (mActionMode != null) {
+            mActionMode.setTitle(Integer.toString(mCheckedSet.size()));
+        }
+    }
+
+    /**
      * Activates and shows this menu (essentially starting an {@link ActionMode}) if the selected
      * set is non-empty.
      */