Chromium Code Reviews| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 | 139 |
| 140 // Note: under the hood this is not a NotificationCompat builder so be m indful of the | 140 // Note: under the hood this is not a NotificationCompat builder so be m indful of the |
| 141 // API level of methods you call on the builder. | 141 // API level of methods you call on the builder. |
| 142 // TODO(crbug.com/697104) We should probably use a Compat builder. | 142 // TODO(crbug.com/697104) We should probably use a Compat builder. |
| 143 ChromeNotificationBuilder builder = | 143 ChromeNotificationBuilder builder = |
| 144 NotificationBuilderFactory.createChromeNotificationBuilder( | 144 NotificationBuilderFactory.createChromeNotificationBuilder( |
| 145 false /* preferCompat */, ChannelDefinitions.CHANNEL_ID_ SITES); | 145 false /* preferCompat */, ChannelDefinitions.CHANNEL_ID_ SITES); |
| 146 builder.setTicker(mTickerText); | 146 builder.setTicker(mTickerText); |
| 147 builder.setContentIntent(mContentIntent); | 147 builder.setContentIntent(mContentIntent); |
| 148 builder.setDeleteIntent(mDeleteIntent); | 148 builder.setDeleteIntent(mDeleteIntent); |
| 149 builder.setDefaults(mDefaults); | 149 builder.setVisibility(mVisibility); |
| 150 builder.setVibrate(mVibratePattern); | 150 if (mVisibility != Notification.VISIBILITY_SECRET) { |
|
awdf
2017/05/24 14:47:42
maybe change this to check a new channel id field
| |
| 151 builder.setDefaults(mDefaults); | |
| 152 builder.setVibrate(mVibratePattern); | |
| 153 } | |
| 151 builder.setWhen(mTimestamp); | 154 builder.setWhen(mTimestamp); |
| 152 builder.setOnlyAlertOnce(!mRenotify); | 155 builder.setOnlyAlertOnce(!mRenotify); |
| 153 builder.setContent(compactView); | 156 builder.setContent(compactView); |
| 154 | 157 |
| 155 // Some things are duplicated in the builder to ensure the notification shows correctly on | 158 // Some things are duplicated in the builder to ensure the notification shows correctly on |
| 156 // Wear devices and custom lock screens. | 159 // Wear devices and custom lock screens. |
| 157 builder.setContentTitle(mTitle); | 160 builder.setContentTitle(mTitle); |
| 158 builder.setContentText(mBody); | 161 builder.setContentText(mBody); |
| 159 builder.setSubText(mOrigin); | 162 builder.setSubText(mOrigin); |
| 160 builder.setLargeIcon(getNormalizedLargeIcon()); | 163 builder.setLargeIcon(getNormalizedLargeIcon()); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 } | 326 } |
| 324 | 327 |
| 325 /** | 328 /** |
| 326 * Whether to use the Material look and feel or fall back to Holo. | 329 * Whether to use the Material look and feel or fall back to Holo. |
| 327 */ | 330 */ |
| 328 @VisibleForTesting | 331 @VisibleForTesting |
| 329 static boolean useMaterial() { | 332 static boolean useMaterial() { |
| 330 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; | 333 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; |
| 331 } | 334 } |
| 332 } | 335 } |
| OLD | NEW |