Skip to content

Commit

Permalink
Add icons for notification action buttons (#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
dshokouhi committed Oct 20, 2021
1 parent a61a508 commit 2b84936
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,12 @@ class MessagingService : FirebaseMessagingService() {
0
)

builder.addAction(0, notificationAction.title, actionPendingIntent)
val icon =
if (notificationAction.key == "URI")
R.drawable.ic_globe
else
R.drawable.ic_stat_ic_notification
builder.addAction(icon, notificationAction.title, actionPendingIntent)
} else {
val remoteInput: RemoteInput = RemoteInput.Builder(KEY_TEXT_REPLY).run {
setLabel(getString(R.string.action_reply))
Expand All @@ -1043,7 +1048,7 @@ class MessagingService : FirebaseMessagingService() {
actionIntent,
PendingIntent.FLAG_UPDATE_CURRENT
)
val action: NotificationCompat.Action = NotificationCompat.Action.Builder(0, notificationAction.title, replyPendingIntent)
val action: NotificationCompat.Action = NotificationCompat.Action.Builder(R.drawable.ic_baseline_reply_24, notificationAction.title, replyPendingIntent)
.addRemoteInput(remoteInput)
.build()
builder.addAction(action)
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_baseline_reply_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z"/>
</vector>

0 comments on commit 2b84936

Please sign in to comment.