From 8fc467652d010acbb035c568414ad4afbf0bd5d8 Mon Sep 17 00:00:00 2001 From: len Date: Thu, 13 Oct 2016 19:45:10 +0200 Subject: [PATCH] Add app's notification icon --- .../data/library/LibraryUpdateService.kt | 19 +++++++++++++++--- .../res/drawable-hdpi/notification_icon.png | Bin 0 -> 554 bytes .../res/drawable-mdpi/notification_icon.png | Bin 0 -> 403 bytes .../res/drawable-xhdpi/notification_icon.png | Bin 0 -> 754 bytes .../res/drawable-xxhdpi/notification_icon.png | Bin 0 -> 1135 bytes 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/notification_icon.png create mode 100644 app/src/main/res/drawable-mdpi/notification_icon.png create mode 100644 app/src/main/res/drawable-xhdpi/notification_icon.png create mode 100644 app/src/main/res/drawable-xxhdpi/notification_icon.png diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 2e64da5a9d..08cb8e3eba 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -5,6 +5,8 @@ import android.app.Service import android.content.BroadcastReceiver import android.content.Context import android.content.Intent +import android.graphics.Bitmap +import android.graphics.BitmapFactory import android.os.IBinder import android.os.PowerManager import android.support.v4.app.NotificationCompat @@ -71,6 +73,8 @@ class LibraryUpdateService : Service() { private val notificationId: Int get() = Constants.NOTIFICATION_LIBRARY_ID + private var notificationBitmap: Bitmap? = null + companion object { /** @@ -137,6 +141,8 @@ class LibraryUpdateService : Service() { */ override fun onDestroy() { subscription?.unsubscribe() + notificationBitmap?.recycle() + notificationBitmap = null LibraryUpdateAlarm.startAlarm(this) destroyWakeLock() super.onDestroy() @@ -160,6 +166,10 @@ class LibraryUpdateService : Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { if (intent == null) return Service.START_NOT_STICKY + if (notificationBitmap == null) { + notificationBitmap = BitmapFactory.decodeResource(resources, R.mipmap.ic_launcher) + } + // Unsubscribe from any previous subscription if needed. subscription?.unsubscribe() @@ -369,7 +379,8 @@ class LibraryUpdateService : Service() { */ private fun showNotification(title: String, body: String) { notificationManager.notify(notificationId, notification() { - setSmallIcon(R.drawable.ic_refresh_white_24dp_img) + setSmallIcon(R.drawable.notification_icon) + setLargeIcon(notificationBitmap) setContentTitle(title) setContentText(body) }) @@ -384,7 +395,8 @@ class LibraryUpdateService : Service() { */ private fun showProgressNotification(manga: Manga, current: Int, total: Int, cancelIntent: PendingIntent) { notificationManager.notify(notificationId, notification() { - setSmallIcon(R.drawable.ic_refresh_white_24dp_img) + setSmallIcon(R.drawable.notification_icon) + setLargeIcon(notificationBitmap) setContentTitle(manga.title) setProgress(total, current, false) setOngoing(true) @@ -404,7 +416,8 @@ class LibraryUpdateService : Service() { val body = getUpdatedMangasBody(updates, failed) notificationManager.notify(notificationId, notification() { - setSmallIcon(R.drawable.ic_refresh_white_24dp_img) + setSmallIcon(R.drawable.notification_icon) + setLargeIcon(notificationBitmap) setContentTitle(title) setStyle(NotificationCompat.BigTextStyle().bigText(body)) setContentIntent(notificationIntent) diff --git a/app/src/main/res/drawable-hdpi/notification_icon.png b/app/src/main/res/drawable-hdpi/notification_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..38957c4f47316234a47efe553252c460ba271f8c GIT binary patch literal 554 zcmV+_0@eMAP)AafI-_JHj3#pR&x{{sWMM;$b598?9w7l3#_5N`$I^)$rWp!R_5 ztHR|VCOkQi9f&=E*nosw%MZk*Kx_fT9C*|*5o;hL5SsyUKM+3w;(tKAoCF8yLiK>~ zD$JSb_K`5dTGs?@vH1LZlfnIMU1mAZ8<{pqz=rz$7B|Ps5>qI=Lmc z4VDlBft^I?WdhbG_rzKkO?{j8?6 z!nJ_r5_GVJfWAdI928BdgFw;t6pO*HaRoi7%z+jY=-?|53sIw4vH*u~op7kP#-V-# zwc1Iz(nAM{bz(TR93+h+`=3EC_MrtTww(DMh`FfQT)mCOlAk~>4mJ26tjPfCe<4R1kj)9i&#^e>9MLs82@X;R;zl6W!euy6 zJOoGRq?2P|CA2c_f?8Y!6(a?o$Kn`Jh_>NS-vG4_WN#(9gEsviSg>i-K||g_tk07*qoM6N<$g7!z|>Hq)$ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/notification_icon.png b/app/src/main/res/drawable-mdpi/notification_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..dfb2ded06ff31b7b893d18f0c6046f479fd89dea GIT binary patch literal 403 zcmV;E0c`$>P)v{Tr@QkNXgkc zXs$beMa?cW3#>>jIvyiw1{D*6Nb<2 zMUwji#PZ}=07|awfH(qFTqB7qLk)$2&BPcs0f?6Z@oXTTP5>W53!Z~$^0T34O~94z xsRd5c)q>@qv<}4EfOrdqcpKELI}6vj+ zgrEpPjG|Sx(T5dOM1NFFE2rHLOWXw<1HT=2yBBu>2f$B3KzG~)>;vBg0UcI=5pIom9WLw^e)Gb9uv7TGf@7%Wm?*YHv4?jxm z*T6}zJ**R&PQpW=3ryxMC;hE0;zi8n<@PF=0YjjbujUC8!5;=sI3EjHHlW{wU_scd zl=pQe1f;c7c^IXX4w1jYq*))n`V;}(VF)Pa%HU@2 z=ot@wHiI{UpJi|)tOIRGnD`H!rXJ6gWx>yD+T>vgIIk@I4G%u9C_Zk6`O#mcyuGK= zM>m(xF=0GiO^$}$xsdXgIueyi`INdAFGEWo9~Gog7<*0`+Z9Fgs#yu5Pe`9pVcZI> zP!t08DA$Ttg|5MrTHuE;?opI2#A&6Drwfc}Q&z4yN&ycFTqQn%0dNYGt$DtTE0mkf z1#M>r6>yn@{t5=cX|Po}yrh=nt*E=u^m%zk>{I^#{9PgVU*yk3Q1l(zOD7@depF07*qoM6N<$f+cNKEdT%j literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/notification_icon.png b/app/src/main/res/drawable-xxhdpi/notification_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c1a5f1b9252c746608b4d972edd9ad79b2ee7158 GIT binary patch literal 1135 zcmV-#1d#iQP)MkZJ-U|OUJw8oIxrbrWLKKQ99P8TSQG=XM-uZjZw0COWvph=)bQJ^+3QwyX8 z(gH<}KnN%rOaTi`ml2+o_}D)_A^ zP$#%y(jRe&W4{d=I48=jiE~Ys2$X6>o~3Gmv_M)QEsz#S3#0|o0%?H)3zWpC=2}n# z_JQ4?3~UA-u)d$+;n>SK7s}}{=SZjPB#A(75Nop583Yn7tQX_Cw>>xnW5tHL-t5cS zSWp74feTa=TI44Oyy6cXo!Y)g07c*oSLuIwUVj7G7Wpgy9X>^E3s0AFu!!Oc zrzkNXkJqU89H6gtg9?lMZwavI{^Cl#4s7FZT(lj+P!DAfc<%EF`m@Jis0DEx6YNm* zK{ZnE#}0vLLAxUej;?p|Er_8(xQ(B+b9!y;vCgR2kuY{7$^L+~b_zs0)dxX2=w*b54&Smk9dGWG6xqBpnRFJ%L|Z3QEJV z&5z)nLDd>X^^SkPnLK4wjjp(-hwCg+_&ZY<0sgKf~Pdd4u!yH zweb8?9?sKr9M?mt_DEDU_dcy33jEQNA+y3=hgAy?jk8Vo$_A|hf6vTzB|^2EbqIpq zYr7yWpe*T)lN$~jobo0Eyn&LxP2XF%0PF;l zRg<85cJN&w&{kJ}FurxAulrMKZ5ZAs_G5z>XNRx=PU|lMWpHE5ZDNdgzOq)e8mpcn z@eM2stfIw^e;!TG_;AlBf$!z*pip>gx