Using custom icon for notification rather than the launcher icon.

On newer devices, it takes the icon, removes colour, and uses that. This
looks weird because:

 * The head and body look too close together once you remove the shading
   from the launcher icon.

 * The eyes dissapear because they are white (not transparent) in the
   launcher icon.
This commit is contained in:
Peter Serwylo 2017-04-05 15:41:57 +10:00
parent 2ab5c6a1c6
commit b0afa3e2fe
2 changed files with 11 additions and 5 deletions

View File

@ -330,14 +330,13 @@ class NotificationHelper {
App app = entry.app;
AppUpdateStatusManager.Status status = entry.status;
int iconSmall = R.drawable.ic_launcher;
Bitmap iconLarge = getLargeIconForEntry(entry);
NotificationCompat.Builder builder =
new NotificationCompat.Builder(context)
.setAutoCancel(true)
.setContentTitle(getSingleItemTitleString(app, status))
.setContentText(getSingleItemContentString(app, status))
.setSmallIcon(iconSmall)
.setSmallIcon(R.drawable.ic_notification)
.setColor(ContextCompat.getColor(context, R.color.fdroid_blue))
.setLargeIcon(iconLarge)
.setLocalOnly(true)
@ -416,7 +415,7 @@ class NotificationHelper {
NotificationCompat.Builder builder =
new NotificationCompat.Builder(context)
.setAutoCancel(!useStackedNotifications())
.setSmallIcon(R.drawable.ic_launcher)
.setSmallIcon(R.drawable.ic_notification)
.setColor(ContextCompat.getColor(context, R.color.fdroid_blue))
.setContentTitle(title)
.setContentText(text)
@ -444,7 +443,7 @@ class NotificationHelper {
new NotificationCompat.Builder(context)
.setAutoCancel(true)
.setLargeIcon(iconLarge)
.setSmallIcon(R.drawable.ic_launcher)
.setSmallIcon(R.drawable.ic_notification)
.setColor(ContextCompat.getColor(context, R.color.fdroid_blue))
.setContentTitle(app.name)
.setContentText(context.getString(R.string.notification_content_single_installed))
@ -491,7 +490,7 @@ class NotificationHelper {
NotificationCompat.Builder builder =
new NotificationCompat.Builder(context)
.setAutoCancel(!useStackedNotifications())
.setSmallIcon(R.drawable.ic_launcher)
.setSmallIcon(R.drawable.ic_notification)
.setColor(ContextCompat.getColor(context, R.color.fdroid_blue))
.setContentTitle(title)
.setContentText(text)

View File

@ -0,0 +1,7 @@
<vector android:height="24dp" android:viewportHeight="48.0"
android:viewportWidth="48.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="1" android:fillColor="#ffffff"
android:pathData="m2.61,1.25c-0.45,0.01 -0.76,0.19 -0.98,0.45 0,0 0,0 0.01,0.01 -0,0 -0.01,0.01 -0.01,0.01 -0,-0 -0,-0 -0,-0.01 -0,0 -0.01,0.02 -0.02,0.03 -0.01,0.01 -0.01,0.02 -0.02,0.03 -0.15,0.2 -0.49,0.8 0.01,1.5L5.21,7.93C5.08,8.26 5,8.62 5,9v3,1 2.46L5,16c0,1.66 1.34,3 3,3h32c1.66,0 3,-1.34 3,-3L43,15.46 43,9.54 43,9C43,8.62 42.92,8.26 42.79,7.93l3.61,-4.66c0.5,-0.7 0.16,-1.3 0.01,-1.5 -0.01,-0.01 -0.01,-0.02 -0.02,-0.03 -0,-0.01 -0.01,-0.02 -0.02,-0.03 -0,0 -0,0 -0,0.01 -0,-0 -0.01,-0.01 -0.01,-0.01 0,-0 0,-0 0.01,-0.01 -0.22,-0.26 -0.53,-0.44 -0.98,-0.45 -0.38,0.01 -0.74,0.18 -0.97,0.49L40.99,6.18C40.86,6.13 40.74,6.09 40.61,6.06 40.41,6.02 40.21,6 40,6L8,6C7.65,6 7.32,6.07 7.01,6.18L3.58,1.74C3.35,1.43 2.99,1.26 2.61,1.25ZM14.38,9.75c1.86,0 3.38,1.51 3.38,3.38 0,1.86 -1.51,3.38 -3.38,3.38C12.51,16.5 11,14.99 11,13.13 11,11.26 12.51,9.75 14.38,9.75ZM33.88,9.75c1.86,0 3.38,1.51 3.38,3.38 0,1.86 -1.51,3.38 -3.38,3.38 -1.86,0 -3.38,-1.51 -3.38,-3.38 0,-1.86 1.51,-3.38 3.38,-3.38zM8,20.97c-1.66,0 -3,1.34 -3,3L5,30 5,36 5,42.23 5,43c0,1.66 1.34,3 3,3h32c1.66,0 3,-1.34 3,-3L43,42.23 43,24.73 43,23.97c0,-1.66 -1.34,-3 -3,-3z"
android:strokeAlpha="1" android:strokeColor="#00000000"
android:strokeLineCap="round" android:strokeLineJoin="miter" android:strokeWidth="2.5"/>
</vector>