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

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

Issue 1569783005: Notification custom layouts: move settings button to the footer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 11 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/NotificationUIManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java
index a775e00861b618a13bd678fdc0f2760a81524837..bf9291b14f5817e774549be33967c42deafcf4f3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java
@@ -467,17 +467,16 @@ private void displayNotification(long persistentNotificationId, String origin, S
persistentNotificationId, origin, profileId,
incognito, tag, actionIndex));
}
- // Site settings button is always the last action button.
- if (actionTitles.length == 0) {
- notificationBuilder.addAction(R.drawable.settings_cog,
- res.getString(R.string.page_info_site_settings_button), pendingSettingsIntent);
- } else {
- // Hide site settings icon and use shorter text when website provided
- // action buttons.
- notificationBuilder.addAction(0 /* actionIcon */,
- res.getString(R.string.notification_site_settings_button),
- pendingSettingsIntent);
- }
+
+ // If the settings button is displayed together with the other buttons it has to be the last
+ // one, so add it after the other actions.
+ // If there are no actions provided by the website, use a longer title string.
+ CharSequence settingsTitle = actionTitles.length == 0
+ ? res.getString(R.string.page_info_site_settings_button)
+ : res.getString(R.string.notification_site_settings_button);
+ // If there are no actions provided by the website, use an icon.
+ int settingsIconId = actionTitles.length == 0 ? R.drawable.settings_cog : 0;
+ notificationBuilder.addSettingsAction(settingsIconId, settingsTitle, pendingSettingsIntent);
notificationBuilder.setDefaults(makeDefaults(vibrationPattern.length, silent));
if (vibrationPattern.length > 0) {

Powered by Google App Engine
This is Rietveld 408576698