Use full text for notifications

pull/174/head
M66B 5 years ago
parent 28aaf8ee05
commit 9df6a659d3

@ -3173,6 +3173,15 @@ class Core {
} }
if (message.content && notify_preview) { if (message.content && notify_preview) {
// Android will truncate the text
String text = null;
try {
String html = Helper.readText(message.getFile(context));
text = HtmlHelper.getText(html);
} catch (Throwable ex) {
Log.e(ex);
}
// Wearables // Wearables
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
@ -3180,8 +3189,8 @@ class Core {
if (wearable_preview) { if (wearable_preview) {
if (sb.length() != 0) if (sb.length() != 0)
sb.append(" - "); sb.append(" - ");
if (!TextUtils.isEmpty(message.preview)) if (!TextUtils.isEmpty(text))
sb.append(message.preview); sb.append(text);
} }
if (sb.length() > 0) if (sb.length() > 0)
mbuilder.setContentText(sb.toString()); mbuilder.setContentText(sb.toString());
@ -3191,15 +3200,17 @@ class Core {
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
sbm.append("<em>").append(message.subject).append("</em>").append("<br>"); sbm.append("<em>").append(message.subject).append("</em>").append("<br>");
if (!TextUtils.isEmpty(message.preview)) if (!TextUtils.isEmpty(text))
sbm.append(message.preview); sbm.append(text);
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle() if (sbm.length() > 0) {
.bigText(HtmlHelper.fromHtml(sbm.toString())); NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle()
if (!TextUtils.isEmpty(message.subject)) .bigText(HtmlHelper.fromHtml(sbm.toString()));
bigText.setSummaryText(message.subject); if (!TextUtils.isEmpty(message.subject))
bigText.setSummaryText(message.subject);
mbuilder.setStyle(bigText); mbuilder.setStyle(bigText);
}
} else { } else {
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
mbuilder.setContentText(message.subject); mbuilder.setContentText(message.subject);
@ -3219,8 +3230,8 @@ class Core {
// https://developer.android.com/training/wearables/notifications // https://developer.android.com/training/wearables/notifications
// https://developer.android.com/reference/android/app/Notification.WearableExtender // https://developer.android.com/reference/android/app/Notification.WearableExtender
mbuilder.extend(new NotificationCompat.WearableExtender() mbuilder.extend(new NotificationCompat.WearableExtender()
.addActions(wactions) .addActions(wactions)
.setDismissalId(BuildConfig.APPLICATION_ID + ":" + id) .setDismissalId(BuildConfig.APPLICATION_ID + ":" + id)
/* .setBridgeTag(id < 0 ? "header" : "body") */); /* .setBridgeTag(id < 0 ? "header" : "body") */);
notifications.add(mbuilder); notifications.add(mbuilder);

Loading…
Cancel
Save