mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-08 01:53:25 +02:00
Refactoring
This commit is contained in:
@@ -1885,19 +1885,19 @@ class Core {
|
||||
R.plurals.title_notification_unseen, messages.size(), messages.size());
|
||||
|
||||
// Build notification
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, "notification");
|
||||
builder
|
||||
.setSmallIcon(R.drawable.baseline_email_white_24)
|
||||
.setContentTitle(title)
|
||||
.setContentIntent(piSummary)
|
||||
.setNumber(messages.size())
|
||||
.setShowWhen(false)
|
||||
.setDeleteIntent(piClear)
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||
.setGroup(group)
|
||||
.setGroupSummary(true);
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(context, "notification")
|
||||
.setSmallIcon(R.drawable.baseline_email_white_24)
|
||||
.setContentTitle(title)
|
||||
.setContentIntent(piSummary)
|
||||
.setNumber(messages.size())
|
||||
.setShowWhen(false)
|
||||
.setDeleteIntent(piClear)
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||
.setGroup(group)
|
||||
.setGroupSummary(true);
|
||||
|
||||
Notification pub = builder.build();
|
||||
builder
|
||||
@@ -1972,21 +1972,19 @@ class Core {
|
||||
? Helper.localizeFolderName(context, message.folderName)
|
||||
: message.folderDisplay;
|
||||
|
||||
NotificationCompat.Builder mbuilder;
|
||||
mbuilder = new NotificationCompat.Builder(context, channelName);
|
||||
|
||||
mbuilder
|
||||
.addExtras(args)
|
||||
.setSmallIcon(R.drawable.baseline_email_white_24)
|
||||
.setContentTitle(info.getDisplayName(true))
|
||||
.setSubText(message.accountName + " · " + folderName)
|
||||
.setContentIntent(piContent)
|
||||
.setWhen(message.received)
|
||||
.setDeleteIntent(piIgnore)
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.setOnlyAlertOnce(true);
|
||||
NotificationCompat.Builder mbuilder =
|
||||
new NotificationCompat.Builder(context, channelName)
|
||||
.addExtras(args)
|
||||
.setSmallIcon(R.drawable.baseline_email_white_24)
|
||||
.setContentTitle(info.getDisplayName(true))
|
||||
.setSubText(message.accountName + " · " + folderName)
|
||||
.setContentIntent(piContent)
|
||||
.setWhen(message.received)
|
||||
.setDeleteIntent(piIgnore)
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PRIVATE)
|
||||
.setOnlyAlertOnce(true);
|
||||
|
||||
if (notify_group)
|
||||
mbuilder.setGroup(group).setGroupSummary(false);
|
||||
@@ -2179,19 +2177,18 @@ class Core {
|
||||
context, ActivityView.REQUEST_ERROR, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
// Build notification
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channel);
|
||||
|
||||
builder
|
||||
.setSmallIcon(R.drawable.baseline_warning_white_24)
|
||||
.setContentTitle(context.getString(R.string.title_notification_failed, title))
|
||||
.setContentText(Helper.formatThrowable(ex))
|
||||
.setContentIntent(pi)
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_MAX)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setCategory(NotificationCompat.CATEGORY_ERROR)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(context, channel)
|
||||
.setSmallIcon(R.drawable.baseline_warning_white_24)
|
||||
.setContentTitle(context.getString(R.string.title_notification_failed, title))
|
||||
.setContentText(Helper.formatThrowable(ex))
|
||||
.setContentIntent(pi)
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_MAX)
|
||||
.setOnlyAlertOnce(true)
|
||||
.setCategory(NotificationCompat.CATEGORY_ERROR)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
|
||||
builder.setStyle(new NotificationCompat.BigTextStyle()
|
||||
.bigText(Helper.formatThrowable(ex, false, "\n")));
|
||||
|
||||
@@ -80,16 +80,15 @@ public class ServiceExternal extends Service {
|
||||
}
|
||||
|
||||
private NotificationCompat.Builder getNotification() {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "service");
|
||||
|
||||
builder
|
||||
.setSmallIcon(R.drawable.baseline_compare_arrows_white_24)
|
||||
.setContentTitle(getString(R.string.tile_synchronize))
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(false)
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(this, "service")
|
||||
.setSmallIcon(R.drawable.baseline_compare_arrows_white_24)
|
||||
.setContentTitle(getString(R.string.tile_synchronize))
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(false)
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
@@ -123,17 +123,16 @@ public class ServiceSend extends LifecycleService {
|
||||
PendingIntent pi = PendingIntent.getActivity(
|
||||
this, ActivityView.REQUEST_OUTBOX, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "send");
|
||||
|
||||
builder
|
||||
.setSmallIcon(R.drawable.baseline_send_24)
|
||||
.setContentTitle(getString(R.string.title_notification_sending))
|
||||
.setContentIntent(pi)
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(this, "send")
|
||||
.setSmallIcon(R.drawable.baseline_send_24)
|
||||
.setContentTitle(getString(R.string.title_notification_sending))
|
||||
.setContentIntent(pi)
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
|
||||
if (lastUnsent > 0)
|
||||
builder.setContentText(getResources().getQuantityString(
|
||||
|
||||
@@ -266,18 +266,17 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
PendingIntent piWhy = PendingIntent.getActivity(this, ActivityView.REQUEST_WHY, why, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
// Build notification
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "service");
|
||||
|
||||
builder
|
||||
.setSmallIcon(R.drawable.baseline_compare_arrows_white_24)
|
||||
.setContentTitle(getResources().getQuantityString(
|
||||
R.plurals.title_notification_synchronizing, lastStats.accounts, lastStats.accounts))
|
||||
.setContentIntent(piWhy)
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(false)
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(this, "service")
|
||||
.setSmallIcon(R.drawable.baseline_compare_arrows_white_24)
|
||||
.setContentTitle(getResources().getQuantityString(
|
||||
R.plurals.title_notification_synchronizing, lastStats.accounts, lastStats.accounts))
|
||||
.setContentIntent(piWhy)
|
||||
.setAutoCancel(false)
|
||||
.setShowWhen(false)
|
||||
.setPriority(NotificationCompat.PRIORITY_MIN)
|
||||
.setCategory(NotificationCompat.CATEGORY_STATUS)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET);
|
||||
|
||||
if (lastStats.operations > 0)
|
||||
builder.setContentText(getResources().getQuantityString(
|
||||
|
||||
Reference in New Issue
Block a user