From 0bc172aab03c5a86ea8f2a940d3012dc8bc7f72c Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 19 Feb 2019 16:30:03 +0000 Subject: [PATCH] Show notification preview italic Refs #148 --- .../java/eu/faircode/email/ServiceSynchronize.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 1397e052e3..fe078ae419 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -690,11 +690,15 @@ public class ServiceSynchronize extends LifecycleService { if (!TextUtils.isEmpty(message.subject)) sb.append(message.subject).append("
"); String text = Jsoup.parse(body).text(); - if (text.length() > HtmlHelper.PREVIEW_SIZE) { - sb.append(text.substring(0, HtmlHelper.PREVIEW_SIZE)); - sb.append(" …"); - } else - sb.append(text); + if (!TextUtils.isEmpty(text)) { + sb.append(""); + if (text.length() > HtmlHelper.PREVIEW_SIZE) { + sb.append(text.substring(0, HtmlHelper.PREVIEW_SIZE)); + sb.append("…"); + } else + sb.append(text); + sb.append(""); + } mbuilder.setStyle(new Notification.BigTextStyle().bigText(HtmlHelper.fromHtml(sb.toString()))); } catch (IOException ex) { Log.e(ex);