Messaging: Show quick reply choices only on wearable devices
Change-Id: I4b81643c051a9b1377f2046c1aa0515c590736fc
diff --git a/src/com/android/messaging/datamodel/BugleNotifications.java b/src/com/android/messaging/datamodel/BugleNotifications.java
index 47f43b6..5e3f154 100644
--- a/src/com/android/messaging/datamodel/BugleNotifications.java
+++ b/src/com/android/messaging/datamodel/BugleNotifications.java
@@ -780,7 +780,7 @@
maybeAddWearableConversationLog(wearableExtender,
(MultiMessageNotificationState) notificationState);
addDownloadMmsAction(notifBuilder, wearableExtender, notificationState);
- addWearableVoiceReplyAction(wearableExtender, notificationState);
+ addWearableVoiceReplyAction(notifBuilder, wearableExtender, notificationState);
}
// Apply the wearable options and build & post the notification
@@ -822,7 +822,7 @@
}
}
- private static void addWearableVoiceReplyAction(
+ private static void addWearableVoiceReplyAction(final NotificationCompat.Builder notifBuilder,
final WearableExtender wearableExtender, final NotificationState notificationState) {
if (!(notificationState instanceof MultiMessageNotificationState)) {
return;
@@ -852,14 +852,20 @@
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,