Reorder the folders in combined view.

Inbox should go to top.

Change-Id: I90c55952aaa3955adfd6d08a12a568bfb192c730
This commit is contained in:
Yu Ping Hu 2013-04-05 16:35:51 -07:00
parent fcddd014da
commit 2930476051

View File

@ -3204,8 +3204,16 @@ outer:
String id = uri.getPathSegments().get(1); String id = uri.getPathSegments().get(1);
if (id.equals(COMBINED_ACCOUNT_ID_STRING)) { if (id.equals(COMBINED_ACCOUNT_ID_STRING)) {
MatrixCursor mc = new MatrixCursorWithCachedColumns(UIProvider.FOLDERS_PROJECTION, 3); MatrixCursor mc = new MatrixCursorWithCachedColumns(UIProvider.FOLDERS_PROJECTION, 3);
Object[] row;
int count; int count;
Object[] row;
count = EmailContent.count(context, Message.CONTENT_URI,
MessageColumns.MAILBOX_KEY + " IN (SELECT " + MailboxColumns.ID +
" FROM " + Mailbox.TABLE_NAME + " WHERE " + MailboxColumns.TYPE +
"=" + Mailbox.TYPE_INBOX + ") AND " + MessageColumns.FLAG_READ + "=0", null);
row = getVirtualMailboxRow(COMBINED_ACCOUNT_ID, Mailbox.TYPE_INBOX);
row[UIProvider.FOLDER_UNREAD_COUNT_COLUMN] = count;
row[UIProvider.FOLDER_ICON_RES_ID_COLUMN] = R.drawable.ic_folder_inbox_holo_light;
mc.addRow(row);
count = EmailContent.count(context, Message.CONTENT_URI, count = EmailContent.count(context, Message.CONTENT_URI,
MessageColumns.FLAG_FAVORITE + "=1", null); MessageColumns.FLAG_FAVORITE + "=1", null);
row = getVirtualMailboxRow(COMBINED_ACCOUNT_ID, Mailbox.TYPE_STARRED); row = getVirtualMailboxRow(COMBINED_ACCOUNT_ID, Mailbox.TYPE_STARRED);
@ -3221,14 +3229,6 @@ outer:
// TODO: Hijacking the mark unread icon for now. // TODO: Hijacking the mark unread icon for now.
row[UIProvider.FOLDER_ICON_RES_ID_COLUMN] = R.drawable.ic_menu_mark_unread_holo_light; row[UIProvider.FOLDER_ICON_RES_ID_COLUMN] = R.drawable.ic_menu_mark_unread_holo_light;
mc.addRow(row); mc.addRow(row);
row = getVirtualMailboxRow(COMBINED_ACCOUNT_ID, Mailbox.TYPE_INBOX);
count = EmailContent.count(context, Message.CONTENT_URI,
MessageColumns.MAILBOX_KEY + " IN (SELECT " + MailboxColumns.ID +
" FROM " + Mailbox.TABLE_NAME + " WHERE " + MailboxColumns.TYPE +
"=" + Mailbox.TYPE_INBOX + ") AND " + MessageColumns.FLAG_READ + "=0", null);
row[UIProvider.FOLDER_UNREAD_COUNT_COLUMN] = count;
row[UIProvider.FOLDER_ICON_RES_ID_COLUMN] = R.drawable.ic_folder_inbox_holo_light;
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});