diff options
author | Mindy Pereira <mindyp@google.com> | 2012-02-29 13:09:58 -0800 |
---|---|---|
committer | Mindy Pereira <mindyp@google.com> | 2012-02-29 13:09:58 -0800 |
commit | ae1802027f0e7588b6e0d7a897d8f5d83a8aa5e4 (patch) | |
tree | 9ee376dd6336428011e9768da971c1679f99f81a | |
parent | 4e26e959074bce8525e66c13dc187b3be974290e (diff) | |
download | android_packages_apps_UnifiedEmail-ae1802027f0e7588b6e0d7a897d8f5d83a8aa5e4.tar.gz android_packages_apps_UnifiedEmail-ae1802027f0e7588b6e0d7a897d8f5d83a8aa5e4.tar.bz2 android_packages_apps_UnifiedEmail-ae1802027f0e7588b6e0d7a897d8f5d83a8aa5e4.zip |
Change label to folder for the accountswitchspinner
In preparation of using real folders in the spinner.
Change-Id: Ied8349022cd9f0454377567384969387e15ee768
-rw-r--r-- | res/layout-sw600dp/account_switch_spinner_item.xml | 2 | ||||
-rw-r--r-- | res/layout/account_switch_spinner_dropdown_item.xml | 4 | ||||
-rw-r--r-- | res/layout/account_switch_spinner_item.xml | 2 | ||||
-rw-r--r-- | src/com/android/mail/AccountSpinnerAdapter.java | 38 |
4 files changed, 22 insertions, 24 deletions
diff --git a/res/layout-sw600dp/account_switch_spinner_item.xml b/res/layout-sw600dp/account_switch_spinner_item.xml index 535617bcf..ead0665dc 100644 --- a/res/layout-sw600dp/account_switch_spinner_item.xml +++ b/res/layout-sw600dp/account_switch_spinner_item.xml @@ -40,7 +40,7 @@ android:orientation="vertical" android:gravity="center_vertical"> <TextView - android:id="@+id/account_spinner_label" + android:id="@+id/account_spinner_folder" style="@android:style/TextAppearance.Holo.Widget.ActionBar.Title.Inverse" android:singleLine="true" android:ellipsize="end" diff --git a/res/layout/account_switch_spinner_dropdown_item.xml b/res/layout/account_switch_spinner_dropdown_item.xml index 230974bb6..3fd39539e 100644 --- a/res/layout/account_switch_spinner_dropdown_item.xml +++ b/res/layout/account_switch_spinner_dropdown_item.xml @@ -30,7 +30,7 @@ android:layout_width="0dip" android:layout_weight="1"> <TextView - android:id="@+id/account_spinner_label" + android:id="@+id/account_spinner_folder" android:singleLine="true" android:layout_height="wrap_content" android:layout_width="match_parent" @@ -43,7 +43,7 @@ android:layout_height="wrap_content" android:layout_width="match_parent" android:ellipsize="end" - android:layout_below="@id/account_spinner_label" + android:layout_below="@id/account_spinner_folder" style="@style/AccountSpinnerDropdownTextSecondary" /> </RelativeLayout> diff --git a/res/layout/account_switch_spinner_item.xml b/res/layout/account_switch_spinner_item.xml index 790e0f71f..99cc70954 100644 --- a/res/layout/account_switch_spinner_item.xml +++ b/res/layout/account_switch_spinner_item.xml @@ -37,7 +37,7 @@ android:gravity="center_vertical" android:layout_toLeftOf="@id/unread"> <TextView - android:id="@+id/account_spinner_label" + android:id="@+id/account_spinner_folder" style="@android:style/TextAppearance.Holo.Widget.ActionBar.Title.Inverse" android:singleLine="true" android:ellipsize="end" diff --git a/src/com/android/mail/AccountSpinnerAdapter.java b/src/com/android/mail/AccountSpinnerAdapter.java index 5f7ba6abd..ab1827730 100644 --- a/src/com/android/mail/AccountSpinnerAdapter.java +++ b/src/com/android/mail/AccountSpinnerAdapter.java @@ -30,7 +30,7 @@ import com.android.mail.providers.Account; import com.android.mail.providers.UIProvider; /** - * An adapter to return the list of accounts and labels for the Account Spinner. + * An adapter to return the list of accounts and folders for the Account Spinner. * This class keeps the account and folder information and returns appropriate views. */ public class AccountSpinnerAdapter extends BaseAdapter { @@ -53,7 +53,7 @@ public class AccountSpinnerAdapter extends BaseAdapter { */ static final int NAME_COLUMN = 2; /** - * Fake labels for now + * Fake folders for now */ private final String[] mFolders; /** @@ -68,7 +68,7 @@ public class AccountSpinnerAdapter extends BaseAdapter { * dropdown list has two textviews. */ private static class DropdownHolder { - TextView label; + TextView folder; TextView unread_count; } @@ -80,10 +80,10 @@ public class AccountSpinnerAdapter extends BaseAdapter { } /** - * The spinner shows the name of the label, the account name, and the unread count. + * The spinner shows the name of the folder, the account name, and the unread count. */ private static class ViewHolder { - TextView label; + TextView folder; TextView account; TextView unread_count; } @@ -135,7 +135,7 @@ public class AccountSpinnerAdapter extends BaseAdapter { @Override public int getCount() { - // All the accounts, plus one header, and optionally some labels + // All the accounts, plus one header, and optionally some folders return mNumAccounts + 1 + mFolders.length; } @@ -179,17 +179,17 @@ public class AccountSpinnerAdapter extends BaseAdapter { switch (getType(position)) { case TYPE_ACCOUNT: // The default Inbox for the given account - accountName = getAccountLabel(position); + accountName = getAccountFolder(position); folderName = "Inbox"; break; case TYPE_HEADER: // We can never select the header, and we want the default view to be the Inbox. // TODO: This should handle an empty account array - accountName = getAccountLabel(0); + accountName = getAccountFolder(0); folderName = "Inbox"; break; default: - // Change the name of the current label + // Change the name of the current folder final int offset = position - mNumAccounts - 1; accountName = (mCurrentAccount == null) ? "" : mCurrentAccount.name; folderName = mFolders[offset]; @@ -197,24 +197,22 @@ public class AccountSpinnerAdapter extends BaseAdapter { break; } - // Return a view with the label on the first line and the account name on the second. + // Return a view with the folder on the first line and the account name on the second. ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.account_switch_spinner_item, null); holder = new ViewHolder(); holder.account = (TextView) convertView.findViewById(R.id.account_spinner_account_name); - holder.label = - (TextView) convertView.findViewById(R.id.account_spinner_label); + holder.folder = + (TextView) convertView.findViewById(R.id.account_spinner_folder); holder.unread_count = (TextView) convertView.findViewById(R.id.unread); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } - // TODO(viki): Fill with a real label here. - // TODO(viki): Also rename label to folder. - holder.label.setText(folderName); + holder.folder.setText(folderName); holder.account.setText(accountName); // Fake unread counts for now. holder.unread_count.setText(String.valueOf(unreadCount)); @@ -266,7 +264,7 @@ public class AccountSpinnerAdapter extends BaseAdapter { header.account.setText(label); return convertView; case TYPE_ACCOUNT: - textLabel = getAccountLabel(position); + textLabel = getAccountFolder(position); break; case TYPE_FOLDER: final int offset = position - mNumAccounts - 1; @@ -279,7 +277,7 @@ public class AccountSpinnerAdapter extends BaseAdapter { if (convertView == null || !(convertView.getTag() instanceof DropdownHolder)) { convertView = mInflater.inflate(R.layout.account_switch_spinner_dropdown_item, null); dropdown = new DropdownHolder(); - dropdown.label = (TextView) convertView.findViewById(R.id.account_spinner_accountname); + dropdown.folder = (TextView) convertView.findViewById(R.id.account_spinner_accountname); dropdown.unread_count = (TextView) convertView.findViewById(R.id.account_spinner_unread_count); convertView.setTag(dropdown); @@ -287,7 +285,7 @@ public class AccountSpinnerAdapter extends BaseAdapter { dropdown = (DropdownHolder) convertView.getTag(); } - dropdown.label.setText(textLabel); + dropdown.folder.setText(textLabel); dropdown.unread_count.setText(String.valueOf(unreadCount)); if (unreadCount == 0) { dropdown.unread_count.setVisibility(View.GONE); @@ -299,11 +297,11 @@ public class AccountSpinnerAdapter extends BaseAdapter { } /** - * Returns the name of the label at the given position in the spinner. + * Returns the name of the folder at the given position in the spinner. * @param position * @return the label of the account at the given position. */ - private String getAccountLabel(int position) { + private String getAccountFolder(int position) { if (position >= mNumAccounts) { return ""; } |