From bc89d6106b1fda9dea1f5fc9f2d2983e991835ba Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Tue, 23 Nov 2021 10:52:27 -0500 Subject: [PATCH] Notification icons --- app/src/main/AndroidManifest.xml | 2 +- .../io/heckel/ntfy/msg/NotificationService.kt | 5 +- .../io/heckel/ntfy/msg/SubscriberService.kt | 2 + .../ic_notification_icon.xml | 35 ---- .../drawable-hdpi/ic_notification_icon.png | Bin 415 -> 0 bytes .../drawable-mdpi/ic_notification_icon.png | Bin 294 -> 0 bytes .../drawable-xhdpi/ic_notification_icon.png | Bin 517 -> 0 bytes .../drawable-xxhdpi/ic_notification_icon.png | Bin 732 -> 0 bytes app/src/main/res/drawable/ic_notification.xml | 31 ++++ .../res/drawable/ic_notification_instant.xml | 31 ++-- assets/notification.svg | 168 ++++++++++++------ assets/notification_instant.svg | 143 ++++++++++----- 12 files changed, 265 insertions(+), 152 deletions(-) delete mode 100644 app/src/main/res/drawable-anydpi-v24/ic_notification_icon.xml delete mode 100644 app/src/main/res/drawable-hdpi/ic_notification_icon.png delete mode 100644 app/src/main/res/drawable-mdpi/ic_notification_icon.png delete mode 100644 app/src/main/res/drawable-xhdpi/ic_notification_icon.png delete mode 100644 app/src/main/res/drawable-xxhdpi/ic_notification_icon.png create mode 100644 app/src/main/res/drawable/ic_notification.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a25955c..a3f257d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -67,7 +67,7 @@ android:value="false"/> + android:resource="@drawable/ic_notification"/> diff --git a/app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt b/app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt index 830cb96..0eb3882 100644 --- a/app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt +++ b/app/src/main/java/io/heckel/ntfy/msg/NotificationService.kt @@ -10,6 +10,7 @@ import android.media.RingtoneManager import android.os.Build import android.util.Log import androidx.core.app.NotificationCompat +import androidx.core.content.ContextCompat import io.heckel.ntfy.R import io.heckel.ntfy.data.Notification import io.heckel.ntfy.data.Subscription @@ -37,9 +38,11 @@ class NotificationService(val context: Context) { val defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION) val notificationBuilder = NotificationCompat.Builder(context, CHANNEL_ID) - .setSmallIcon(R.drawable.ic_notification_icon) + .setSmallIcon(R.drawable.ic_notification) + .setColor(ContextCompat.getColor(context, R.color.primaryColor)) .setContentTitle(title) .setContentText(notification.message) + .setStyle(NotificationCompat.BigTextStyle().bigText(notification.message)) .setSound(defaultSoundUri) .setContentIntent(pendingIntent) // Click target for notification .setAutoCancel(true) // Cancel when notification is clicked diff --git a/app/src/main/java/io/heckel/ntfy/msg/SubscriberService.kt b/app/src/main/java/io/heckel/ntfy/msg/SubscriberService.kt index 20581ec..a9f574f 100644 --- a/app/src/main/java/io/heckel/ntfy/msg/SubscriberService.kt +++ b/app/src/main/java/io/heckel/ntfy/msg/SubscriberService.kt @@ -10,6 +10,7 @@ import android.os.PowerManager import android.os.SystemClock import android.util.Log import androidx.core.app.NotificationCompat +import androidx.core.content.ContextCompat import io.heckel.ntfy.R import io.heckel.ntfy.app.Application import io.heckel.ntfy.data.ConnectionState @@ -202,6 +203,7 @@ class SubscriberService : Service() { } return NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID) .setSmallIcon(R.drawable.ic_notification_instant) + .setColor(ContextCompat.getColor(this, R.color.primaryColor)) .setContentTitle(title) .setContentText(text) .setContentIntent(pendingIntent) diff --git a/app/src/main/res/drawable-anydpi-v24/ic_notification_icon.xml b/app/src/main/res/drawable-anydpi-v24/ic_notification_icon.xml deleted file mode 100644 index 214e225..0000000 --- a/app/src/main/res/drawable-anydpi-v24/ic_notification_icon.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - diff --git a/app/src/main/res/drawable-hdpi/ic_notification_icon.png b/app/src/main/res/drawable-hdpi/ic_notification_icon.png deleted file mode 100644 index 8462cdd8b1933c6daebcf8de87e69782c6c2bde6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 415 zcmV;Q0bu@#P)6Q%GTokSbtdW9u7;t%8MGh=_=Vpn`&}m7pHa zFbTOCSh90Bvtx8W_}FFU-rd78J5wqZ6#P{H>_m3l4HTQ{z6rEX%Q?A=Hi?019TNfJ zyEepoy9eU^Al;^8vbI-15on0M&|6xk6S5~OPzHJubN6(QPRU*^@D0=)U!~{tL)1Lb z13D{feSs!W3yv?+Q~EAypJ~IbO$)LFYQgyhdQ2bb7d>-p(t@mkI5$9-=?Uy&j}wSv zBXpBqpmQzV(TZE27Wf8&{UT;Jy{4bd`EPndt8foQPoM~7etWZ43?|SO>_#~%d$m9r z$gGu1x<-d(PgbA^WR8v{bCtEd0=|KKfc={DDVz~KK?6{Tmty^C|ACtM&6=+{6;u)lg99->WRpjiC=K;_5=ISmT_A3tg*QFzXx8g>8x002ov JPDHLkV1gaUuweiI diff --git a/app/src/main/res/drawable-mdpi/ic_notification_icon.png b/app/src/main/res/drawable-mdpi/ic_notification_icon.png deleted file mode 100644 index 35f1fb4680e9580510730db56886e617b97dbbf9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 294 zcmV+>0oneEP)947%odwf6raK38<<&?j7F24FJNMk!Ddv-B*|t`7BX4vC|gnP9FkE^&IEL5Mck+6d1!k%<#|` zNCHFnfM+;>SsoT(45)WiIEOcQfg_maO&UZ2&sqiU>HS4z|9TLj0Pa(;s}6VB!W?hX zK&Ak$ZFo}e*02Q=yukno0#mqz4H)A=A(B9W7einS=)g=9?gCtSW_}8||HFT{>&7z^ sJ|N+*fg?Ov@JYTv2QDnz<3NOt7aG$t`;>^mB>(^b07*qoM6N<$f*?$KF#rGn diff --git a/app/src/main/res/drawable-xhdpi/ic_notification_icon.png b/app/src/main/res/drawable-xhdpi/ic_notification_icon.png deleted file mode 100644 index 293af5e51ee3491a0cb0095f0a34822496af5e03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 517 zcmV+g0{Z=lP)}<5Mu}~{J8yg!f?0f?o3ol@yAc%OsbSi>~ zpm_cL$4zi{5^!kpi@uH7?w`&Ko_YbF@Y8kp#8@@-_8zj2_UZa5+BcIbEP_ zX0I)f2vC4)X*xvr=tH;-U-XI&n0+=tGJp>2dg&&;HTq}FS{o2o00nD15rnv-pZWge z2VhMXg7=i0aO)4#X1xuN48XO1xXcrj z?RuXS5D1_)|62ZT)Jj3bN)QXNOJSkL z#D7IaJ)X-jWcR+89eKRHJG*;7I0Sa?++;uY&CZ)lOgN6?IF92uj^or1fQ6oCuXa)b z&VKErgs$!(E+~NuN-&b36U^Zb<^u*9Nze{m*9CZAi~2_4f>wYFss?on;`K>pm%iQ> zU?6CU`OVBT`}BD3z(~+X1WEGqJ~N~1as@_$-WTfrB8Ym#9Mbikv+y!=BS>R z3osJ&MHeeX)C=aAp5HVu5VVH5j3D7#dCCA%v%s8WCUvhSK;42O9N)xTV3wHA<*5V6 z8uf}f&8*YCEP<7v2*Le zQ-X?c?h)n*!V@LifMMLz^DICPf+FlO!`w!A>&e#OXQ6+;1#$jb<`nZBVeOHRo$S6N z{S<_-Pm)FWHS?+5vP8cGv3?74ky%E1BPnasb=|`PSPPOm<{H9He=oNvA&a#BKL|Bi)hKz}rIi&t`X$TAi#q*%m z_=WJ+y2(uI`Aq{OLBozaejq$CH<+DzUM`>kL9#H*6Lp2zuIqCHMuOxuE=L`*`Mbny z)^)i8BSCMO^UOv)o;xrQB;VRM=<96(bqi`cXsaOpzHJB#{nat#tnME{iv{gL`snt5 zd8YeE&~ib;{`gUFK?yo5NRCRzK_>-GBOJ258$;%G{|MSD$O^ciYT$yZfeWezE~px~ zplUEiL64aS9gG|aYeo{(CtOeh7nHySB}fXI?RmCpCywJdj^j9vGr&KWaU + + + + + + diff --git a/app/src/main/res/drawable/ic_notification_instant.xml b/app/src/main/res/drawable/ic_notification_instant.xml index 384b37d..36f84fe 100644 --- a/app/src/main/res/drawable/ic_notification_instant.xml +++ b/app/src/main/res/drawable/ic_notification_instant.xml @@ -1,25 +1,26 @@ + android:width="50dp" + android:height="50dp" + android:viewportWidth="50" + android:viewportHeight="50"> + android:pathData="m10.9661,15.6112l0,4.8516l7.3742,3.9002c0.0157,0.0077 0.0305,0.0128 0.0461,0.0204 -0.0157,0.0077 -0.0305,0.0128 -0.0461,0.0204l-7.3742,3.9002l0,4.8267l0.7961,-0.4333 11.1995,-6.0969l0,-4.463zM12.0931,17.6933 L21.8346,22.9981l0,2.7446l-9.7414,5.2999l0,-1.8679l6.6912,-3.5416 0.0084,-0.0051c0.1961,-0.0992 0.3826,-0.1724 0.5531,-0.2191l0.0127,0l0.0167,-0.0051c0.2034,-0.0691 0.3777,-0.1209 0.5279,-0.1545l1.0684,-0.1046l0,-1.4644l-0.5154,-0.0497c-0.1632,-0.0153 -0.3288,-0.0505 -0.4944,-0.0997l-0.0167,-0.0051 -0.0167,-0.0051c-0.1632,-0.0352 -0.3552,-0.0811 -0.5656,-0.1344 -0.1802,-0.0668 -0.3706,-0.1479 -0.5698,-0.2492l-0.0084,-0.0051 -6.6912,-3.5416z" + android:strokeWidth="0.525121" + android:fillColor="#338574" + android:strokeColor="#00000000"/> diff --git a/assets/notification.svg b/assets/notification.svg index 03fc734..c9a9224 100644 --- a/assets/notification.svg +++ b/assets/notification.svg @@ -2,16 +2,16 @@ + id="defs2"> + + + + + + + + + inkscape:pagecheckerboard="0"> + + + + + + + + + @@ -64,53 +134,37 @@ inkscape:label="foreground" inkscape:groupmode="layer" id="layer1" - transform="translate(-51.147327,-81.515579)" + transform="translate(-51.451771,-87.327048)" style="display:inline"> + id="path2498" + style="color:#000000;fill:#338574;fill-opacity:1;stroke:none;stroke-width:0.754022;-inkscape-stroke:none" + d="m 59.291677,93.677052 c -3.579993,0 -6.646873,2.817003 -6.646873,6.398338 v 0.003 l 0.03508,27.86677 -0.899113,6.63475 12.226096,-3.24797 H 94.40052 c 3.579985,0 6.64687,-2.82079 6.64687,-6.40216 v -24.85449 c 0,-3.580312 -3.065184,-6.39668 -6.643822,-6.398338 h -0.0031 z m 0,4.516205 h 35.108844 0.0031 c 1.257851,0.0013 2.12767,0.916373 2.12767,1.882133 v 24.85442 c 0,0.9666 -0.871353,1.88213 -2.13072,1.88213 H 63.344139 l -6.211425,1.87679 0.0633,-0.36604 -0.03431,-28.2473 c 0,-0.966516 0.870609,-1.882133 2.129956,-1.882133 z" /> - - - - - - - - + id="path1011-6-2" + transform="matrix(2.1452134,0,0,2.5503116,-71.247407,-178.388)" + style="font-size:8.48274px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#338574;fill-opacity:1;stroke:none;stroke-width:0.525121"> + + + + + + - diff --git a/assets/notification_instant.svg b/assets/notification_instant.svg index 38cc745..850e4d0 100644 --- a/assets/notification_instant.svg +++ b/assets/notification_instant.svg @@ -2,16 +2,16 @@ + id="defs2"> + + + + + + + + + inkscape:pagecheckerboard="0"> + + + + + + + + + @@ -64,42 +134,29 @@ inkscape:label="foreground" inkscape:groupmode="layer" id="layer1" - transform="translate(-51.147327,-81.515579)" + transform="translate(-51.451771,-87.327048)" style="display:inline"> + + id="path1011-6-2" + transform="matrix(2.1452134,0,0,2.5503116,-71.247407,-178.388)" + style="font-size:8.48274px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#338574;fill-opacity:1;stroke:none;stroke-width:0.525121"> + id="path7553" /> + style="color:#000000;-inkscape-font-specification:'JetBrains Mono, Bold';fill:#338574;fill-opacity:1;stroke:none;-inkscape-stroke:none" + d="m 62.308594,110.31055 v 1.90234 l 3.4375,1.5293 c 0.0073,0.003 0.0142,0.005 0.02148,0.008 -0.0073,0.003 -0.0142,0.005 -0.02148,0.008 l -3.4375,1.5293 v 1.89258 l 0.371093,-0.16992 5.220704,-2.39063 v -1.75 z m 0.52539,0.8164 4.541016,2.08008 v 1.07617 l -4.541016,2.07813 v -0.73242 l 3.119141,-1.38868 0.0039,-0.002 c 0.09141,-0.0389 0.178343,-0.0676 0.257813,-0.0859 h 0.0059 l 0.0078,-0.002 c 0.09483,-0.0271 0.176055,-0.0474 0.246093,-0.0606 l 0.498047,-0.041 v -0.57422 l -0.240234,-0.0195 c -0.07606,-0.006 -0.153294,-0.0198 -0.230469,-0.0391 l -0.0078,-0.002 -0.0078,-0.002 c -0.07608,-0.0138 -0.16556,-0.0318 -0.263672,-0.0527 -0.08398,-0.0262 -0.172736,-0.058 -0.265625,-0.0977 l -0.0039,-0.002 -3.119141,-1.38868 z" + id="path7555" /> - - -