From a32bb652f77d4716476106fb6dadde108d287c3c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 23 Jan 2019 17:07:14 +0100 Subject: [PATCH] always show number of connected accounts in foreground notification. fixes #3352 --- .../java/eu/siacs/conversations/Config.java | 1 - .../services/NotificationService.java | 28 ++++++++---------- .../drawable-hdpi/ic_link_off_white_24dp.png | Bin 0 -> 415 bytes .../drawable-mdpi/ic_link_off_white_24dp.png | Bin 0 -> 273 bytes .../drawable-xhdpi/ic_link_off_white_24dp.png | Bin 0 -> 472 bytes .../ic_link_off_white_24dp.png | Bin 0 -> 650 bytes .../ic_link_off_white_24dp.png | Bin 0 -> 811 bytes src/main/res/values/strings.xml | 1 - src/quicksy/res/values/strings.xml | 3 +- 9 files changed, 13 insertions(+), 20 deletions(-) create mode 100755 src/main/res/drawable-hdpi/ic_link_off_white_24dp.png create mode 100755 src/main/res/drawable-mdpi/ic_link_off_white_24dp.png create mode 100755 src/main/res/drawable-xhdpi/ic_link_off_white_24dp.png create mode 100755 src/main/res/drawable-xxhdpi/ic_link_off_white_24dp.png create mode 100755 src/main/res/drawable-xxxhdpi/ic_link_off_white_24dp.png diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index ed0e9e3c03b3326ae28c6c1cb37e923c3065e11c..22d36293253163fff4fd4a5563fd0a83109090cb 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -51,7 +51,6 @@ public final class Config { //Notification settings public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false; - public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification public static final boolean ALWAYS_NOTIFY_BY_DEFAULT = false; public static final boolean SUPPRESS_ERROR_NOTIFICATION = false; diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index e2a2ba673d2ebbe7f8137bf62c58df5936e5f192..1e7f033918b33d55bb711d91b9d82530035686b7 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -901,28 +901,24 @@ public class NotificationService { Notification createForegroundNotification() { final Notification.Builder mBuilder = new Notification.Builder(mXmppConnectionService); mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.app_name)); - if (Compatibility.runsAndTargetsTwentySix(mXmppConnectionService) || Config.SHOW_CONNECTED_ACCOUNTS) { - final List accounts = mXmppConnectionService.getAccounts(); - int enabled = 0; - int connected = 0; - if (accounts != null) { - for (Account account : accounts) { - if (account.isOnlineAndConnected()) { - connected++; - enabled++; - } else if (account.isEnabled()) { - enabled++; - } + final List accounts = mXmppConnectionService.getAccounts(); + int enabled = 0; + int connected = 0; + if (accounts != null) { + for (Account account : accounts) { + if (account.isOnlineAndConnected()) { + connected++; + enabled++; + } else if (account.isEnabled()) { + enabled++; } } - mBuilder.setContentText(mXmppConnectionService.getString(R.string.connected_accounts, connected, enabled)); - } else { - mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_open_conversations)); } + mBuilder.setContentText(mXmppConnectionService.getString(R.string.connected_accounts, connected, enabled)); mBuilder.setContentIntent(createOpenConversationsIntent()); mBuilder.setWhen(0); mBuilder.setPriority(Notification.PRIORITY_MIN); - mBuilder.setSmallIcon(R.drawable.ic_link_white_24dp); + mBuilder.setSmallIcon(connected > 0 ? R.drawable.ic_link_white_24dp : R.drawable.ic_link_off_white_24dp); if (Compatibility.runsTwentySix()) { mBuilder.setChannelId("foreground"); diff --git a/src/main/res/drawable-hdpi/ic_link_off_white_24dp.png b/src/main/res/drawable-hdpi/ic_link_off_white_24dp.png new file mode 100755 index 0000000000000000000000000000000000000000..d02809fca46ece467a4038374ff8ae574759425c GIT binary patch literal 415 zcmV;Q0bu@#P)DSo2_hn%9zdU8uP3))*Qz;X4|%1Uq0LUBi`}7-x)5y>l@1Y^R!nz z3#PeyPN?<&&~9+%zbOq|%8IJvTvk*~C$pleIa-*~)x0=n7^Sn4;!KIjZcvCa4{3Le zDF$r@QmQBfi$i{90G?Xs>JO@J_>pG1io*cw0W(9ITHb<9Du$q;i{N6U@-oPKe9$Ug zycFz=^L3s1EwvCVPZ#b7twYQj5Gm!&G|#-`8NmsEEHFfHU~u0qXAK9Q?Gs4+fbRw$e??iPnq$~e74 z@s#Lnl$qwm(KW>1h~ts^zf^akbWpoP$b!13c?elh9Ya}v*=MhJQOcxmHS_=g002ov JPDHLkV1lm4yk-CZ literal 0 HcmV?d00001 diff --git a/src/main/res/drawable-mdpi/ic_link_off_white_24dp.png b/src/main/res/drawable-mdpi/ic_link_off_white_24dp.png new file mode 100755 index 0000000000000000000000000000000000000000..9120ab9d2f4f918349e0bf2eea5dd02c9617ef9a GIT binary patch literal 273 zcmV+s0q*{ZP)#<1kOR zI4W!qr5D)po0p>=w zYvSgI=sEL(6P)Nkl0D#fp?(PoTz@frjTO3+s3)Hl@b}RrdaUXYSaJL-Xa!DRGKL4w(d^s-~wbt7I z%rF;>ugk-ip{C9VXQ2)Wqg6CBVsu>*HGqn`BF5J}G0DqpLb8Xh*=MOvQSMA}2eJrh zm6{!8rH$P{HX*&(&MaUL0Pd?wBb-V6?ur3OC9DN-+j4CUP>@0d>0z!*fY^*EOk0J3 z6WV{78>}>y2-4nhK!q;h@&Z8dkBf$@_yeM|Jiw}O@o2d8=dYfHfTQ735qP0vVjd(3 zeO(6xD(9FCW8I>;8_Sf0r?@2NrXTpco_nD;8l2uvWdj*-hlEDI1E@6 zrDUwy1QBEt;AFV83XrE$22q(s=13&Wu6mdbB#7ZrUG(j}ptO}}2}C8}bQIMkQD#_FR~hAO-5kEP*4_i5?a+1eJ(fHG O0000jwykKkZQBT^Sc{W6m=(^pZCn4MrhT}t=RV#o{Ti!(d5%OvL?V$0 z8QD%(aRr&!1N@|`D>?fBoJnFAfI~^N=ev7JKV3`e>SEF_*OGek$F-!sQBpXDxR``p z5+mu3`sNatrioGZB z(1V|*Br_)9TQ4Rw!1sjAqCzJ_l6GQt5);z#1m7xAvQ1(cz6YceGo}zU*&^wOHi^^xk literal 0 HcmV?d00001 diff --git a/src/main/res/drawable-xxxhdpi/ic_link_off_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_link_off_white_24dp.png new file mode 100755 index 0000000000000000000000000000000000000000..dff8324fed02373c1587c77b4018a05f7aa02411 GIT binary patch literal 811 zcmV+`1JwM9P)YtQtUiJY}>YNY@Imi-rdxlnO@YS`kQi%PN5~KJkRqy z&+|OW(of=xDggA0_wUCwfjXG_#ryZ;mp}`MdqR8g3GRGCcL02XPw)x-ZqJ17aZB(C z1hI`_l;Y)V1U$zMw*tOyNcPat6R9fw0cdn)}5ag*b#EY64MgqoBCp4!UD< zNFb`A+%M5^H)An5B@o?wo{;dkg9(@%6L2w$`y?#da4Tn77e0X&%GHGt%qBs4LnIuE zkj{R3^E3Bx2SfCPD0rHRtR$V%5*&}PpJWL-bH7}pBsiiNdq{SSCtTK`hxthiSx@!F+KG-k*ov)%7;>6W9ov5H z6b)adJoJD_eiFEg_1Jz84OOu<6-8DPs$pv=8b)LLB=`)gC-6UKu_$kU2irK&un5y0 zQGi>5DA7Of>D?fIS$YhM8QZ*r$oacOjGp$ zw**lz3Db7bunf~SJ-{tN6zs*cL^O=Y_LdglmY}@-lhFGD8epp~5ip2U?Iko?Vyh$? ze#Ew(yYiL5-R!~knP|9^o!DwfB=mMopeeSE5(I6ro#4}aB=83bY%L@Rp5ZLE-MpIX z1U}{%wllmU!O(|f+jv7Fp>vc3{^T&p+DcG7kx~zPDVCcA9-|uxl5OQd369dFvyAdQ zoy`Q^pf&qRmEb!GhY_TgU^XM^svT5COP~bjNvE}h#XZczfh2)|35C)mjN}dpk0+U* z<$z!b=6)#hop=@^uP!eK;K|Vp{6MTYC@CiO4PUwAmCbWoqLKBfVC)APnp||q; pu}P>S@kKAHh|2Rk&+|Oby9i1-CL)2R3eW%m002ovPDHLkV1gYDaH0SJ literal 0 HcmV?d00001 diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index e5b68c10cfa9b2dc5a08f3b2ace364b8d5ed4e06..b6183606a26b407760a3cada5b1ff36d86b0439f 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -400,7 +400,6 @@ PDF document Android App Contact - Touch to open Conversations Avatar has been published! Sending %s Offering %s diff --git a/src/quicksy/res/values/strings.xml b/src/quicksy/res/values/strings.xml index 5f1eda0fcf14608b453a1fb4418b45ff01f50279..3792c2adab2cb4d02de662cdd2b70141c7c49541 100644 --- a/src/quicksy/res/values/strings.xml +++ b/src/quicksy/res/values/strings.xml @@ -7,7 +7,6 @@ Quicksy is unable to encrypt your messages because your contacts are not announcing their public key.\n\nPlease ask your contacts to setup OpenPGP. The length of time Quicksy keeps quiet after seeing activity on another device By sending in stack traces you are helping the ongoing development of Quicksy - Touch to open Quicksy Quicksy needs access to external storage Quicksy needs access to the camera Your device is doing some heavy battery optimizations on Quicksy that might lead to delayed notifications or even message loss.\nIt is recommended to disable those. @@ -20,4 +19,4 @@ Quicksy needs access to the microphone This notification category is used to display a permanent notification indicating that Quicksy is running. Quicksy profile picture - \ No newline at end of file +