mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-31 10:01:22 +01:00
Support for notification channel per folder
This commit is contained in:
@@ -19,6 +19,9 @@ package eu.faircode.email;
|
||||
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -55,6 +58,24 @@ public class TupleFolderEx extends EntityFolder implements Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
void createNotificationChannel(Context context) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
getNotificationChannelId(id), accountName + "/" + getDisplayName(context),
|
||||
NotificationManager.IMPORTANCE_HIGH);
|
||||
channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
||||
nm.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
void deleteNotificationChannel(Context context) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.deleteNotificationChannel(getNotificationChannelId(id));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
Comparator getComparator(final Context context) {
|
||||
final Collator collator = Collator.getInstance(Locale.getDefault());
|
||||
|
||||
Reference in New Issue
Block a user