mirror of https://github.com/M66B/FairEmail.git
Notification improvements
This commit is contained in:
parent
4601bbfbd8
commit
fb990e2899
|
@ -422,6 +422,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
// https://developer.android.com/training/notify-user/group
|
// https://developer.android.com/training/notify-user/group
|
||||||
String group = Long.toString(account);
|
String group = Long.toString(account);
|
||||||
|
|
||||||
|
String summary = getResources().getQuantityString(
|
||||||
|
R.plurals.title_notification_unseen, messages.size(), messages.size());
|
||||||
|
|
||||||
// Build pending intent
|
// Build pending intent
|
||||||
Intent view = new Intent(this, ActivityView.class);
|
Intent view = new Intent(this, ActivityView.class);
|
||||||
view.setAction("unified");
|
view.setAction("unified");
|
||||||
|
@ -442,7 +445,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
|
|
||||||
pbuilder
|
pbuilder
|
||||||
.setSmallIcon(R.drawable.baseline_email_white_24)
|
.setSmallIcon(R.drawable.baseline_email_white_24)
|
||||||
.setContentTitle(getResources().getQuantityString(R.plurals.title_notification_unseen, messages.size(), messages.size()))
|
.setContentTitle(summary)
|
||||||
.setContentIntent(piView)
|
.setContentIntent(piView)
|
||||||
.setNumber(messages.size())
|
.setNumber(messages.size())
|
||||||
.setShowWhen(false)
|
.setShowWhen(false)
|
||||||
|
@ -500,7 +503,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
sb.append("<br>");
|
sb.append("<br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.setStyle(new Notification.BigTextStyle().bigText(Html.fromHtml(sb.toString())));
|
builder.setStyle(new Notification.BigTextStyle()
|
||||||
|
.bigText(Html.fromHtml(sb.toString()))
|
||||||
|
.setSummaryText(summary));
|
||||||
}
|
}
|
||||||
|
|
||||||
notifications.add(builder.build());
|
notifications.add(builder.build());
|
||||||
|
@ -582,8 +587,11 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
if (message.content)
|
if (message.content)
|
||||||
try {
|
try {
|
||||||
String html = message.read(ServiceSynchronize.this);
|
String html = message.read(ServiceSynchronize.this);
|
||||||
String text = (TextUtils.isEmpty(message.subject) ? "" : message.subject + ": ") + Jsoup.parse(html).text();
|
StringBuilder sb = new StringBuilder();
|
||||||
mbuilder.setStyle(new Notification.BigTextStyle().bigText(text));
|
if (!TextUtils.isEmpty(message.subject))
|
||||||
|
sb.append(message.subject).append("<br>");
|
||||||
|
sb.append(Jsoup.parse(html).text());
|
||||||
|
mbuilder.setStyle(new Notification.BigTextStyle().bigText(Html.fromHtml(sb.toString())));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Log.e(Helper.TAG, ex + "/n" + Log.getStackTraceString(ex));
|
Log.e(Helper.TAG, ex + "/n" + Log.getStackTraceString(ex));
|
||||||
mbuilder.setStyle(new Notification.BigTextStyle().bigText(ex.toString()));
|
mbuilder.setStyle(new Notification.BigTextStyle().bigText(ex.toString()));
|
||||||
|
|
Loading…
Reference in New Issue