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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java

Issue 2699253003: Abstracting over Notification.Builder + NotificationCompat.Builder (Closed)
Patch Set: remove erroneously added methods from rebase Created 3 years, 10 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/sync/SyncNotificationController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java
index 90bbd5a4ac2c73df8e3698528a425c89b333a723..4cff135c3de4887e4e59b99d2f56ecb9233a4f38 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncNotificationController.java
@@ -12,11 +12,12 @@ import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.support.v4.app.NotificationCompat;
import android.util.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.ChromeApplication;
+import org.chromium.chrome.browser.notifications.ChromeNotificationBuilder;
import org.chromium.chrome.browser.notifications.NotificationConstants;
import org.chromium.chrome.browser.notifications.NotificationManagerProxy;
import org.chromium.chrome.browser.notifications.NotificationManagerProxyImpl;
@@ -100,18 +101,25 @@ public class SyncNotificationController implements ProfileSyncService.SyncStateC
// There is no need to provide a group summary notification because the NOTIFICATION_ID_SYNC
// notification id ensures there's only one sync notification at a time.
- NotificationCompat.Builder builder = new NotificationCompat.Builder(mApplicationContext)
- .setAutoCancel(true)
- .setContentIntent(contentIntent)
- .setContentTitle(title)
- .setContentText(text)
- .setSmallIcon(R.drawable.ic_chrome)
- .setTicker(text)
- .setLocalOnly(true)
- .setGroup(NotificationConstants.GROUP_SYNC);
-
- Notification notification =
- new NotificationCompat.BigTextStyle(builder).bigText(text).build();
+ ChromeNotificationBuilder builder =
+ ((ChromeApplication) mApplicationContext)
+ .createChromeNotificationBuilder(true /* preferCompat */,
+ NotificationConstants.CATEGORY_ID_BROWSER,
+ mApplicationContext.getString(
+ R.string.notification_category_browser),
+ NotificationConstants.CATEGORY_GROUP_ID_GENERAL,
+ mApplicationContext.getString(
+ R.string.notification_category_group_general))
+ .setAutoCancel(true)
+ .setContentIntent(contentIntent)
+ .setContentTitle(title)
+ .setContentText(text)
+ .setSmallIcon(R.drawable.ic_chrome)
+ .setTicker(text)
+ .setLocalOnly(true)
+ .setGroup(NotificationConstants.GROUP_SYNC);
+
+ Notification notification = builder.buildWithBigTextStyle(text);
mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_SYNC, notification);
}

Powered by Google App Engine
This is Rietveld 408576698