diff --git a/FAQ.md b/FAQ.md
index e556fe85c2..3e7e7d3f60 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -1128,7 +1128,6 @@ but even Google's Chrome cannot handle this.
* Did you know that you can retry sending messages by using pull-down-to-refresh in the outbox?
* Did you know that you can swipe a conversation left or right to go to the next or previous conversation?
* Did you know that you can tap on an image to see where it will be downloaded from?
-* Did you know that you can long press the bell icon to delete the notification channel for the email address?
* Did you know that you can long press the folder icon in the action bar to select an account?
diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java
index 4bd0709ee2..47885bdfa3 100644
--- a/app/src/main/java/eu/faircode/email/AdapterMessage.java
+++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java
@@ -176,7 +176,7 @@ public class AdapterMessage extends RecyclerView.Adapter 0) {
- NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
-
- InternetAddress from = (InternetAddress) message.from[0];
- String channelName = "notification." + from.getAddress().toLowerCase();
- nm.deleteNotificationChannel(channelName);
+ PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, powner, ibAddContact);
+ NotificationChannel channel = nm.getNotificationChannel(channelId);
+ if (channel == null)
+ popupMenu.getMenu().add(Menu.NONE, R.string.title_create_channel, 1, R.string.title_create_channel);
+ else {
+ popupMenu.getMenu().add(Menu.NONE, R.string.title_edit_channel, 2, R.string.title_edit_channel);
+ popupMenu.getMenu().add(Menu.NONE, R.string.title_delete_channel, 3, R.string.title_delete_channel);
}
+
+ popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.string.title_create_channel:
+ onActionCreateChannel();
+ return true;
+
+ case R.string.title_edit_channel:
+ onActionEditChannel();
+ return true;
+
+ case R.string.title_delete_channel:
+ onActionDeleteChannel();
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ @TargetApi(Build.VERSION_CODES.O)
+ private void onActionCreateChannel() {
+ NotificationChannel channel = new NotificationChannel(
+ channelId, from.getAddress(),
+ NotificationManager.IMPORTANCE_HIGH);
+ channel.setGroup("contacts");
+ channel.setDescription(from.getPersonal());
+ channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
+ nm.createNotificationChannel(channel);
+ onActionEditChannel();
+ }
+
+ private void onActionEditChannel() {
+ Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS)
+ .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName())
+ .putExtra(Settings.EXTRA_CHANNEL_ID, channelId);
+ context.startActivity(intent);
+ }
+
+ private void onActionDeleteChannel() {
+ NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
+ nm.deleteNotificationChannel(channelId);
+ }
+ });
+
+ popupMenu.show();
}
private void onAddContact(TupleMessageEx message) {