OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.notifications; | 5 package org.chromium.chrome.browser.notifications; |
6 | 6 |
7 import android.app.Notification; | 7 import android.app.Notification; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.res.Resources; | 9 import android.content.res.Resources; |
10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 NotificationCompat.Builder builder = new NotificationCompat.Builder(mCon
text); | 119 NotificationCompat.Builder builder = new NotificationCompat.Builder(mCon
text); |
120 builder.setTicker(mTickerText); | 120 builder.setTicker(mTickerText); |
121 builder.setSmallIcon(mSmallIconId); | 121 builder.setSmallIcon(mSmallIconId); |
122 builder.setContentIntent(mContentIntent); | 122 builder.setContentIntent(mContentIntent); |
123 builder.setDeleteIntent(mDeleteIntent); | 123 builder.setDeleteIntent(mDeleteIntent); |
124 builder.setDefaults(mDefaults); | 124 builder.setDefaults(mDefaults); |
125 builder.setVibrate(mVibratePattern); | 125 builder.setVibrate(mVibratePattern); |
126 builder.setWhen(mTimestamp); | 126 builder.setWhen(mTimestamp); |
| 127 builder.setOnlyAlertOnce(!mRenotify); |
127 builder.setContent(compactView); | 128 builder.setContent(compactView); |
128 | 129 |
129 // Some things are duplicated in the builder to ensure the notification
shows correctly on | 130 // Some things are duplicated in the builder to ensure the notification
shows correctly on |
130 // Wear devices and custom lock screens. | 131 // Wear devices and custom lock screens. |
131 builder.setContentTitle(mTitle); | 132 builder.setContentTitle(mTitle); |
132 builder.setContentText(mBody); | 133 builder.setContentText(mBody); |
133 builder.setSubText(mOrigin); | 134 builder.setSubText(mOrigin); |
134 builder.setLargeIcon(mLargeIcon); | 135 builder.setLargeIcon(mLargeIcon); |
135 for (Action action : mActions) { | 136 for (Action action : mActions) { |
136 builder.addAction(action); | 137 builder.addAction(action); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, di
splayMetrics)); | 272 TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, di
splayMetrics)); |
272 } | 273 } |
273 | 274 |
274 /** | 275 /** |
275 * Whether to use the Material look and feel or fall back to Holo. | 276 * Whether to use the Material look and feel or fall back to Holo. |
276 */ | 277 */ |
277 private static boolean useMaterial() { | 278 private static boolean useMaterial() { |
278 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; | 279 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; |
279 } | 280 } |
280 } | 281 } |
OLD | NEW |