From b19516e24836c9479c6ecfbf3d54d58cf64782ed Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Thu, 2 Jun 2011 10:42:56 -0700 Subject: [PATCH] Add proper wording for "all accounts" picker item Per discussion w/ UX. Change-Id: Ida4a11828d2bb157c4bc0c66f84d877013f0e4d7 --- res/values/strings.xml | 7 +++++++ .../email/activity/ShortcutPickerFragment.java | 15 ++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 3a968513d..f610a2397 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -225,6 +225,13 @@ Inbox (unread) Inbox (all) + + Combined view (%s) + + + %d account + %d accounts + Version: %s diff --git a/src/com/android/email/activity/ShortcutPickerFragment.java b/src/com/android/email/activity/ShortcutPickerFragment.java index 1ffe0adad..fe8bb1f59 100644 --- a/src/com/android/email/activity/ShortcutPickerFragment.java +++ b/src/com/android/email/activity/ShortcutPickerFragment.java @@ -30,6 +30,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.CursorLoader; import android.content.Loader; +import android.content.res.Resources; import android.database.Cursor; import android.database.MatrixCursor; import android.database.MergeCursor; @@ -147,12 +148,13 @@ public abstract class ShortcutPickerFragment extends ListFragment @Override public Cursor loadInBackground() { Cursor parentCursor = super.loadInBackground(); - Cursor returnCursor; + int cursorCount = parentCursor.getCount(); + final Cursor returnCursor; - if (parentCursor.getCount() > 1) { + if (cursorCount > 1) { // Only add "All accounts" if there is more than 1 account defined MatrixCursor allAccountCursor = new MatrixCursor(getProjection()); - addCombinedAccountRow(allAccountCursor); + addCombinedAccountRow(allAccountCursor, cursorCount); returnCursor = new MergeCursor(new Cursor[] { allAccountCursor, parentCursor }); } else { returnCursor = parentCursor; @@ -161,11 +163,14 @@ public abstract class ShortcutPickerFragment extends ListFragment } /** Adds a row for "All Accounts" into the given cursor */ - private void addCombinedAccountRow(MatrixCursor cursor) { + private void addCombinedAccountRow(MatrixCursor cursor, int accountCount) { Context context = getContext(); Account account = new Account(); account.mId = Account.ACCOUNT_ID_COMBINED_VIEW; - account.mDisplayName = context.getString(R.string.account_name_display_all); + Resources res = context.getResources(); + String countString = res.getQuantityString(R.plurals.picker_combined_view_account_count, + accountCount, accountCount); + account.mDisplayName = res.getString(R.string.picker_combined_view_fmt, countString); ContentValues values = account.toContentValues(); RowBuilder row = cursor.newRow(); for (String rowName : cursor.getColumnNames()) {