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

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

Issue 1639163003: Extract NotificationBuilderBase for holding the arguments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address peter's comments. Created 4 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.notifications;
6
7 import android.app.Notification;
8 import android.app.PendingIntent;
9 import android.graphics.Bitmap;
10
11 import javax.annotation.Nullable;
12
13 /**
14 * Builds a notification using the given inputs.
15 */
16 public interface NotificationBuilder {
17
18 /**
19 * Combines all of the options that have been set and returns a new Notifica tion object.
20 */
21 Notification build();
22
23 /**
24 * Sets the title text (first row) of the notification.
25 */
26 NotificationBuilder setTitle(@Nullable CharSequence title);
27
28 /**
29 * Sets the body text (second row) of the notification.
30 */
31 NotificationBuilder setBody(@Nullable CharSequence body);
32
33 /**
34 * Sets the origin text (bottom row) of the notification.
35 */
36 NotificationBuilder setOrigin(@Nullable CharSequence origin);
37
38 /**
39 * Sets the text that is displayed in the status bar when the notification f irst arrives.
40 */
41 NotificationBuilder setTicker(@Nullable CharSequence tickerText);
42
43 /**
44 * Sets the large icon that is shown in the notification.
45 */
46 NotificationBuilder setLargeIcon(@Nullable Bitmap icon);
47
48 /**
49 * Sets the the small icon that is shown in the notification and in the stat us bar.
50 */
51 NotificationBuilder setSmallIcon(int iconId);
52
53 /**
54 * Sets the PendingIntent to send when the notification is clicked.
55 */
56 NotificationBuilder setContentIntent(@Nullable PendingIntent intent);
57
58 /**
59 * Sets the PendingIntent to send when the notification is cleared by the us er directly from the
60 * notification panel.
61 */
62 NotificationBuilder setDeleteIntent(@Nullable PendingIntent intent);
63
64 /**
65 * Adds an action to the notification. Actions are typically displayed as a button adjacent to
66 * the notification content.
67 */
68 NotificationBuilder addAction(
69 int iconId, @Nullable CharSequence title, @Nullable PendingIntent in tent);
70
71 /**
72 * Adds an action to the notification for opening the settings screen.
73 */
74 NotificationBuilder addSettingsAction(int iconId, CharSequence title, Pendin gIntent intent);
75
76 /**
77 * Sets the default notification options that will be used.
78 * <p>
79 * The value should be one or more of the following fields combined with
80 * bitwise-or:
81 * {@link Notification#DEFAULT_SOUND}, {@link Notification#DEFAULT_VIBRATE},
82 * {@link Notification#DEFAULT_LIGHTS}.
83 * <p>
84 * For all default values, use {@link Notification#DEFAULT_ALL}.
85 */
86 NotificationBuilder setDefaults(int defaults);
87
88 /**
89 * Sets the vibration pattern to use.
90 */
91 NotificationBuilder setVibrate(@Nullable long[] pattern);
92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698