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/media/ui/MediaNotificationInfo.java

Issue 1847063005: [Media, UI] Change MediaNotification style to MediaStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests and rebase Created 4 years, 8 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 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.media.ui; 5 package org.chromium.chrome.browser.media.ui;
6 6
7 import android.content.Intent; 7 import android.content.Intent;
8 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 import android.text.TextUtils; 9 import android.text.TextUtils;
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 * Use this class to construct an instance of {@link MediaNotificationInfo}. 42 * Use this class to construct an instance of {@link MediaNotificationInfo}.
43 */ 43 */
44 public static final class Builder { 44 public static final class Builder {
45 45
46 private MediaMetadata mMetadata; 46 private MediaMetadata mMetadata;
47 private boolean mIsPaused = false; 47 private boolean mIsPaused = false;
48 private String mOrigin = ""; 48 private String mOrigin = "";
49 private int mTabId = Tab.INVALID_TAB_ID; 49 private int mTabId = Tab.INVALID_TAB_ID;
50 private boolean mIsPrivate = true; 50 private boolean mIsPrivate = true;
51 private int mIcon = -1; 51 private int mIcon = -1;
52 private Bitmap mLargeIcon = null;
52 private int mActions = ACTION_PLAY_PAUSE | ACTION_SWIPEAWAY; 53 private int mActions = ACTION_PLAY_PAUSE | ACTION_SWIPEAWAY;
53 private int mId = INVALID_ID; 54 private int mId = INVALID_ID;
54 private Intent mContentIntent = null; 55 private Intent mContentIntent = null;
55 private Bitmap mImage = null; 56 private Bitmap mImage = null;
56 private MediaNotificationListener mListener = null; 57 private MediaNotificationListener mListener = null;
57 58
58 /** 59 /**
59 * Initializes the builder with the default values. 60 * Initializes the builder with the default values.
60 */ 61 */
61 public Builder() { 62 public Builder() {
62 } 63 }
63 64
64 public MediaNotificationInfo build() { 65 public MediaNotificationInfo build() {
65 assert mMetadata != null; 66 assert mMetadata != null;
66 assert mOrigin != null; 67 assert mOrigin != null;
67 assert mListener != null; 68 assert mListener != null;
68 69
69 return new MediaNotificationInfo( 70 return new MediaNotificationInfo(
70 mMetadata, 71 mMetadata,
71 mIsPaused, 72 mIsPaused,
72 mOrigin, 73 mOrigin,
73 mTabId, 74 mTabId,
74 mIsPrivate, 75 mIsPrivate,
75 mIcon, 76 mIcon,
77 mLargeIcon,
76 mActions, 78 mActions,
77 mId, 79 mId,
78 mImage, 80 mImage,
79 mContentIntent, 81 mContentIntent,
80 mListener); 82 mListener);
81 } 83 }
82 84
83 public Builder setMetadata(MediaMetadata metadata) { 85 public Builder setMetadata(MediaMetadata metadata) {
84 mMetadata = metadata; 86 mMetadata = metadata;
85 return this; 87 return this;
(...skipping 17 matching lines...) Expand all
103 public Builder setPrivate(boolean isPrivate) { 105 public Builder setPrivate(boolean isPrivate) {
104 mIsPrivate = isPrivate; 106 mIsPrivate = isPrivate;
105 return this; 107 return this;
106 } 108 }
107 109
108 public Builder setIcon(int icon) { 110 public Builder setIcon(int icon) {
109 mIcon = icon; 111 mIcon = icon;
110 return this; 112 return this;
111 } 113 }
112 114
115 public Builder setLargeIcon(Bitmap icon) {
116 mLargeIcon = icon;
117 return this;
118 }
119
113 public Builder setActions(int actions) { 120 public Builder setActions(int actions) {
114 mActions = actions; 121 mActions = actions;
115 return this; 122 return this;
116 } 123 }
117 124
118 public Builder setId(int id) { 125 public Builder setId(int id) {
119 mId = id; 126 mId = id;
120 return this; 127 return this;
121 } 128 }
122 129
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 * Whether the media notification should be considered as private. 172 * Whether the media notification should be considered as private.
166 */ 173 */
167 public final boolean isPrivate; 174 public final boolean isPrivate;
168 175
169 /** 176 /**
170 * The id of the notification icon from R.drawable. 177 * The id of the notification icon from R.drawable.
171 */ 178 */
172 public final int icon; 179 public final int icon;
173 180
174 /** 181 /**
182 * The Bitmap resource used for a large icon.
183 */
184 public final Bitmap largeIcon;
185
186 /**
175 * The id to use for the notification itself. 187 * The id to use for the notification itself.
176 */ 188 */
177 public final int id; 189 public final int id;
178 190
179 /** 191 /**
180 * The bitmap of the image, if any. 192 * The bitmap of the image, if any.
181 */ 193 */
182 public final Bitmap image; 194 public final Bitmap image;
183 195
184 /** 196 /**
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 * @param contentIntent the intent to send when the notification is selected . 235 * @param contentIntent the intent to send when the notification is selected .
224 * @param listener The listener for the control events. 236 * @param listener The listener for the control events.
225 */ 237 */
226 private MediaNotificationInfo( 238 private MediaNotificationInfo(
227 MediaMetadata metadata, 239 MediaMetadata metadata,
228 boolean isPaused, 240 boolean isPaused,
229 String origin, 241 String origin,
230 int tabId, 242 int tabId,
231 boolean isPrivate, 243 boolean isPrivate,
232 int icon, 244 int icon,
245 Bitmap largeIcon,
233 int actions, 246 int actions,
234 int id, 247 int id,
235 Bitmap image, 248 Bitmap image,
236 Intent contentIntent, 249 Intent contentIntent,
237 MediaNotificationListener listener) { 250 MediaNotificationListener listener) {
238 this.metadata = metadata; 251 this.metadata = metadata;
239 this.isPaused = isPaused; 252 this.isPaused = isPaused;
240 this.origin = origin; 253 this.origin = origin;
241 this.tabId = tabId; 254 this.tabId = tabId;
242 this.isPrivate = isPrivate; 255 this.isPrivate = isPrivate;
243 this.icon = icon; 256 this.icon = icon;
257 this.largeIcon = largeIcon;
244 this.mActions = actions; 258 this.mActions = actions;
245 this.id = id; 259 this.id = id;
246 this.contentIntent = contentIntent; 260 this.contentIntent = contentIntent;
247 this.image = image; 261 this.image = image;
248 this.listener = listener; 262 this.listener = listener;
249 } 263 }
250 264
251 @Override 265 @Override
252 public boolean equals(Object obj) { 266 public boolean equals(Object obj) {
253 if (obj == this) return true; 267 if (obj == this) return true;
254 if (!(obj instanceof MediaNotificationInfo)) return false; 268 if (!(obj instanceof MediaNotificationInfo)) return false;
255 269
256 MediaNotificationInfo other = (MediaNotificationInfo) obj; 270 MediaNotificationInfo other = (MediaNotificationInfo) obj;
257 return isPaused == other.isPaused 271 return isPaused == other.isPaused
258 && isPrivate == other.isPrivate 272 && isPrivate == other.isPrivate
259 && tabId == other.tabId 273 && tabId == other.tabId
260 && icon == other.icon 274 && icon == other.icon
275 && largeIcon == other.largeIcon
261 && mActions == other.mActions 276 && mActions == other.mActions
262 && id == other.id 277 && id == other.id
263 && metadata.equals(other.metadata) 278 && metadata.equals(other.metadata)
264 && TextUtils.equals(origin, other.origin) 279 && TextUtils.equals(origin, other.origin)
265 && (image == other.image || (image != null && image.sameAs(other .image))) 280 && (image == other.image || (image != null && image.sameAs(other .image)))
266 && contentIntent.equals(other.contentIntent) 281 && contentIntent.equals(other.contentIntent)
267 && listener.equals(other.listener); 282 && listener.equals(other.listener);
268 } 283 }
269 284
270 @Override 285 @Override
271 public int hashCode() { 286 public int hashCode() {
272 int result = isPaused ? 1 : 0; 287 int result = isPaused ? 1 : 0;
273 result = 31 * result + (isPrivate ? 1 : 0); 288 result = 31 * result + (isPrivate ? 1 : 0);
274 result = 31 * result + (metadata == null ? 0 : metadata.hashCode()); 289 result = 31 * result + (metadata == null ? 0 : metadata.hashCode());
275 result = 31 * result + (origin == null ? 0 : origin.hashCode()); 290 result = 31 * result + (origin == null ? 0 : origin.hashCode());
276 result = 31 * result + (image == null ? 0 : image.hashCode()); 291 result = 31 * result + (image == null ? 0 : image.hashCode());
277 result = 31 * result + (contentIntent == null ? 0 : contentIntent.hashCo de()); 292 result = 31 * result + (contentIntent == null ? 0 : contentIntent.hashCo de());
278 result = 31 * result + tabId; 293 result = 31 * result + tabId;
279 result = 31 * result + icon; 294 result = 31 * result + icon;
295 result = 31 * result + (largeIcon == null ? 0 : largeIcon.hashCode());
280 result = 31 * result + mActions; 296 result = 31 * result + mActions;
281 result = 31 * result + id; 297 result = 31 * result + id;
282 result = 31 * result + listener.hashCode(); 298 result = 31 * result + listener.hashCode();
283 return result; 299 return result;
284 } 300 }
285 } 301 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698