Merge "Enable supression of combined account" into ub-mail-master

This commit is contained in:
Paul Westbrook 2014-06-20 16:40:38 +00:00 committed by Android (Google) Code Review
commit c24d5d4f19
2 changed files with 12 additions and 3 deletions

View File

@ -144,6 +144,11 @@ public abstract class EmailContent {
public static String NOTIFIER_AUTHORITY;
public static Uri CONTENT_URI;
public static final String PARAMETER_LIMIT = "limit";
/**
* Query parameter for the UI accounts query to enable suppression of the combined account.
*/
public static final String SUPPRESS_COMBINED_ACCOUNT_PARAM = "suppress_combined";
public static Uri CONTENT_NOTIFIER_URI;
public static Uri PICK_TRASH_FOLDER_URI;
public static Uri PICK_SENT_FOLDER_URI;

View File

@ -1289,7 +1289,11 @@ public class EmailProvider extends ContentProvider
c = uiSearch(uri, projection);
return c;
case UI_ACCTS:
c = uiAccounts(projection);
final String suppressParam =
uri.getQueryParameter(EmailContent.SUPPRESS_COMBINED_ACCOUNT_PARAM);
final boolean suppressCombined =
suppressParam != null && Boolean.parseBoolean(suppressParam);
c = uiAccounts(projection, suppressCombined);
return c;
case UI_UNDO:
return uiUndo(projection);
@ -3801,7 +3805,7 @@ public class EmailProvider extends ContentProvider
return values;
}
private Cursor uiAccounts(String[] uiProjection) {
private Cursor uiAccounts(String[] uiProjection, boolean suppressCombined) {
final Context context = getContext();
final SQLiteDatabase db = getDatabase(context);
final Cursor accountIdCursor =
@ -3809,7 +3813,7 @@ public class EmailProvider extends ContentProvider
final MatrixCursor mc;
try {
boolean combinedAccount = false;
if (accountIdCursor.getCount() > 1) {
if (!suppressCombined && accountIdCursor.getCount() > 1) {
combinedAccount = true;
}
final Bundle extras = new Bundle();