am 8a11cb8f: Merge "Always show the starred folder." into jb-ub-mail-ur9

* commit '8a11cb8fd1b52cbcc413be04970e38e738617b54':
  Always show the starred folder.
This commit is contained in:
Yu Ping Hu 2013-03-21 16:06:04 +00:00 committed by Android Git Automerger
commit 1cd14f3f95

View File

@ -3171,11 +3171,9 @@ outer:
mc.addRow(row); mc.addRow(row);
int numStarred = EmailContent.count(context, Message.CONTENT_URI, int numStarred = EmailContent.count(context, Message.CONTENT_URI,
MessageColumns.FLAG_FAVORITE + "=1", null); MessageColumns.FLAG_FAVORITE + "=1", null);
if (numStarred > 0) { row = getVirtualMailboxRow(COMBINED_ACCOUNT_ID, Mailbox.TYPE_STARRED);
row = getVirtualMailboxRow(COMBINED_ACCOUNT_ID, Mailbox.TYPE_STARRED); row[UIProvider.FOLDER_UNREAD_COUNT_COLUMN] = numStarred;
row[UIProvider.FOLDER_UNREAD_COUNT_COLUMN] = numStarred; mc.addRow(row);
mc.addRow(row);
}
return mc; return mc;
} else { } else {
Cursor c = db.rawQuery(genQueryAccountMailboxes(uiProjection), new String[] {id}); Cursor c = db.rawQuery(genQueryAccountMailboxes(uiProjection), new String[] {id});
@ -3183,19 +3181,15 @@ outer:
int numStarred = EmailContent.count(context, Message.CONTENT_URI, int numStarred = EmailContent.count(context, Message.CONTENT_URI,
MessageColumns.ACCOUNT_KEY + "=? AND " + MessageColumns.FLAG_FAVORITE + "=1", MessageColumns.ACCOUNT_KEY + "=? AND " + MessageColumns.FLAG_FAVORITE + "=1",
new String[] {id}); new String[] {id});
if (numStarred == 0) { // Add starred virtual folder to the cursor
return c; // Show number of messages as unread count (for backward compatibility)
} else { MatrixCursor starCursor = new MatrixCursorWithCachedColumns(uiProjection, 1);
// Add starred virtual folder to the cursor Object[] row = getVirtualMailboxRow(Long.parseLong(id), Mailbox.TYPE_STARRED);
// Show number of messages as unread count (for backward compatibility) row[UIProvider.FOLDER_UNREAD_COUNT_COLUMN] = numStarred;
MatrixCursor starCursor = new MatrixCursorWithCachedColumns(uiProjection, 1); row[UIProvider.FOLDER_ICON_RES_ID_COLUMN] = R.drawable.ic_menu_star_holo_light;
Object[] row = getVirtualMailboxRow(Long.parseLong(id), Mailbox.TYPE_STARRED); starCursor.addRow(row);
row[UIProvider.FOLDER_UNREAD_COUNT_COLUMN] = numStarred; Cursor[] cursors = new Cursor[] {starCursor, c};
row[UIProvider.FOLDER_ICON_RES_ID_COLUMN] = R.drawable.ic_menu_star_holo_light; return new MergeCursor(cursors);
starCursor.addRow(row);
Cursor[] cursors = new Cursor[] {starCursor, c};
return new MergeCursor(cursors);
}
} }
} }