| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.app.PendingIntent; | 8 import android.app.PendingIntent; |
| 9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
| 10 import android.support.v4.app.NotificationCompat.Action; | 10 import android.support.v4.app.NotificationCompat.Action; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 protected CharSequence mTickerText; | 41 protected CharSequence mTickerText; |
| 42 protected Bitmap mLargeIcon; | 42 protected Bitmap mLargeIcon; |
| 43 protected int mSmallIconId; | 43 protected int mSmallIconId; |
| 44 protected PendingIntent mContentIntent; | 44 protected PendingIntent mContentIntent; |
| 45 protected PendingIntent mDeleteIntent; | 45 protected PendingIntent mDeleteIntent; |
| 46 protected List<Action> mActions = new ArrayList<>(MAX_ACTION_BUTTONS); | 46 protected List<Action> mActions = new ArrayList<>(MAX_ACTION_BUTTONS); |
| 47 protected Action mSettingsAction; | 47 protected Action mSettingsAction; |
| 48 protected int mDefaults = Notification.DEFAULT_ALL; | 48 protected int mDefaults = Notification.DEFAULT_ALL; |
| 49 protected long[] mVibratePattern; | 49 protected long[] mVibratePattern; |
| 50 protected long mTimestamp; | 50 protected long mTimestamp; |
| 51 protected boolean mRenotify; |
| 51 | 52 |
| 52 /** | 53 /** |
| 53 * Combines all of the options that have been set and returns a new Notifica
tion object. | 54 * Combines all of the options that have been set and returns a new Notifica
tion object. |
| 54 */ | 55 */ |
| 55 public abstract Notification build(); | 56 public abstract Notification build(); |
| 56 | 57 |
| 57 /** | 58 /** |
| 58 * Sets the title text of the notification. | 59 * Sets the title text of the notification. |
| 59 */ | 60 */ |
| 60 public NotificationBuilderBase setTitle(@Nullable CharSequence title) { | 61 public NotificationBuilderBase setTitle(@Nullable CharSequence title) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 167 } |
| 167 | 168 |
| 168 /** | 169 /** |
| 169 * Sets the timestamp at which the event of the notification took place. | 170 * Sets the timestamp at which the event of the notification took place. |
| 170 */ | 171 */ |
| 171 public NotificationBuilderBase setTimestamp(long timestamp) { | 172 public NotificationBuilderBase setTimestamp(long timestamp) { |
| 172 mTimestamp = timestamp; | 173 mTimestamp = timestamp; |
| 173 return this; | 174 return this; |
| 174 } | 175 } |
| 175 | 176 |
| 177 /** |
| 178 * Sets the behavior for when the notification is replaced. |
| 179 */ |
| 180 public NotificationBuilderBase setRenotify(boolean renotify) { |
| 181 mRenotify = renotify; |
| 182 return this; |
| 183 } |
| 184 |
| 176 @Nullable | 185 @Nullable |
| 177 private static CharSequence limitLength(@Nullable CharSequence input) { | 186 private static CharSequence limitLength(@Nullable CharSequence input) { |
| 178 if (input == null) { | 187 if (input == null) { |
| 179 return input; | 188 return input; |
| 180 } | 189 } |
| 181 if (input.length() > MAX_CHARSEQUENCE_LENGTH) { | 190 if (input.length() > MAX_CHARSEQUENCE_LENGTH) { |
| 182 return input.subSequence(0, MAX_CHARSEQUENCE_LENGTH); | 191 return input.subSequence(0, MAX_CHARSEQUENCE_LENGTH); |
| 183 } | 192 } |
| 184 return input; | 193 return input; |
| 185 } | 194 } |
| 186 } | 195 } |
| OLD | NEW |