diff options
| author | Han Wang <416810799@qq.com> | 2020-03-17 04:43:11 +0200 |
|---|---|---|
| committer | Michael Bestas <mkbestas@lineageos.org> | 2022-08-28 03:47:12 +0300 |
| commit | 818b0fb107ee6829234cb60f768d1d1339ace6d5 (patch) | |
| tree | 7e55a3d9a7372274ac4e2f7da335fccb1ad0fb17 /src/com/android/messaging/datamodel | |
| parent | 94d9a1231da7c581051c0465586a88524fdf3f02 (diff) | |
Change-Id: I4b81643c051a9b1377f2046c1aa0515c590736fc
Diffstat (limited to 'src/com/android/messaging/datamodel')
| -rw-r--r-- | src/com/android/messaging/datamodel/BugleNotifications.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/com/android/messaging/datamodel/BugleNotifications.java b/src/com/android/messaging/datamodel/BugleNotifications.java index b82dbe5..6df9e88 100644 --- a/src/com/android/messaging/datamodel/BugleNotifications.java +++ b/src/com/android/messaging/datamodel/BugleNotifications.java @@ -788,7 +788,7 @@ public class BugleNotifications { maybeAddWearableConversationLog(wearableExtender, (MultiMessageNotificationState) notificationState); addDownloadMmsAction(notifBuilder, wearableExtender, notificationState); - addWearableVoiceReplyAction(wearableExtender, notificationState); + addWearableVoiceReplyAction(notifBuilder, wearableExtender, notificationState); } // Apply the wearable options and build & post the notification @@ -830,7 +830,7 @@ public class BugleNotifications { } } - private static void addWearableVoiceReplyAction( + private static void addWearableVoiceReplyAction(final NotificationCompat.Builder notifBuilder, final WearableExtender wearableExtender, final NotificationState notificationState) { if (!(notificationState instanceof MultiMessageNotificationState)) { return; @@ -860,14 +860,20 @@ public class BugleNotifications { final NotificationCompat.Action.Builder actionBuilder = new NotificationCompat.Action.Builder(R.drawable.ic_wear_reply, context.getString(replyLabelRes), replyPendingIntent); + final RemoteInput.Builder remoteInputBuilder = new RemoteInput.Builder(Intent.EXTRA_TEXT); + remoteInputBuilder.setLabel(context.getString(R.string.notification_reply_prompt)); + actionBuilder.addRemoteInput(remoteInputBuilder.build()); + notifBuilder.addAction(actionBuilder.build()); + + // Support the action on a wearable device + final NotificationCompat.Action.Builder wearActionBuilder = + new NotificationCompat.Action.Builder(R.drawable.ic_wear_reply, + context.getString(replyLabelRes), replyPendingIntent); final String[] choices = context.getResources().getStringArray( R.array.notification_reply_choices); - final RemoteInput remoteInput = new RemoteInput.Builder(Intent.EXTRA_TEXT).setLabel( - context.getString(R.string.notification_reply_prompt)). - setChoices(choices) - .build(); - actionBuilder.addRemoteInput(remoteInput); - wearableExtender.addAction(actionBuilder.build()); + remoteInputBuilder.setChoices(choices); + wearActionBuilder.addRemoteInput(remoteInputBuilder.build()); + wearableExtender.addAction(wearActionBuilder.build()); } private static void addDownloadMmsAction(final NotificationCompat.Builder notifBuilder, |
