From 9ec068e95ed0328820e937cfc8e197a163a70d64 Mon Sep 17 00:00:00 2001 From: Florian Obernberger Date: Wed, 21 Dec 2022 14:59:15 +0100 Subject: [PATCH 1/3] Add filled variant of the person_add icon --- .../res/drawable/ic_fluent_person_add_24_filled.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 mastodon/src/main/res/drawable/ic_fluent_person_add_24_filled.xml diff --git a/mastodon/src/main/res/drawable/ic_fluent_person_add_24_filled.xml b/mastodon/src/main/res/drawable/ic_fluent_person_add_24_filled.xml new file mode 100644 index 0000000000..43f5c8f766 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_person_add_24_filled.xml @@ -0,0 +1,12 @@ + + + + From f4af8ca7cc816ad9d506ce9b56390900e04fbd0c Mon Sep 17 00:00:00 2001 From: Florian Obernberger Date: Wed, 21 Dec 2022 15:01:40 +0100 Subject: [PATCH 2/3] Add mention icon --- .../main/res/drawable/ic_fluent_mention_24_filled.xml | 9 +++++++++ .../main/res/drawable/ic_fluent_mention_24_regular.xml | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 mastodon/src/main/res/drawable/ic_fluent_mention_24_filled.xml create mode 100644 mastodon/src/main/res/drawable/ic_fluent_mention_24_regular.xml diff --git a/mastodon/src/main/res/drawable/ic_fluent_mention_24_filled.xml b/mastodon/src/main/res/drawable/ic_fluent_mention_24_filled.xml new file mode 100644 index 0000000000..ab2feaa9ee --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_mention_24_filled.xml @@ -0,0 +1,9 @@ + + + diff --git a/mastodon/src/main/res/drawable/ic_fluent_mention_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_mention_24_regular.xml new file mode 100644 index 0000000000..6ccfa1265b --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_mention_24_regular.xml @@ -0,0 +1,9 @@ + + + From 3b45830d7d5f48a4e3a9c048eaf2d9317a543271 Mon Sep 17 00:00:00 2001 From: Florian Obernberger Date: Wed, 21 Dec 2022 16:09:59 +0100 Subject: [PATCH 3/3] Add custom icons for different notification types --- .../joinmastodon/android/PushNotificationReceiver.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java index 16c4549527..664cc5c8f9 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java +++ b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java @@ -137,13 +137,20 @@ private void notify(Context context, PushNotification pn, String accountID, org. builder.setContentTitle(pn.title) .setContentText(pn.body) .setStyle(new Notification.BigTextStyle().bigText(pn.body)) - .setSmallIcon(R.drawable.ic_ntf_logo) .setContentIntent(PendingIntent.getActivity(context, accountID.hashCode() & 0xFFFF, contentIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT)) .setWhen(notification==null ? System.currentTimeMillis() : notification.createdAt.toEpochMilli()) .setShowWhen(true) .setCategory(Notification.CATEGORY_SOCIAL) .setAutoCancel(true) .setColor(context.getColor(R.color.primary_700)); + switch (pn.notificationType) { + case FAVORITE -> builder.setSmallIcon(R.drawable.ic_fluent_star_24_filled); + case REBLOG -> builder.setSmallIcon(R.drawable.ic_fluent_arrow_repeat_all_24_filled); + case FOLLOW -> builder.setSmallIcon(R.drawable.ic_fluent_person_add_24_filled); + case MENTION -> builder.setSmallIcon(R.drawable.ic_fluent_mention_24_filled); + case POLL -> builder.setSmallIcon(R.drawable.ic_fluent_poll_24_filled); + default -> builder.setSmallIcon(R.drawable.ic_ntf_logo); + } if(avatar!=null){ builder.setLargeIcon(UiUtils.getBitmapFromDrawable(avatar)); }