Show unreadcount in top spinner.

Change-Id: I230cfd43a7a4024e61c6188458db2ec90da53c9e
diff --git a/res/layout/account_switch_spinner_item.xml b/res/layout/account_switch_spinner_item.xml
index 99cc709..af72ade 100644
--- a/res/layout/account_switch_spinner_item.xml
+++ b/res/layout/account_switch_spinner_item.xml
@@ -30,12 +30,12 @@
         android:layout_marginLeft="4dp"
         style="@style/UnreadCountActionBar" />
 
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical"
-            android:gravity="center_vertical"
-            android:layout_toLeftOf="@id/unread">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:gravity="center_vertical"
+        android:layout_toLeftOf="@id/unread">
             <TextView
                 android:id="@+id/account_spinner_folder"
                 style="@android:style/TextAppearance.Holo.Widget.ActionBar.Title.Inverse"
@@ -54,5 +54,5 @@
                 android:layout_marginRight="4dp"
                 android:layout_width="wrap_content"
                 android:layout_height="match_parent" />
-        </LinearLayout>
+    </LinearLayout>
 </RelativeLayout>
diff --git a/src/com/android/mail/AccountSpinnerAdapter.java b/src/com/android/mail/AccountSpinnerAdapter.java
index 686aeb2..4d5e3a0 100644
--- a/src/com/android/mail/AccountSpinnerAdapter.java
+++ b/src/com/android/mail/AccountSpinnerAdapter.java
@@ -73,7 +73,7 @@
      */
     private static class DropdownHolder {
         TextView folder;
-        TextView unread_count;
+        TextView unreadCount;
     }
 
     /**
@@ -201,6 +201,10 @@
         return mCurrentFolder != null ? mCurrentFolder.name : "";
     }
 
+    private int getFolderUnreadCount() {
+        return mCurrentFolder != null ? mCurrentFolder.unreadCount : 0;
+    }
+
     @Override
     public View getView(int position, View convertView, ViewGroup parent) {
         String folderName = "";
@@ -211,6 +215,7 @@
                 // The default Inbox for the given account
                 accountName = getAccountLabel(position);
                 folderName = getFolderLabel();
+                unreadCount = getFolderUnreadCount();
                 break;
             case TYPE_HEADER:
                 accountName = getAccountLabel(0);
@@ -307,7 +312,7 @@
             convertView = mInflater.inflate(R.layout.account_switch_spinner_dropdown_item, null);
             dropdown = new DropdownHolder();
             dropdown.folder = (TextView) convertView.findViewById(R.id.account_spinner_accountname);
-            dropdown.unread_count =
+            dropdown.unreadCount =
                     (TextView) convertView.findViewById(R.id.account_spinner_unread_count);
             convertView.setTag(dropdown);
         } else {
@@ -315,11 +320,11 @@
         }
 
         dropdown.folder.setText(textLabel);
-        dropdown.unread_count.setText(String.valueOf(unreadCount));
+        dropdown.unreadCount.setText(String.valueOf(unreadCount));
         if (unreadCount == 0) {
-            dropdown.unread_count.setVisibility(View.GONE);
+            dropdown.unreadCount.setVisibility(View.GONE);
         } else {
-            dropdown.unread_count.setVisibility(View.VISIBLE);
+            dropdown.unreadCount.setVisibility(View.VISIBLE);
         }
         return convertView;