Merge "Add account color to message list for combined account" into jb-ub-mail
This commit is contained in:
commit
40f3516047
@ -48,27 +48,38 @@
|
||||
android:textSize="@dimen/senders_font_size"
|
||||
android:lines="1"
|
||||
android:layout_toRightOf="@id/reply_state" />
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/total_conversationbar_width"
|
||||
android:layout_alignParentRight="true">
|
||||
<ImageView
|
||||
android:id="@+id/paperclip"
|
||||
android:layout_width="wrap_content"
|
||||
<View android:id="@+id/color_bar"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_height="@dimen/color_block_height"
|
||||
android:layout_width="@dimen/total_conversationbar_width" />
|
||||
<LinearLayout
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_attachment_holo_light"
|
||||
android:layout_marginTop="6sp" />
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/long_string"
|
||||
android:textSize="@dimen/date_font_size"
|
||||
android:lines="1"
|
||||
android:layout_marginRight="16dip"
|
||||
android:layout_marginTop="10sp" />
|
||||
</LinearLayout>
|
||||
android:layout_width="@dimen/total_conversationbar_width"
|
||||
android:layout_alignParentRight="true">
|
||||
<ImageView
|
||||
android:id="@+id/paperclip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_attachment_holo_light"
|
||||
android:layout_marginTop="6sp" />
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/long_string"
|
||||
android:textSize="@dimen/date_font_size"
|
||||
android:lines="1"
|
||||
android:layout_marginRight="16dip"
|
||||
android:layout_marginTop="10sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -1970,6 +1970,26 @@ outer:
|
||||
") !=0 THEN " + UIProvider.ConversationFlags.REPLIED +
|
||||
" ELSE 0 END";
|
||||
|
||||
/**
|
||||
* Array of pre-defined account colors (legacy colors from old email app)
|
||||
*/
|
||||
private static final int[] ACCOUNT_COLORS = new int[] {
|
||||
0xff71aea7, 0xff621919, 0xff18462f, 0xffbf8e52, 0xff001f79,
|
||||
0xffa8afc2, 0xff6b64c4, 0xff738359, 0xff9d50a4
|
||||
};
|
||||
|
||||
private static final String CONVERSATION_COLOR =
|
||||
"@CASE (" + MessageColumns.ACCOUNT_KEY + " - 1) % " + ACCOUNT_COLORS.length +
|
||||
" WHEN 0 THEN " + ACCOUNT_COLORS[0] +
|
||||
" WHEN 1 THEN " + ACCOUNT_COLORS[1] +
|
||||
" WHEN 2 THEN " + ACCOUNT_COLORS[2] +
|
||||
" WHEN 3 THEN " + ACCOUNT_COLORS[3] +
|
||||
" WHEN 4 THEN " + ACCOUNT_COLORS[4] +
|
||||
" WHEN 5 THEN " + ACCOUNT_COLORS[5] +
|
||||
" WHEN 6 THEN " + ACCOUNT_COLORS[6] +
|
||||
" WHEN 7 THEN " + ACCOUNT_COLORS[7] +
|
||||
" WHEN 8 THEN " + ACCOUNT_COLORS[8] +
|
||||
" END";
|
||||
/**
|
||||
* Mapping of UIProvider columns to EmailProvider columns for the message list (called the
|
||||
* conversation list in UnifiedEmail)
|
||||
@ -1996,7 +2016,6 @@ outer:
|
||||
.add(UIProvider.ConversationColumns.FLAGS, CONVERSATION_FLAGS)
|
||||
.build();
|
||||
|
||||
|
||||
/**
|
||||
* Generate UIProvider draft type; note the test for "reply all" must come before "reply"
|
||||
*/
|
||||
@ -2177,7 +2196,12 @@ outer:
|
||||
String val = null;
|
||||
// First look at values; this is an override of default behavior
|
||||
if (values.containsKey(column)) {
|
||||
val = "'" + values.getAsString(column) + "' AS " + column;
|
||||
String value = values.getAsString(column);
|
||||
if (value.startsWith("@")) {
|
||||
val = value.substring(1) + " AS " + column;
|
||||
} else {
|
||||
val = "'" + values.getAsString(column) + "' AS " + column;
|
||||
}
|
||||
} else {
|
||||
// Now, get the standard value for the column from our projection map
|
||||
val = map.get(column);
|
||||
@ -2322,7 +2346,9 @@ outer:
|
||||
*/
|
||||
private Cursor getVirtualMailboxMessagesCursor(SQLiteDatabase db, String[] uiProjection,
|
||||
long mailboxId) {
|
||||
StringBuilder sb = genSelect(sMessageListMap, uiProjection);
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(UIProvider.ConversationColumns.COLOR, CONVERSATION_COLOR);
|
||||
StringBuilder sb = genSelect(sMessageListMap, uiProjection, values);
|
||||
if (isCombinedMailbox(mailboxId)) {
|
||||
switch (getVirtualMailboxType(mailboxId)) {
|
||||
case Mailbox.TYPE_INBOX:
|
||||
|
Loading…
Reference in New Issue
Block a user