1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-02 13:14:39 +00:00

Wearables don't support removal of notifications :-(

This commit is contained in:
M66B 2019-10-13 17:22:52 +02:00
parent e3ef77eb76
commit c206fa52b5

View file

@ -3053,27 +3053,24 @@ class Core {
if (message.content && notify_preview) if (message.content && notify_preview)
try { try {
String body = Helper.readText(message.getFile(context));
String preview = HtmlHelper.getPreview(body);
String summary =
(TextUtils.isEmpty(message.subject) ? "" : message.subject) +
" - " +
(TextUtils.isEmpty(preview) ? "" : preview);
// Wearable
mbuilder.setContentText(summary);
StringBuilder sbm = new StringBuilder(); StringBuilder sbm = new StringBuilder();
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
sbm.append(message.subject).append("<br>"); sbm.append(message.subject).append("<br>");
String body = Helper.readText(message.getFile(context));
String preview = HtmlHelper.getPreview(body);
if (!TextUtils.isEmpty(preview)) if (!TextUtils.isEmpty(preview))
sbm.append("<em>").append(preview).append("</em>"); sbm.append("<em>").append(preview).append("</em>");
mbuilder.setStyle(new NotificationCompat.BigTextStyle() NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle()
.bigText(HtmlHelper.fromHtml(sbm.toString())) .bigText(HtmlHelper.fromHtml(sbm.toString()));
.setSummaryText(summary));
if (!TextUtils.isEmpty(message.subject)) {
bigText.setSummaryText(message.subject);
mbuilder.setContentText(message.subject); // Wearable
}
mbuilder.setStyle(bigText);
} catch (IOException ex) { } catch (IOException ex) {
Log.e(ex); Log.e(ex);
mbuilder.setStyle(new NotificationCompat.BigTextStyle() mbuilder.setStyle(new NotificationCompat.BigTextStyle()