From b792563fad694286ee79ea7205853653502c7c7a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 29 Aug 2022 14:04:33 +0200 Subject: [PATCH] use non-custom missed called --- art/ic_missed_call_notification.svg | 344 ------------------ .../services/NotificationService.java | 82 ++--- .../ic_missed_call_notification.png | Bin 810 -> 0 bytes .../ic_missed_call_notification.png | Bin 589 -> 0 bytes .../ic_missed_call_notification.png | Bin 1151 -> 0 bytes .../ic_missed_call_notification.png | Bin 1680 -> 0 bytes .../ic_missed_call_notification.png | Bin 2179 -> 0 bytes .../drawable/ic_call_missed_white_24db.xml | 5 + 8 files changed, 43 insertions(+), 388 deletions(-) delete mode 100644 art/ic_missed_call_notification.svg delete mode 100644 src/main/res/drawable-hdpi/ic_missed_call_notification.png delete mode 100644 src/main/res/drawable-mdpi/ic_missed_call_notification.png delete mode 100644 src/main/res/drawable-xhdpi/ic_missed_call_notification.png delete mode 100644 src/main/res/drawable-xxhdpi/ic_missed_call_notification.png delete mode 100644 src/main/res/drawable-xxxhdpi/ic_missed_call_notification.png create mode 100644 src/main/res/drawable/ic_call_missed_white_24db.xml diff --git a/art/ic_missed_call_notification.svg b/art/ic_missed_call_notification.svg deleted file mode 100644 index 78f0acead..000000000 --- a/art/ic_missed_call_notification.svg +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 92c777fb4..55e220f62 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -36,6 +36,7 @@ import androidx.core.app.RemoteInput; import androidx.core.content.ContextCompat; import androidx.core.graphics.drawable.IconCompat; +import com.google.common.base.Joiner; import com.google.common.base.Strings; import com.google.common.collect.Iterables; @@ -973,19 +974,15 @@ public class NotificationService { final Builder builder = new NotificationCompat.Builder(mXmppConnectionService, "missed_calls"); int totalCalls = 0; - final StringBuilder names = new StringBuilder(); + final List names = new ArrayList<>(); long lastTime = 0; - for (Map.Entry entry : mMissedCalls.entrySet()) { + for (final Map.Entry entry : mMissedCalls.entrySet()) { final Conversational conversation = entry.getKey(); final MissedCallsInfo missedCallsInfo = entry.getValue(); - names.append(conversation.getContact().getDisplayName()); - names.append(", "); + names.add(conversation.getContact().getDisplayName()); totalCalls += missedCallsInfo.getNumberOfCalls(); lastTime = Math.max(lastTime, missedCallsInfo.getLastTime()); } - if (names.length() >= 2) { - names.delete(names.length() - 2, names.length()); - } final String title = (totalCalls == 1) ? mXmppConnectionService.getString(R.string.missed_call) @@ -999,9 +996,9 @@ public class NotificationService { builder.setContentTitle(title); builder.setTicker(title); if (!publicVersion) { - builder.setContentText(names.toString()); + builder.setContentText(Joiner.on(", ").join(names)); } - builder.setSmallIcon(R.drawable.ic_missed_call_notification); + builder.setSmallIcon(R.drawable.ic_call_missed_white_24db); builder.setGroupSummary(true); builder.setGroup(MISSED_CALLS_GROUP); builder.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN); @@ -1047,7 +1044,7 @@ public class NotificationService { } builder.setContentText(name); } - builder.setSmallIcon(R.drawable.ic_missed_call_notification); + builder.setSmallIcon(R.drawable.ic_call_missed_white_24db); builder.setGroup(MISSED_CALLS_GROUP); builder.setCategory(NotificationCompat.CATEGORY_CALL); builder.setWhen(info.getLastTime()); @@ -1091,42 +1088,39 @@ public class NotificationService { R.plurals.x_unread_conversations, notifications.size(), notifications.size())); - final StringBuilder names = new StringBuilder(); + final List names = new ArrayList<>(); Conversation conversation = null; for (final ArrayList messages : notifications.values()) { - if (messages.size() > 0) { - conversation = (Conversation) messages.get(0).getConversation(); - final String name = conversation.getName().toString(); - SpannableString styledString; - if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) { - int count = messages.size(); - styledString = - new SpannableString( - name - + ": " - + mXmppConnectionService - .getResources() - .getQuantityString( - R.plurals.x_messages, count, count)); - styledString.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0); - style.addLine(styledString); - } else { - styledString = - new SpannableString( - name - + ": " - + UIHelper.getMessagePreview( - mXmppConnectionService, messages.get(0)) - .first); - styledString.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0); - style.addLine(styledString); - } - names.append(name); - names.append(", "); + if (messages.isEmpty()) { + continue; } - } - if (names.length() >= 2) { - names.delete(names.length() - 2, names.length()); + conversation = (Conversation) messages.get(0).getConversation(); + final String name = conversation.getName().toString(); + SpannableString styledString; + if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) { + int count = messages.size(); + styledString = + new SpannableString( + name + + ": " + + mXmppConnectionService + .getResources() + .getQuantityString( + R.plurals.x_messages, count, count)); + styledString.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0); + style.addLine(styledString); + } else { + styledString = + new SpannableString( + name + + ": " + + UIHelper.getMessagePreview( + mXmppConnectionService, messages.get(0)) + .first); + styledString.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0); + style.addLine(styledString); + } + names.add(name); } final String contentTitle = mXmppConnectionService @@ -1137,7 +1131,7 @@ public class NotificationService { notifications.size()); mBuilder.setContentTitle(contentTitle); mBuilder.setTicker(contentTitle); - mBuilder.setContentText(names.toString()); + mBuilder.setContentText(Joiner.on(", ").join(names)); mBuilder.setStyle(style); if (conversation != null) { mBuilder.setContentIntent(createContentIntent(conversation)); diff --git a/src/main/res/drawable-hdpi/ic_missed_call_notification.png b/src/main/res/drawable-hdpi/ic_missed_call_notification.png deleted file mode 100644 index 3608ebd92478ee32c52ad4feba3b261218ebc50d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 810 zcmV+_1J(SAP)oxe((33 z_x;c1Kk%Os%1%%NuoBn+tN`W%GXR12KtJ#lxF16JP(RhNBJJui^_9i=soqhy)?1`S zJ+6K$D3Zkkb$vZ#7OKxCAd+TSJ*Q5uD$}LDtCLKcyXwrcGOL|fi}JXyPAe+YsSZt| zOv2S7GR^9f2FN7r%@aDg=>bQ%a@8{Iq-9HsW>?#QYd}Zpa8@fu$f!-gWnfiC+{pFSJ>!)7 zOdQi>^y-1STzy@nO{uw8#)Pg?w6pvuX$-yaYA_Z%R~V_c*zmNni15Pk{=x z#rwTEl`2!2gzuwUwzh=Ocv4klR0l>2wHo!Ys8E*FePfy!C(PnPEVC$M?2l9` zPgxn&(^*1?OD0LU)$V&>2*xt5men4R43~u;iKlQXi?eanvk(!Uty+Z`#3n@)3yp#bDn2DYi`|9EFzXxg-f5P-bMHC# z+}W886hhqui~@gvk0FG=rM3SfJ+9tY-@6(s>YRE*omdO;LG`I+_^sYmx0aI6sNV|7 zV=Sl#`jJo99jz4~)Uh`5ed^Z%$Q!&+*X0Cehd|!oLc<%HO$FXG??b>6us?+0`Z{nn zAzuU@WeRr#=QHs+U;@}yzwZT(0j~g1yNSiexwh1!Ei>P)o=)P|02&8-+Ptb$z$~yC z*pMv01WwlRo5|XEO!6t`Ks{AIPpCgyI^Sh=22wl#7^yXuTMS%MJ0XPUzzpy+(|H$| z%GCaf1(w=I1YAu-x&`C_@8S_%PVCLA7uDBMtP|z8jU~pJSYS-;^(j#86q0{ex2*D` z-YyVO{Zf!~ui+huG_LpAiv~Liaz?XJ^>A%(P%NwYYezkzE)GHDP&y(2LJ0Fz_sAWf zS1^t?O!v)D$JHz9Gpqk{&+0_KRi9XW-jnJ%tNUyva`13~=2{z?RBx%D)rFx8L_!!cl58m?00000NkvXXu0mjfUpoA) diff --git a/src/main/res/drawable-xhdpi/ic_missed_call_notification.png b/src/main/res/drawable-xhdpi/ic_missed_call_notification.png deleted file mode 100644 index 80cd15819fcca113e91cd6a57468a3062926bfed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1151 zcmV-_1c3XAP)dAf*T*3p6S`T|i9B zAdVfPHxWXzpo}6asy`rl&@Mz52ASp^8>>}brSqec?BB4RTxkz&Ie0o@W+3fAU zthM*r``8CItToL1=KGzQH8Xn#{^vy10o6-^<-h`9F>o4~0geJkB4W16`g%5?UI9D+ z+zH$YT+$}{EN~Fm1AGR29T8`G)leEW)b;9@>KVJ|nEJAM*&xN=t{&(?bTejZMlSBB z@DcSbb*^IZDM!@X`XPRWdZ>@WQ)bm?suaIU{c}L#Q{GUAdli3!dU77b=e(zOH&d$1 z)D!b4KIf%w#9yd>GvCT<%&8k&X&q{j{ycC?Y3KbRfH&18g>swCIDgM?qc`QXR_+=N zdho5a3B*X^GzxCB#hu_W<8@$hS6qxgdESD^SU)h&WkPk$S3N)+u0J zMC?`f0=t0KE%M%xzBKm0d~jAgKtxOeZ@0-mYO*GzJ+Pvi+RZjxuK?FItE@xuI`Or5 z4+5`uD7PH=zEQ}*0*lEbElgal{#bHhnpW2|#2Gi+PIqE`UM3wvBOP2fie6Tmxrm4p zz}>*l1&dDsYa?P$5^nJLQQF$P%^y+&2f7H9(yAx+QC-VJ){}qaFKK|U0O{?t zZfi~8qY+_599LIIgn5RV_-k@iDNY--^0mO=CiOESpyF^;`A0_1lL@^*42w`l`CgCU?W?kh)I&$o6}u zrzD71VTUS@8SJlk)??!*n{0mB(A6Sh= RVebF{002ovPDHLkV1lNL8CC!Q diff --git a/src/main/res/drawable-xxhdpi/ic_missed_call_notification.png b/src/main/res/drawable-xxhdpi/ic_missed_call_notification.png deleted file mode 100644 index 0072d2ef0d9253358efbc88d9ed7882b77e27be1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1680 zcmV;B25K~#90?VMe#9aR;_f2)*Iga|Dp7*dgvSQQ@l?1O;P!h?iB zga_ck05%vQKmq}R7-Fo65QO+Ze9Qry|-H(hO$9jHp+cATISWIz=Oc4qjWwYHUsBG z#PdxW*A_@!4m<*Uwn>K_u?09kBG%V!SW6)FNMHl7ylzKRz&7CQi1|NqO(&1})1$i6Z=QilzKGK(mQTY<^ zg%<2=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