Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1872)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java

Issue 2337963003: Plumb through notification action types and placeholders on Android (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
index 21f25a8566e2eb443b20a747e47fd65c9c418c88..5062a298996f15ae2ab32d812abc44c148d408fa 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.notifications;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
+import android.app.RemoteInput;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -489,7 +490,8 @@ public class NotificationPlatformBridge {
private void displayNotification(String notificationId, String origin, String profileId,
boolean incognito, String tag, String webApkPackage, String title, String body,
Bitmap image, Bitmap icon, Bitmap badge, int[] vibrationPattern, long timestamp,
- boolean renotify, boolean silent, String[] actionTitles, Bitmap[] actionIcons) {
+ boolean renotify, boolean silent, String[] actionTitles, Bitmap[] actionIcons,
+ String[] actionTypes, String[] actionPlaceholders) {
if (actionTitles.length != actionIcons.length) {
throw new IllegalArgumentException("The number of action titles and icons must match.");
}
@@ -536,10 +538,22 @@ public class NotificationPlatformBridge {
origin, false /* showScheme */));
for (int actionIndex = 0; actionIndex < actionTitles.length; actionIndex++) {
+ RemoteInput remoteInput = null;
+ Log.d(TAG, "Notification action with type = " + actionTypes[actionIndex] + " and "
+ + "placeholder = " + actionPlaceholders[actionIndex]);
+ if (actionTypes[actionIndex].equals("text")
+ && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
+ String placeholder = actionPlaceholders[actionIndex];
+ remoteInput =
+ new RemoteInput.Builder("key_text_reply")
+ .setLabel(placeholder != null ? placeholder : "Placeholder text")
+ .build();
+ }
notificationBuilder.addAction(actionIcons[actionIndex], actionTitles[actionIndex],
makePendingIntent(NotificationConstants.ACTION_CLICK_NOTIFICATION,
notificationId, origin, profileId, incognito, tag,
- webApkPackage, actionIndex));
+ webApkPackage, actionIndex),
+ remoteInput);
}
// If action buttons are displayed, there isn't room for the full Site Settings button

Powered by Google App Engine
This is Rietveld 408576698