mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Add ability to Flag/Unflag messages. Flagged messages are shown with
a red/bold subject. Can be done in the FolderMessageList using the hotkey G (toggle) or by long-pressing the message to bring up the message context menu. Can be done while viewing an individual message by using the hotkey G (toggle). To-do: add a Flag/Unflag option to a menu in the individual message view. Add sending the Answered flag to the IMAP server when replying to a message. This is currently done as soon as the reply is started. Perhaps it would be better to wait until the reply is sent, but that would require keeping additional state with the draft. Messages to which the user has replied are indicated with a white arrow next to the subject. To-do: In the MessageView, provide visual indication of Flagged and Answered states.
This commit is contained in:
parent
5b49112a98
commit
172adeee22
BIN
res/drawable/ic_mms_answered_small.png
Normal file
BIN
res/drawable/ic_mms_answered_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 798 B |
@ -24,6 +24,10 @@
|
|||||||
android:id="@+id/mark_as_read"
|
android:id="@+id/mark_as_read"
|
||||||
android:title="@string/mark_as_read_action"
|
android:title="@string/mark_as_read_action"
|
||||||
/>
|
/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/flag"
|
||||||
|
android:title="@string/flag_action"
|
||||||
|
/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/send_alternate"
|
android:id="@+id/send_alternate"
|
||||||
android:title="@string/send_alternate_action"
|
android:title="@string/send_alternate_action"
|
||||||
|
@ -47,6 +47,9 @@
|
|||||||
<string name="mark_as_read_action">Mark as read</string>
|
<string name="mark_as_read_action">Mark as read</string>
|
||||||
<string name="send_alternate_action">Forward (alternate)</string>
|
<string name="send_alternate_action">Forward (alternate)</string>
|
||||||
<string name="send_alternate_chooser_title">Choose sender</string>
|
<string name="send_alternate_chooser_title">Choose sender</string>
|
||||||
|
|
||||||
|
<string name="flag_action">Flag</string>
|
||||||
|
<string name="unflag_action">Unflag</string>
|
||||||
|
|
||||||
<string name="mark_as_unread_action">Mark as unread</string>
|
<string name="mark_as_unread_action">Mark as unread</string>
|
||||||
<string name="move_to_action">Move to</string>
|
<string name="move_to_action">Move to</string>
|
||||||
@ -353,8 +356,8 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
|
|||||||
<string name="message_help_key">Del (or D) - Delete\u000AR -
|
<string name="message_help_key">Del (or D) - Delete\u000AR -
|
||||||
Reply\u000AA - Reply All\u000AF - Forward\u000AJ or P - Previous
|
Reply\u000AA - Reply All\u000AF - Forward\u000AJ or P - Previous
|
||||||
Message\u000AK, N or space - Next Message\u000AZ - Zoom Out\u000AShift-Z -
|
Message\u000AK, N or space - Next Message\u000AZ - Zoom Out\u000AShift-Z -
|
||||||
Zoom In</string>
|
Zoom In\u000aG - Flag</string>
|
||||||
<string name="message_list_help_key">Del (or D) - Delete\u000AR -
|
<string name="message_list_help_key">Del (or D) - Delete\u000AR -
|
||||||
Reply\u000AA - Reply All\u000AC - Compose\u000AF - Forward\u000AQ
|
Reply\u000AA - Reply All\u000AC - Compose\u000AF - Forward\\u000aG - Flagu000AQ
|
||||||
- Return to Accounts</string>
|
- Return to Accounts</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -51,6 +51,7 @@ public class Account implements Serializable {
|
|||||||
int mAccountNumber;
|
int mAccountNumber;
|
||||||
boolean mVibrate;
|
boolean mVibrate;
|
||||||
String mRingtoneUri;
|
String mRingtoneUri;
|
||||||
|
boolean showOngoing = true;
|
||||||
|
|
||||||
public enum FolderMode {
|
public enum FolderMode {
|
||||||
ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS;
|
ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS;
|
||||||
@ -505,4 +506,14 @@ public class Account implements Serializable {
|
|||||||
mFolderSyncMode = syncMode;
|
mFolderSyncMode = syncMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowOngoing()
|
||||||
|
{
|
||||||
|
return showOngoing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowOngoing(boolean showOngoing)
|
||||||
|
{
|
||||||
|
this.showOngoing = showOngoing;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ public class MessagingController implements Runnable {
|
|||||||
|
|
||||||
private static final String PENDING_COMMAND_TRASH =
|
private static final String PENDING_COMMAND_TRASH =
|
||||||
"com.android.email.MessagingController.trash";
|
"com.android.email.MessagingController.trash";
|
||||||
private static final String PENDING_COMMAND_MARK_READ =
|
private static final String PENDING_COMMAND_SET_FLAG =
|
||||||
"com.android.email.MessagingController.markRead";
|
"com.android.email.MessagingController.setFlag";
|
||||||
private static final String PENDING_COMMAND_APPEND =
|
private static final String PENDING_COMMAND_APPEND =
|
||||||
"com.android.email.MessagingController.append";
|
"com.android.email.MessagingController.append";
|
||||||
private static final String PENDING_COMMAND_MARK_ALL_AS_READ =
|
private static final String PENDING_COMMAND_MARK_ALL_AS_READ =
|
||||||
@ -735,16 +735,23 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
fp.add(FetchProfile.Item.FLAGS);
|
fp.add(FetchProfile.Item.FLAGS);
|
||||||
remoteFolder.fetch(remoteMessages.toArray(new Message[0]), fp, null);
|
remoteFolder.fetch(remoteMessages.toArray(new Message[0]), fp, null);
|
||||||
for (Message remoteMessage : remoteMessages) {
|
for (Message remoteMessage : remoteMessages) {
|
||||||
|
boolean messageChanged = false;
|
||||||
Message localMessage = localFolder.getMessage(remoteMessage.getUid());
|
Message localMessage = localFolder.getMessage(remoteMessage.getUid());
|
||||||
if (localMessage == null) {
|
if (localMessage == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!remoteMessage.isSet(Flag.X_NO_SEEN_INFO) && remoteMessage.isSet(Flag.SEEN) != localMessage.isSet(Flag.SEEN)) {
|
for (Flag flag : new Flag[] { Flag.SEEN, Flag.FLAGGED, Flag.ANSWERED } )
|
||||||
localMessage.setFlag(Flag.SEEN, remoteMessage.isSet(Flag.SEEN));
|
{
|
||||||
for (MessagingListener l : getListeners()) {
|
if (remoteMessage.isSet(flag) != localMessage.isSet(flag)) {
|
||||||
l.synchronizeMailboxNewMessage(account, folder, localMessage);
|
localMessage.setFlag(flag, remoteMessage.isSet(flag));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (messageChanged) {
|
||||||
|
for (MessagingListener l : getListeners()) {
|
||||||
|
l.synchronizeMailboxNewMessage(account, folder, localMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Config.LOGV) {
|
if (Config.LOGV) {
|
||||||
@ -1071,8 +1078,8 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
if (PENDING_COMMAND_APPEND.equals(command.command)) {
|
if (PENDING_COMMAND_APPEND.equals(command.command)) {
|
||||||
processPendingAppend(command, account);
|
processPendingAppend(command, account);
|
||||||
}
|
}
|
||||||
else if (PENDING_COMMAND_MARK_READ.equals(command.command)) {
|
else if (PENDING_COMMAND_SET_FLAG.equals(command.command)) {
|
||||||
processPendingMarkRead(command, account);
|
processPendingSetFlag(command, account);
|
||||||
}
|
}
|
||||||
else if (PENDING_COMMAND_MARK_ALL_AS_READ.equals(command.command)) {
|
else if (PENDING_COMMAND_MARK_ALL_AS_READ.equals(command.command)) {
|
||||||
processPendingMarkAllAsRead(command, account);
|
processPendingMarkAllAsRead(command, account);
|
||||||
@ -1286,7 +1293,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
* @param command arguments = (String folder, String uid, boolean read)
|
* @param command arguments = (String folder, String uid, boolean read)
|
||||||
* @param account
|
* @param account
|
||||||
*/
|
*/
|
||||||
private void processPendingMarkRead(PendingCommand command, Account account)
|
private void processPendingSetFlag(PendingCommand command, Account account)
|
||||||
throws MessagingException {
|
throws MessagingException {
|
||||||
String folder = command.arguments[0];
|
String folder = command.arguments[0];
|
||||||
String uid = command.arguments[1];
|
String uid = command.arguments[1];
|
||||||
@ -1296,7 +1303,9 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean read = Boolean.parseBoolean(command.arguments[2]);
|
boolean newState = Boolean.parseBoolean(command.arguments[2]);
|
||||||
|
|
||||||
|
Flag flag = Flag.valueOf(command.arguments[3]);
|
||||||
|
|
||||||
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
|
Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication);
|
||||||
Folder remoteFolder = remoteStore.getFolder(folder);
|
Folder remoteFolder = remoteStore.getFolder(folder);
|
||||||
@ -1315,7 +1324,7 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
if (remoteMessage == null) {
|
if (remoteMessage == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
remoteMessage.setFlag(Flag.SEEN, read);
|
remoteMessage.setFlag(flag, newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processPendingMarkAllAsRead(PendingCommand command, Account account) throws MessagingException {
|
private void processPendingMarkAllAsRead(PendingCommand command, Account account) throws MessagingException {
|
||||||
@ -1437,6 +1446,9 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark the message with the given account, folder and uid either Seen or not Seen.
|
* Mark the message with the given account, folder and uid either Seen or not Seen.
|
||||||
* @param account
|
* @param account
|
||||||
@ -1449,13 +1461,27 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
final String folder,
|
final String folder,
|
||||||
final String uid,
|
final String uid,
|
||||||
final boolean seen) {
|
final boolean seen) {
|
||||||
|
setMessageFlag(account, folder, uid, Flag.SEEN, seen);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setMessageFlag(
|
||||||
|
final Account account,
|
||||||
|
final String folder,
|
||||||
|
final String uid,
|
||||||
|
final Flag flag,
|
||||||
|
boolean newState) {
|
||||||
try {
|
try {
|
||||||
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
|
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
|
||||||
Folder localFolder = localStore.getFolder(folder);
|
Folder localFolder = localStore.getFolder(folder);
|
||||||
localFolder.open(OpenMode.READ_WRITE);
|
localFolder.open(OpenMode.READ_WRITE);
|
||||||
|
|
||||||
Message message = localFolder.getMessage(uid);
|
Message message = localFolder.getMessage(uid);
|
||||||
message.setFlag(Flag.SEEN, seen);
|
message.setFlag(flag, newState);
|
||||||
|
|
||||||
|
for (MessagingListener l : getListeners()) {
|
||||||
|
l.folderStatusChanged(account, folder);
|
||||||
|
}
|
||||||
|
|
||||||
if (account.getErrorFolderName().equals(folder))
|
if (account.getErrorFolderName().equals(folder))
|
||||||
{
|
{
|
||||||
@ -1463,8 +1489,8 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
}
|
}
|
||||||
|
|
||||||
PendingCommand command = new PendingCommand();
|
PendingCommand command = new PendingCommand();
|
||||||
command.command = PENDING_COMMAND_MARK_READ;
|
command.command = PENDING_COMMAND_SET_FLAG;
|
||||||
command.arguments = new String[] { folder, uid, Boolean.toString(seen) };
|
command.arguments = new String[] { folder, uid, Boolean.toString(newState), flag.toString() };
|
||||||
queuePendingCommand(account, command);
|
queuePendingCommand(account, command);
|
||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
@ -1951,8 +1977,8 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
else if (account.getDeletePolicy() == Account.DELETE_POLICY_MARK_AS_READ)
|
else if (account.getDeletePolicy() == Account.DELETE_POLICY_MARK_AS_READ)
|
||||||
{
|
{
|
||||||
PendingCommand command = new PendingCommand();
|
PendingCommand command = new PendingCommand();
|
||||||
command.command = PENDING_COMMAND_MARK_READ;
|
command.command = PENDING_COMMAND_SET_FLAG;
|
||||||
command.arguments = new String[] { folder, message.getUid(), Boolean.toString(true) };
|
command.arguments = new String[] { folder, message.getUid(), Boolean.toString(true), Flag.SEEN.toString() };
|
||||||
queuePendingCommand(account, command);
|
queuePendingCommand(account, command);
|
||||||
processPendingCommands(account);
|
processPendingCommands(account);
|
||||||
}
|
}
|
||||||
@ -2108,28 +2134,32 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
}
|
}
|
||||||
putBackground("sendPending " + account.getDescription(), null, new Runnable() {
|
putBackground("sendPending " + account.getDescription(), null, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
Notification notif = new Notification(R.drawable.ic_menu_refresh,
|
if (account.isShowOngoing()) {
|
||||||
context.getString(R.string.notification_bg_send_ticker, account.getDescription()), System.currentTimeMillis());
|
Notification notif = new Notification(R.drawable.ic_menu_refresh,
|
||||||
Intent intent = FolderMessageList.actionHandleAccountIntent(context, account, Email.INBOX);
|
context.getString(R.string.notification_bg_send_ticker, account.getDescription()), System.currentTimeMillis());
|
||||||
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
|
Intent intent = FolderMessageList.actionHandleAccountIntent(context, account, Email.INBOX);
|
||||||
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_send_title),
|
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
|
||||||
account.getDescription() , pi);
|
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_send_title),
|
||||||
notif.flags = Notification.FLAG_ONGOING_EVENT;
|
account.getDescription() , pi);
|
||||||
|
notif.flags = Notification.FLAG_ONGOING_EVENT;
|
||||||
if (Email.NOTIFICATION_LED_WHILE_SYNCING) {
|
|
||||||
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
if (Email.NOTIFICATION_LED_WHILE_SYNCING) {
|
||||||
notif.ledARGB = Email.NOTIFICATION_LED_DIM_COLOR;
|
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
||||||
notif.ledOnMS = Email.NOTIFICATION_LED_FAST_ON_TIME;
|
notif.ledARGB = Email.NOTIFICATION_LED_DIM_COLOR;
|
||||||
notif.ledOffMS = Email.NOTIFICATION_LED_FAST_OFF_TIME;
|
notif.ledOnMS = Email.NOTIFICATION_LED_FAST_ON_TIME;
|
||||||
}
|
notif.ledOffMS = Email.NOTIFICATION_LED_FAST_OFF_TIME;
|
||||||
|
}
|
||||||
notifMgr.notify(Email.FETCHING_EMAIL_NOTIFICATION_ID, notif);
|
|
||||||
|
notifMgr.notify(Email.FETCHING_EMAIL_NOTIFICATION_ID, notif);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sendPendingMessagesSynchronous(account);
|
sendPendingMessagesSynchronous(account);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
notifMgr.cancel(Email.FETCHING_EMAIL_NOTIFICATION_ID);
|
if (account.showOngoing) {
|
||||||
|
notifMgr.cancel(Email.FETCHING_EMAIL_NOTIFICATION_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2221,29 +2251,33 @@ s * critical data as fast as possible, and then we'll fill in the de
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Notification notif = new Notification(R.drawable.ic_menu_refresh,
|
if (account.isShowOngoing()) {
|
||||||
context.getString(R.string.notification_bg_sync_ticker, account.getDescription(), folder.getName()),
|
Notification notif = new Notification(R.drawable.ic_menu_refresh,
|
||||||
System.currentTimeMillis());
|
context.getString(R.string.notification_bg_sync_ticker, account.getDescription(), folder.getName()),
|
||||||
Intent intent = FolderMessageList.actionHandleAccountIntent(context, account, Email.INBOX);
|
System.currentTimeMillis());
|
||||||
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
|
Intent intent = FolderMessageList.actionHandleAccountIntent(context, account, Email.INBOX);
|
||||||
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_sync_title), account.getDescription()
|
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
|
||||||
+ context.getString(R.string.notification_bg_title_separator) + folder.getName(), pi);
|
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_sync_title), account.getDescription()
|
||||||
notif.flags = Notification.FLAG_ONGOING_EVENT;
|
+ context.getString(R.string.notification_bg_title_separator) + folder.getName(), pi);
|
||||||
if (Email.NOTIFICATION_LED_WHILE_SYNCING) {
|
notif.flags = Notification.FLAG_ONGOING_EVENT;
|
||||||
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
if (Email.NOTIFICATION_LED_WHILE_SYNCING) {
|
||||||
notif.ledARGB = Email.NOTIFICATION_LED_DIM_COLOR;
|
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
||||||
notif.ledOnMS = Email.NOTIFICATION_LED_FAST_ON_TIME;
|
notif.ledARGB = Email.NOTIFICATION_LED_DIM_COLOR;
|
||||||
notif.ledOffMS = Email.NOTIFICATION_LED_FAST_OFF_TIME;
|
notif.ledOnMS = Email.NOTIFICATION_LED_FAST_ON_TIME;
|
||||||
}
|
notif.ledOffMS = Email.NOTIFICATION_LED_FAST_OFF_TIME;
|
||||||
|
}
|
||||||
notifMgr.notify(Email.FETCHING_EMAIL_NOTIFICATION_ID, notif);
|
|
||||||
|
notifMgr.notify(Email.FETCHING_EMAIL_NOTIFICATION_ID, notif);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
synchronizeMailboxSynchronous(account, folder.getName());
|
synchronizeMailboxSynchronous(account, folder.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
finally {
|
finally {
|
||||||
notifMgr.cancel(Email.FETCHING_EMAIL_NOTIFICATION_ID);
|
if (account.isShowOngoing()) {
|
||||||
|
notifMgr.cancel(Email.FETCHING_EMAIL_NOTIFICATION_ID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -639,6 +639,7 @@ public class FolderMessageList extends ExpandableListActivity
|
|||||||
case KeyEvent.KEYCODE_F: { onForward(message); return true;}
|
case KeyEvent.KEYCODE_F: { onForward(message); return true;}
|
||||||
case KeyEvent.KEYCODE_A: { onReplyAll(message); return true; }
|
case KeyEvent.KEYCODE_A: { onReplyAll(message); return true; }
|
||||||
case KeyEvent.KEYCODE_R: { onReply(message); return true; }
|
case KeyEvent.KEYCODE_R: { onReply(message); return true; }
|
||||||
|
case KeyEvent.KEYCODE_G: { onToggleFlag(message); return true; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -832,6 +833,15 @@ public class FolderMessageList extends ExpandableListActivity
|
|||||||
// onRefresh(false);
|
// onRefresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onToggleFlag(MessageInfoHolder holder)
|
||||||
|
{
|
||||||
|
|
||||||
|
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount,
|
||||||
|
holder.message.getFolder().getName(), holder.uid, Flag.FLAGGED, !holder.flagged);
|
||||||
|
holder.flagged = !holder.flagged;
|
||||||
|
mHandler.dataChanged();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item)
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
{
|
{
|
||||||
@ -901,6 +911,9 @@ public class FolderMessageList extends ExpandableListActivity
|
|||||||
case R.id.mark_as_read:
|
case R.id.mark_as_read:
|
||||||
onToggleRead(holder);
|
onToggleRead(holder);
|
||||||
break;
|
break;
|
||||||
|
case R.id.flag:
|
||||||
|
onToggleFlag(holder);
|
||||||
|
break;
|
||||||
case R.id.send_alternate:
|
case R.id.send_alternate:
|
||||||
onSendAlternate(mAccount, holder);
|
onSendAlternate(mAccount, holder);
|
||||||
break;
|
break;
|
||||||
@ -976,7 +989,12 @@ public class FolderMessageList extends ExpandableListActivity
|
|||||||
{
|
{
|
||||||
menu.findItem(R.id.mark_as_read).setTitle(
|
menu.findItem(R.id.mark_as_read).setTitle(
|
||||||
R.string.mark_as_unread_action);
|
R.string.mark_as_unread_action);
|
||||||
}
|
}
|
||||||
|
if (message.flagged)
|
||||||
|
{
|
||||||
|
menu.findItem(R.id.flag).setTitle(
|
||||||
|
R.string.unflag_action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (ExpandableListView.getPackedPositionType(info.packedPosition) == ExpandableListView.PACKED_POSITION_TYPE_GROUP)
|
} else if (ExpandableListView.getPackedPositionType(info.packedPosition) == ExpandableListView.PACKED_POSITION_TYPE_GROUP)
|
||||||
{
|
{
|
||||||
@ -1370,11 +1388,14 @@ public class FolderMessageList extends ExpandableListActivity
|
|||||||
};
|
};
|
||||||
|
|
||||||
private Drawable mAttachmentIcon;
|
private Drawable mAttachmentIcon;
|
||||||
|
private Drawable mAnsweredIcon;
|
||||||
|
|
||||||
FolderMessageListAdapter()
|
FolderMessageListAdapter()
|
||||||
{
|
{
|
||||||
mAttachmentIcon = getResources().getDrawable(
|
mAttachmentIcon = getResources().getDrawable(
|
||||||
R.drawable.ic_mms_attachment_small);
|
R.drawable.ic_mms_attachment_small);
|
||||||
|
mAnsweredIcon = getResources().getDrawable(
|
||||||
|
R.drawable.ic_mms_answered_small);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeDeletedUid(String folder, String messageUid) {
|
public void removeDeletedUid(String folder, String messageUid) {
|
||||||
@ -1716,15 +1737,28 @@ public class FolderMessageList extends ExpandableListActivity
|
|||||||
if (message != null)
|
if (message != null)
|
||||||
{
|
{
|
||||||
holder.chip.getBackground().setAlpha(message.read ? 0 : 255);
|
holder.chip.getBackground().setAlpha(message.read ? 0 : 255);
|
||||||
|
|
||||||
|
holder.subject.setTypeface(null,
|
||||||
|
message.read && !message.flagged ? Typeface.NORMAL : Typeface.BOLD);
|
||||||
|
|
||||||
|
if (message.flagged)
|
||||||
|
{
|
||||||
|
holder.subject.setTextColor(0xffff4444);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
holder.subject.setTextColor(0xffffffff);
|
||||||
|
}
|
||||||
holder.subject.setText(message.subject);
|
holder.subject.setText(message.subject);
|
||||||
holder.subject.setTypeface(null, message.read ? Typeface.NORMAL
|
|
||||||
: Typeface.BOLD);
|
|
||||||
holder.from.setText(message.sender);
|
holder.from.setText(message.sender);
|
||||||
holder.from.setTypeface(null, message.read ? Typeface.NORMAL
|
holder.from.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
|
||||||
: Typeface.BOLD);
|
|
||||||
holder.date.setText(message.date);
|
holder.date.setText(message.date);
|
||||||
holder.subject.setCompoundDrawablesWithIntrinsicBounds(null, null,
|
holder.subject.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
message.hasAttachments ? mAttachmentIcon : null, null);
|
message.answered ? mAnsweredIcon : null, // left
|
||||||
|
null, // top
|
||||||
|
message.hasAttachments ? mAttachmentIcon : null, // right
|
||||||
|
null); // bottom
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1804,12 +1838,18 @@ public class FolderMessageList extends ExpandableListActivity
|
|||||||
public Date compareDate;
|
public Date compareDate;
|
||||||
|
|
||||||
public String sender;
|
public String sender;
|
||||||
|
|
||||||
|
public String[] recipients;
|
||||||
|
|
||||||
public boolean hasAttachments;
|
public boolean hasAttachments;
|
||||||
|
|
||||||
public String uid;
|
public String uid;
|
||||||
|
|
||||||
public boolean read;
|
public boolean read;
|
||||||
|
|
||||||
|
public boolean answered;
|
||||||
|
|
||||||
|
public boolean flagged;
|
||||||
|
|
||||||
public Message message;
|
public Message message;
|
||||||
|
|
||||||
@ -1837,6 +1877,8 @@ public class FolderMessageList extends ExpandableListActivity
|
|||||||
}
|
}
|
||||||
this.hasAttachments = message.getAttachmentCount() > 0;
|
this.hasAttachments = message.getAttachmentCount() > 0;
|
||||||
this.read = message.isSet(Flag.SEEN);
|
this.read = message.isSet(Flag.SEEN);
|
||||||
|
this.answered = message.isSet(Flag.ANSWERED);
|
||||||
|
this.flagged = message.isSet(Flag.FLAGGED);
|
||||||
if (folder.outbox)
|
if (folder.outbox)
|
||||||
{
|
{
|
||||||
this.sender = Address.toFriendly(message
|
this.sender = Address.toFriendly(message
|
||||||
|
@ -47,6 +47,7 @@ import com.android.email.R;
|
|||||||
import com.android.email.Utility;
|
import com.android.email.Utility;
|
||||||
import com.android.email.mail.Address;
|
import com.android.email.mail.Address;
|
||||||
import com.android.email.mail.Body;
|
import com.android.email.mail.Body;
|
||||||
|
import com.android.email.mail.Flag;
|
||||||
import com.android.email.mail.Message;
|
import com.android.email.mail.Message;
|
||||||
import com.android.email.mail.MessagingException;
|
import com.android.email.mail.MessagingException;
|
||||||
import com.android.email.mail.Multipart;
|
import com.android.email.mail.Multipart;
|
||||||
@ -199,7 +200,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
|||||||
Context context,
|
Context context,
|
||||||
Account account,
|
Account account,
|
||||||
Message message,
|
Message message,
|
||||||
boolean replyAll) {
|
boolean replyAll) {
|
||||||
Intent i = new Intent(context, MessageCompose.class);
|
Intent i = new Intent(context, MessageCompose.class);
|
||||||
i.putExtra(EXTRA_ACCOUNT, account);
|
i.putExtra(EXTRA_ACCOUNT, account);
|
||||||
i.putExtra(EXTRA_FOLDER, message.getFolder().getName());
|
i.putExtra(EXTRA_FOLDER, message.getFolder().getName());
|
||||||
@ -394,6 +395,15 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
|||||||
mFolder = (String) intent.getStringExtra(EXTRA_FOLDER);
|
mFolder = (String) intent.getStringExtra(EXTRA_FOLDER);
|
||||||
mSourceMessageUid = (String) intent.getStringExtra(EXTRA_MESSAGE);
|
mSourceMessageUid = (String) intent.getStringExtra(EXTRA_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d(Email.LOG_TAG, "action = " + action + ", mAccount = " + mAccount + ", mFolder = " + mFolder + ", mSourceMessageUid = " + mSourceMessageUid);
|
||||||
|
if ((ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) && mAccount != null && mFolder != null && mSourceMessageUid != null)
|
||||||
|
{
|
||||||
|
Log.d(Email.LOG_TAG, "Setting message ANSWERED flag to true");
|
||||||
|
// TODO: Really, we should wait until we send the message, but that would require saving the original
|
||||||
|
// message info along with a Draft copy, in case it is left in Drafts for a while before being sent
|
||||||
|
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount, mFolder, mSourceMessageUid, Flag.ANSWERED, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action) ||
|
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action) ||
|
||||||
ACTION_FORWARD.equals(action) || ACTION_EDIT_DRAFT.equals(action)) {
|
ACTION_FORWARD.equals(action) || ACTION_EDIT_DRAFT.equals(action)) {
|
||||||
|
@ -55,6 +55,7 @@ import com.android.email.MessagingListener;
|
|||||||
import com.android.email.R;
|
import com.android.email.R;
|
||||||
import com.android.email.Utility;
|
import com.android.email.Utility;
|
||||||
import com.android.email.mail.Address;
|
import com.android.email.mail.Address;
|
||||||
|
import com.android.email.mail.Flag;
|
||||||
import com.android.email.mail.Message;
|
import com.android.email.mail.Message;
|
||||||
import com.android.email.mail.MessagingException;
|
import com.android.email.mail.MessagingException;
|
||||||
import com.android.email.mail.Multipart;
|
import com.android.email.mail.Multipart;
|
||||||
@ -132,6 +133,7 @@ public class MessageView extends Activity
|
|||||||
case KeyEvent.KEYCODE_F: { onForward(); return true;}
|
case KeyEvent.KEYCODE_F: { onForward(); return true;}
|
||||||
case KeyEvent.KEYCODE_A: { onReplyAll(); return true; }
|
case KeyEvent.KEYCODE_A: { onReplyAll(); return true; }
|
||||||
case KeyEvent.KEYCODE_R: { onReply(); return true; }
|
case KeyEvent.KEYCODE_R: { onReply(); return true; }
|
||||||
|
case KeyEvent.KEYCODE_G: { onFlag(); return true; }
|
||||||
case KeyEvent.KEYCODE_J:
|
case KeyEvent.KEYCODE_J:
|
||||||
case KeyEvent.KEYCODE_P:
|
case KeyEvent.KEYCODE_P:
|
||||||
{ onPrevious(); return true; }
|
{ onPrevious(); return true; }
|
||||||
@ -492,6 +494,22 @@ public class MessageView extends Activity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onFlag() {
|
||||||
|
if (mMessage != null) {
|
||||||
|
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount,
|
||||||
|
mMessage.getFolder().getName(), mMessage.getUid(), Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mMessage.setFlag(Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
|
||||||
|
}
|
||||||
|
catch (MessagingException me)
|
||||||
|
{
|
||||||
|
Log.e(Email.LOG_TAG, "Could not set flag on local message", me);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onSendAlternate() {
|
private void onSendAlternate() {
|
||||||
if (mMessage != null) {
|
if (mMessage != null) {
|
||||||
MessagingController.getInstance(getApplication()).sendAlternate(this, mAccount, mMessage);
|
MessagingController.getInstance(getApplication()).sendAlternate(this, mAccount, mMessage);
|
||||||
|
@ -1100,6 +1100,13 @@ public class ImapStore extends Store {
|
|||||||
else if (flag == Flag.DELETED) {
|
else if (flag == Flag.DELETED) {
|
||||||
flagNames.add("\\Deleted");
|
flagNames.add("\\Deleted");
|
||||||
}
|
}
|
||||||
|
else if (flag == Flag.ANSWERED) {
|
||||||
|
flagNames.add("\\Answered");
|
||||||
|
}
|
||||||
|
else if (flag == Flag.FLAGGED) {
|
||||||
|
flagNames.add("\\Flagged");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mConnection.executeSimpleCommand(String.format("UID STORE 1:* %sFLAGS.SILENT (%s)",
|
mConnection.executeSimpleCommand(String.format("UID STORE 1:* %sFLAGS.SILENT (%s)",
|
||||||
@ -1127,6 +1134,12 @@ public class ImapStore extends Store {
|
|||||||
else if (flag == Flag.DELETED) {
|
else if (flag == Flag.DELETED) {
|
||||||
flagNames.add("\\Deleted");
|
flagNames.add("\\Deleted");
|
||||||
}
|
}
|
||||||
|
else if (flag == Flag.ANSWERED) {
|
||||||
|
flagNames.add("\\Answered");
|
||||||
|
}
|
||||||
|
else if (flag == Flag.FLAGGED) {
|
||||||
|
flagNames.add("\\Flagged");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mConnection.executeSimpleCommand(String.format("UID STORE %s %sFLAGS.SILENT (%s)",
|
mConnection.executeSimpleCommand(String.format("UID STORE %s %sFLAGS.SILENT (%s)",
|
||||||
|
Loading…
Reference in New Issue
Block a user