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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilderBase.java

Issue 1388483002: Implement the Notification `timestamp` property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
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 29 matching lines...) Expand all
40 protected CharSequence mOrigin; 40 protected CharSequence mOrigin;
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 51
51 /** 52 /**
52 * Combines all of the options that have been set and returns a new Notifica tion object. 53 * Combines all of the options that have been set and returns a new Notifica tion object.
53 */ 54 */
54 public abstract Notification build(); 55 public abstract Notification build();
55 56
56 /** 57 /**
57 * Sets the title text of the notification. 58 * Sets the title text of the notification.
58 */ 59 */
59 public NotificationBuilderBase setTitle(@Nullable CharSequence title) { 60 public NotificationBuilderBase setTitle(@Nullable CharSequence title) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 158 }
158 159
159 /** 160 /**
160 * Sets the vibration pattern to use. 161 * Sets the vibration pattern to use.
161 */ 162 */
162 public NotificationBuilderBase setVibrate(long[] pattern) { 163 public NotificationBuilderBase setVibrate(long[] pattern) {
163 mVibratePattern = Arrays.copyOf(pattern, pattern.length); 164 mVibratePattern = Arrays.copyOf(pattern, pattern.length);
164 return this; 165 return this;
165 } 166 }
166 167
168 /**
169 * Sets the timestamp at which the event of the notification took place.
170 */
171 public NotificationBuilderBase setTimestamp(long timestamp) {
172 mTimestamp = timestamp;
173 return this;
174 }
175
167 @Nullable 176 @Nullable
168 private static CharSequence limitLength(@Nullable CharSequence input) { 177 private static CharSequence limitLength(@Nullable CharSequence input) {
169 if (input == null) { 178 if (input == null) {
170 return input; 179 return input;
171 } 180 }
172 if (input.length() > MAX_CHARSEQUENCE_LENGTH) { 181 if (input.length() > MAX_CHARSEQUENCE_LENGTH) {
173 return input.subSequence(0, MAX_CHARSEQUENCE_LENGTH); 182 return input.subSequence(0, MAX_CHARSEQUENCE_LENGTH);
174 } 183 }
175 return input; 184 return input;
176 } 185 }
177 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698