mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-11 20:15:03 -05:00
Directly go to message when clicking on a single-message notification.
This commit is contained in:
parent
d9cc0446b6
commit
ef93f0af6c
@ -586,7 +586,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
|
|
||||||
Log.i(K9.LOG_TAG, "MessageList sending message " + messageReference);
|
Log.i(K9.LOG_TAG, "MessageList sending message " + messageReference);
|
||||||
|
|
||||||
MessageView.actionView(this, messageReference, messageRefs, getIntent().getExtras());
|
Intent i = MessageView.actionView(this, messageReference, messageRefs);
|
||||||
|
startActivity(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -41,7 +41,6 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme
|
|||||||
|
|
||||||
private static final String EXTRA_MESSAGE_REFERENCE = "com.fsck.k9.MessageView_messageReference";
|
private static final String EXTRA_MESSAGE_REFERENCE = "com.fsck.k9.MessageView_messageReference";
|
||||||
private static final String EXTRA_MESSAGE_REFERENCES = "com.fsck.k9.MessageView_messageReferences";
|
private static final String EXTRA_MESSAGE_REFERENCES = "com.fsck.k9.MessageView_messageReferences";
|
||||||
private static final String EXTRA_MESSAGE_LIST_EXTRAS = "com.fsck.k9.MessageView_messageListExtras";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #mLastDirection
|
* @see #mLastDirection
|
||||||
@ -50,14 +49,13 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme
|
|||||||
private static final int NEXT = 2;
|
private static final int NEXT = 2;
|
||||||
|
|
||||||
|
|
||||||
public static void actionView(Context context, MessageReference messRef,
|
public static Intent actionView(Context context, MessageReference messRef,
|
||||||
ArrayList<MessageReference> messReferences, Bundle messageListExtras) {
|
ArrayList<MessageReference> messReferences) {
|
||||||
Intent i = new Intent(context, MessageView.class);
|
Intent i = new Intent(context, MessageView.class);
|
||||||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
i.putExtra(EXTRA_MESSAGE_LIST_EXTRAS, messageListExtras);
|
|
||||||
i.putExtra(EXTRA_MESSAGE_REFERENCE, messRef);
|
i.putExtra(EXTRA_MESSAGE_REFERENCE, messRef);
|
||||||
i.putParcelableArrayListExtra(EXTRA_MESSAGE_REFERENCES, messReferences);
|
i.putParcelableArrayListExtra(EXTRA_MESSAGE_REFERENCES, messReferences);
|
||||||
context.startActivity(i);
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -438,7 +436,9 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme
|
|||||||
|
|
||||||
private void showNextMessage() {
|
private void showNextMessage() {
|
||||||
findSurroundingMessagesUid();
|
findSurroundingMessagesUid();
|
||||||
mMessageReferences.remove(mMessageReference);
|
if (mMessageReferences == null) {
|
||||||
|
mMessageReferences.remove(mMessageReference);
|
||||||
|
}
|
||||||
if (mLastDirection == NEXT && mNextMessage != null) {
|
if (mLastDirection == NEXT && mNextMessage != null) {
|
||||||
onNext();
|
onNext();
|
||||||
} else if (mLastDirection == PREVIOUS && mPreviousMessage != null) {
|
} else if (mLastDirection == PREVIOUS && mPreviousMessage != null) {
|
||||||
@ -491,6 +491,10 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme
|
|||||||
private void findSurroundingMessagesUid() {
|
private void findSurroundingMessagesUid() {
|
||||||
mNextMessage = mPreviousMessage = null;
|
mNextMessage = mPreviousMessage = null;
|
||||||
|
|
||||||
|
if (mMessageReferences == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int i = mMessageReferences.indexOf(mMessageReference);
|
int i = mMessageReferences.indexOf(mMessageReference);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -50,6 +50,7 @@ import com.fsck.k9.R;
|
|||||||
import com.fsck.k9.activity.FolderList;
|
import com.fsck.k9.activity.FolderList;
|
||||||
import com.fsck.k9.activity.MessageList;
|
import com.fsck.k9.activity.MessageList;
|
||||||
import com.fsck.k9.activity.MessageReference;
|
import com.fsck.k9.activity.MessageReference;
|
||||||
|
import com.fsck.k9.activity.MessageView;
|
||||||
import com.fsck.k9.activity.NotificationDeleteConfirmation;
|
import com.fsck.k9.activity.NotificationDeleteConfirmation;
|
||||||
import com.fsck.k9.helper.Contacts;
|
import com.fsck.k9.helper.Contacts;
|
||||||
import com.fsck.k9.helper.HtmlConverter;
|
import com.fsck.k9.helper.HtmlConverter;
|
||||||
@ -4692,14 +4693,6 @@ public class MessagingController implements Runnable {
|
|||||||
builder.setContentText(summary);
|
builder.setContentText(summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
String initialFolder = message.getFolder().getName();
|
|
||||||
/* only go to folder if all messages are in the same folder, else go to folder list */
|
|
||||||
for (MessageReference ref : allRefs) {
|
|
||||||
if (!TextUtils.equals(initialFolder, ref.folderName)) {
|
|
||||||
initialFolder = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Message m : data.messages) {
|
for (Message m : data.messages) {
|
||||||
if (m.isSet(Flag.FLAGGED)) {
|
if (m.isSet(Flag.FLAGGED)) {
|
||||||
builder.setPriority(NotificationCompat.PRIORITY_HIGH);
|
builder.setPriority(NotificationCompat.PRIORITY_HIGH);
|
||||||
@ -4707,8 +4700,23 @@ public class MessagingController implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent i = FolderList.actionHandleNotification(context, account, initialFolder);
|
Intent targetIntent;
|
||||||
PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
||||||
|
if (unreadCount == 1) {
|
||||||
|
targetIntent = MessageView.actionView(context, message.makeMessageReference(), null);
|
||||||
|
} else {
|
||||||
|
String initialFolder = message.getFolder().getName();
|
||||||
|
/* only go to folder if all messages are in the same folder, else go to folder list */
|
||||||
|
for (MessageReference ref : allRefs) {
|
||||||
|
if (!TextUtils.equals(initialFolder, ref.folderName)) {
|
||||||
|
initialFolder = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
targetIntent = FolderList.actionHandleNotification(context, account, initialFolder);
|
||||||
|
}
|
||||||
|
PendingIntent pi = PendingIntent.getActivity(context, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
builder.setContentIntent(pi);
|
builder.setContentIntent(pi);
|
||||||
|
|
||||||
// Only ring or vibrate if we have not done so already on this account and fetch
|
// Only ring or vibrate if we have not done so already on this account and fetch
|
||||||
|
Loading…
Reference in New Issue
Block a user