From b0afa3e2fe931bd6afb996ecad961fb06ac7aa5e Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Wed, 5 Apr 2017 15:41:57 +1000 Subject: [PATCH] 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. --- .../main/java/org/fdroid/fdroid/NotificationHelper.java | 9 ++++----- app/src/main/res/drawable/ic_notification.xml | 7 +++++++ 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 app/src/main/res/drawable/ic_notification.xml diff --git a/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java b/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java index 55e3625d4..298f2e65d 100644 --- a/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java +++ b/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java @@ -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) diff --git a/app/src/main/res/drawable/ic_notification.xml b/app/src/main/res/drawable/ic_notification.xml new file mode 100644 index 000000000..b34e2a5ff --- /dev/null +++ b/app/src/main/res/drawable/ic_notification.xml @@ -0,0 +1,7 @@ + + +