Merge "Set draftType in outgoing messages and return it"
This commit is contained in:
commit
19589ec241
@ -741,7 +741,6 @@ public abstract class EmailContent {
|
|||||||
// Bits used in mFlags
|
// Bits used in mFlags
|
||||||
// The following three states are mutually exclusive, and indicate whether the message is an
|
// The following three states are mutually exclusive, and indicate whether the message is an
|
||||||
// original, a reply, or a forward
|
// original, a reply, or a forward
|
||||||
public static final int FLAG_TYPE_ORIGINAL = 0;
|
|
||||||
public static final int FLAG_TYPE_REPLY = 1<<0;
|
public static final int FLAG_TYPE_REPLY = 1<<0;
|
||||||
public static final int FLAG_TYPE_FORWARD = 1<<1;
|
public static final int FLAG_TYPE_FORWARD = 1<<1;
|
||||||
public static final int FLAG_TYPE_MASK = FLAG_TYPE_REPLY | FLAG_TYPE_FORWARD;
|
public static final int FLAG_TYPE_MASK = FLAG_TYPE_REPLY | FLAG_TYPE_FORWARD;
|
||||||
@ -772,6 +771,12 @@ public abstract class EmailContent {
|
|||||||
public static final int FLAG_REPLIED_TO = 1 << 18;
|
public static final int FLAG_REPLIED_TO = 1 << 18;
|
||||||
public static final int FLAG_FORWARDED = 1 << 19;
|
public static final int FLAG_FORWARDED = 1 << 19;
|
||||||
|
|
||||||
|
// Outgoing, original message
|
||||||
|
public static final int FLAG_TYPE_ORIGINAL = 1 << 20;
|
||||||
|
// Outgoing, reply all message; note, FLAG_TYPE_REPLY should also be set for backward
|
||||||
|
// compatibility
|
||||||
|
public static final int FLAG_TYPE_REPLY_ALL = 1 << 21;
|
||||||
|
|
||||||
/** a pseudo ID for "no message". */
|
/** a pseudo ID for "no message". */
|
||||||
public static final long NO_MESSAGE = -1L;
|
public static final long NO_MESSAGE = -1L;
|
||||||
|
|
||||||
|
@ -1985,6 +1985,21 @@ outer:
|
|||||||
.add(UIProvider.ConversationColumns.FLAGS, getConversationFlags())
|
.add(UIProvider.ConversationColumns.FLAGS, getConversationFlags())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate UIProvider draft type; note the test for "reply all" must come before "reply"
|
||||||
|
*/
|
||||||
|
private static final String MESSAGE_DRAFT_TYPE =
|
||||||
|
"CASE WHEN (" + MessageColumns.FLAGS + "&" + Message.FLAG_TYPE_ORIGINAL +
|
||||||
|
") !=0 THEN " + UIProvider.DraftType.COMPOSE +
|
||||||
|
" WHEN (" + MessageColumns.FLAGS + "&" + (1<<20) +
|
||||||
|
") !=0 THEN " + UIProvider.DraftType.REPLY_ALL +
|
||||||
|
" WHEN (" + MessageColumns.FLAGS + "&" + Message.FLAG_TYPE_REPLY +
|
||||||
|
") !=0 THEN " + UIProvider.DraftType.REPLY +
|
||||||
|
" WHEN (" + MessageColumns.FLAGS + "&" + Message.FLAG_TYPE_FORWARD +
|
||||||
|
") !=0 THEN " + UIProvider.DraftType.FORWARD +
|
||||||
|
" ELSE " + UIProvider.DraftType.NOT_A_DRAFT + " END";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapping of UIProvider columns to EmailProvider columns for a detailed message view in
|
* Mapping of UIProvider columns to EmailProvider columns for a detailed message view in
|
||||||
* UnifiedEmail
|
* UnifiedEmail
|
||||||
@ -2010,7 +2025,8 @@ outer:
|
|||||||
.add(UIProvider.MessageColumns.DRAFT_TYPE, NOT_A_DRAFT_STRING)
|
.add(UIProvider.MessageColumns.DRAFT_TYPE, NOT_A_DRAFT_STRING)
|
||||||
.add(UIProvider.MessageColumns.APPEND_REF_MESSAGE_CONTENT, "0")
|
.add(UIProvider.MessageColumns.APPEND_REF_MESSAGE_CONTENT, "0")
|
||||||
.add(UIProvider.MessageColumns.HAS_ATTACHMENTS, EmailContent.MessageColumns.FLAG_ATTACHMENT)
|
.add(UIProvider.MessageColumns.HAS_ATTACHMENTS, EmailContent.MessageColumns.FLAG_ATTACHMENT)
|
||||||
.add(UIProvider.MessageColumns.ATTACHMENT_LIST_URI, uriWithFQId("uiattachments", Message.TABLE_NAME))
|
.add(UIProvider.MessageColumns.ATTACHMENT_LIST_URI,
|
||||||
|
uriWithFQId("uiattachments", Message.TABLE_NAME))
|
||||||
.add(UIProvider.MessageColumns.MESSAGE_FLAGS, "0")
|
.add(UIProvider.MessageColumns.MESSAGE_FLAGS, "0")
|
||||||
.add(UIProvider.MessageColumns.SAVE_MESSAGE_URI,
|
.add(UIProvider.MessageColumns.SAVE_MESSAGE_URI,
|
||||||
uriWithFQId("uiupdatedraft", Message.TABLE_NAME))
|
uriWithFQId("uiupdatedraft", Message.TABLE_NAME))
|
||||||
@ -2018,6 +2034,7 @@ outer:
|
|||||||
uriWithFQId("uisenddraft", Message.TABLE_NAME))
|
uriWithFQId("uisenddraft", Message.TABLE_NAME))
|
||||||
// TODO(pwestbro): make this actually return valid results.
|
// TODO(pwestbro): make this actually return valid results.
|
||||||
.add(UIProvider.MessageColumns.ALWAYS_SHOW_IMAGES, "0")
|
.add(UIProvider.MessageColumns.ALWAYS_SHOW_IMAGES, "0")
|
||||||
|
.add(UIProvider.MessageColumns.DRAFT_TYPE, MESSAGE_DRAFT_TYPE)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2809,10 +2826,15 @@ outer:
|
|||||||
case DraftType.FORWARD:
|
case DraftType.FORWARD:
|
||||||
flags |= Message.FLAG_TYPE_FORWARD;
|
flags |= Message.FLAG_TYPE_FORWARD;
|
||||||
break;
|
break;
|
||||||
case DraftType.REPLY:
|
|
||||||
case DraftType.REPLY_ALL:
|
case DraftType.REPLY_ALL:
|
||||||
|
flags |= Message.FLAG_TYPE_REPLY_ALL;
|
||||||
|
// Fall through
|
||||||
|
case DraftType.REPLY:
|
||||||
flags |= Message.FLAG_TYPE_REPLY;
|
flags |= Message.FLAG_TYPE_REPLY;
|
||||||
break;
|
break;
|
||||||
|
case DraftType.COMPOSE:
|
||||||
|
flags |= Message.FLAG_TYPE_ORIGINAL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
msg.mFlags = flags;
|
msg.mFlags = flags;
|
||||||
String ref = values.getAsString(UIProvider.MessageColumns.REF_MESSAGE_ID);
|
String ref = values.getAsString(UIProvider.MessageColumns.REF_MESSAGE_ID);
|
||||||
|
Loading…
Reference in New Issue
Block a user