OLD | NEW |
---|---|
(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.media.ui; | |
6 | |
7 import android.text.TextUtils; | |
8 | |
9 /** | |
10 * Exposes information about the current media to the external clients. | |
11 */ | |
12 public class MediaInfo { | |
13 /** | |
14 * The title of the media. | |
15 */ | |
16 public String title; | |
17 | |
18 /** | |
19 * The current state of the media, paused or not. | |
20 */ | |
21 public boolean isPaused; | |
22 | |
23 /** | |
24 * The origin of the tab containing the media. | |
25 */ | |
26 public String origin; | |
27 | |
28 /** | |
29 * The id of the tab containing the media. | |
30 */ | |
31 public int tabId; | |
32 | |
33 /** | |
34 * Create a new MediaInfo. | |
35 * @param title | |
36 * @param state | |
37 * @param origin | |
38 * @param tabId | |
39 */ | |
40 public MediaInfo( | |
41 String title, | |
42 boolean isPaused, | |
43 String origin, | |
44 int tabId) { | |
45 this.title = title; | |
46 this.isPaused = isPaused; | |
47 this.origin = origin; | |
48 this.tabId = tabId; | |
49 } | |
50 | |
51 /** | |
52 * Copy a media info. | |
53 * @param other the source. | |
mlamouri (slow - plz ping)
2015/06/24 16:15:02
nit: the source to copy from.
whywhat
2015/06/24 18:36:15
Done.
| |
54 */ | |
55 public MediaInfo(MediaInfo other) { | |
56 this(other.title, other.isPaused, other.origin, other.tabId); | |
57 } | |
58 | |
59 @Override | |
60 public boolean equals(Object obj) { | |
61 if (obj == this) return true; | |
62 if (!(obj instanceof MediaInfo)) return false; | |
63 | |
64 MediaInfo other = (MediaInfo) obj; | |
65 return isPaused == other.isPaused | |
66 && tabId == other.tabId | |
67 && TextUtils.equals(title, other.title) | |
68 && TextUtils.equals(origin, other.origin); | |
69 } | |
70 | |
71 @Override | |
72 public int hashCode() { | |
73 int result = isPaused ? 1 : 0; | |
74 result = 31 * result + (title == null ? 0 : title.hashCode()); | |
75 result = 31 * result + (origin == null ? 0 : origin.hashCode()); | |
76 result = 31 * result + tabId; | |
77 return result; | |
78 } | |
79 } | |
OLD | NEW |