mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-25 15:11:52 -05:00
Cancel notification when viewing message by clicking on notification.
This commit is contained in:
parent
ef93f0af6c
commit
e17e9b9344
@ -586,7 +586,7 @@ 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);
|
||||||
|
|
||||||
Intent i = MessageView.actionView(this, messageReference, messageRefs);
|
Intent i = MessageView.actionViewIntent(this, messageReference, messageRefs);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import com.fsck.k9.Preferences;
|
|||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
import com.fsck.k9.activity.misc.SwipeGestureDetector;
|
import com.fsck.k9.activity.misc.SwipeGestureDetector;
|
||||||
import com.fsck.k9.activity.misc.SwipeGestureDetector.OnSwipeGestureListener;
|
import com.fsck.k9.activity.misc.SwipeGestureDetector.OnSwipeGestureListener;
|
||||||
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.crypto.PgpData;
|
import com.fsck.k9.crypto.PgpData;
|
||||||
import com.fsck.k9.fragment.MessageViewFragment;
|
import com.fsck.k9.fragment.MessageViewFragment;
|
||||||
import com.fsck.k9.fragment.MessageViewFragment.MessageViewFragmentListener;
|
import com.fsck.k9.fragment.MessageViewFragment.MessageViewFragmentListener;
|
||||||
@ -41,6 +42,7 @@ 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_FROM_NOTIFICATION ="com.fsck.k9.MessageView_fromNotification";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #mLastDirection
|
* @see #mLastDirection
|
||||||
@ -49,7 +51,7 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme
|
|||||||
private static final int NEXT = 2;
|
private static final int NEXT = 2;
|
||||||
|
|
||||||
|
|
||||||
public static Intent actionView(Context context, MessageReference messRef,
|
public static Intent actionViewIntent(Context context, MessageReference messRef,
|
||||||
ArrayList<MessageReference> messReferences) {
|
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);
|
||||||
@ -58,6 +60,12 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Intent actionHandleNotificationIntent(Context context, MessageReference ref) {
|
||||||
|
Intent i = actionViewIntent(context, ref, null);
|
||||||
|
i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
i.putExtra(EXTRA_FROM_NOTIFICATION, true);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
private StorageManager.StorageListener mStorageListener = new StorageListenerImplementation();
|
||||||
private Account mAccount;
|
private Account mAccount;
|
||||||
@ -163,6 +171,9 @@ public class MessageView extends K9FragmentActivity implements MessageViewFragme
|
|||||||
onAccountUnavailable();
|
onAccountUnavailable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (getIntent().getBooleanExtra(EXTRA_FROM_NOTIFICATION, false)) {
|
||||||
|
MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
|
||||||
|
}
|
||||||
StorageManager.getInstance(getApplication()).addListener(mStorageListener);
|
StorageManager.getInstance(getApplication()).addListener(mStorageListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4703,7 +4703,8 @@ public class MessagingController implements Runnable {
|
|||||||
Intent targetIntent;
|
Intent targetIntent;
|
||||||
|
|
||||||
if (unreadCount == 1) {
|
if (unreadCount == 1) {
|
||||||
targetIntent = MessageView.actionView(context, message.makeMessageReference(), null);
|
targetIntent = MessageView.actionHandleNotificationIntent(
|
||||||
|
context, message.makeMessageReference());
|
||||||
} else {
|
} else {
|
||||||
String initialFolder = message.getFolder().getName();
|
String initialFolder = message.getFolder().getName();
|
||||||
/* only go to folder if all messages are in the same folder, else go to folder list */
|
/* only go to folder if all messages are in the same folder, else go to folder list */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user