|
|
@ -281,16 +281,6 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
|
|
|
|
|
|
|
|
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
|
|
|
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
|
|
|
|
|
|
|
|
|
|
|
DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT);
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
for (EntityMessage message : messages) {
|
|
|
|
|
|
|
|
sb.append(MessageHelper.getFormattedAddresses(message.from, false));
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(message.subject))
|
|
|
|
|
|
|
|
sb.append(": ").append(message.subject);
|
|
|
|
|
|
|
|
sb.append(" ").append(df.format(new Date(message.sent)));
|
|
|
|
|
|
|
|
sb.append("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Build notification
|
|
|
|
// Build notification
|
|
|
|
Notification.Builder builder;
|
|
|
|
Notification.Builder builder;
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
|
@ -302,7 +292,6 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
.setSmallIcon(R.drawable.baseline_mail_24)
|
|
|
|
.setSmallIcon(R.drawable.baseline_mail_24)
|
|
|
|
.setContentTitle(getResources().getQuantityString(R.plurals.title_notification_unseen, messages.size(), messages.size()))
|
|
|
|
.setContentTitle(getResources().getQuantityString(R.plurals.title_notification_unseen, messages.size(), messages.size()))
|
|
|
|
.setContentIntent(pi)
|
|
|
|
.setContentIntent(pi)
|
|
|
|
.setStyle(new Notification.BigTextStyle().bigText(sb.toString()))
|
|
|
|
|
|
|
|
.setSound(uri)
|
|
|
|
.setSound(uri)
|
|
|
|
.setShowWhen(false)
|
|
|
|
.setShowWhen(false)
|
|
|
|
.setPriority(Notification.PRIORITY_DEFAULT)
|
|
|
|
.setPriority(Notification.PRIORITY_DEFAULT)
|
|
|
@ -310,6 +299,20 @@ public class ServiceSynchronize extends LifecycleService {
|
|
|
|
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
|
|
|
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
|
|
|
.setDeleteIntent(pid);
|
|
|
|
.setDeleteIntent(pid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("pro", false)) {
|
|
|
|
|
|
|
|
DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT);
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
for (EntityMessage message : messages) {
|
|
|
|
|
|
|
|
sb.append(MessageHelper.getFormattedAddresses(message.from, false));
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(message.subject))
|
|
|
|
|
|
|
|
sb.append(": ").append(message.subject);
|
|
|
|
|
|
|
|
sb.append(" ").append(df.format(new Date(message.sent)));
|
|
|
|
|
|
|
|
sb.append("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
builder.setStyle(new Notification.BigTextStyle().bigText(sb.toString()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
return builder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|