Replaced the equals method
This commit is contained in:
parent
52e39c3402
commit
5b3f8a3d30
4 changed files with 20 additions and 21 deletions
|
|
@ -348,7 +348,7 @@ public final class Player implements PlaybackListener, Listener {
|
|||
final boolean playbackSkipSilence = getPrefs().getBoolean(getContext().getString(
|
||||
R.string.playback_skip_silence_key), getPlaybackSkipSilence());
|
||||
|
||||
final boolean samePlayQueue = playQueue != null && playQueue.equals(newQueue);
|
||||
final boolean samePlayQueue = playQueue != null && playQueue.equalStreamsAndIndex(newQueue);
|
||||
final int repeatMode = intent.getIntExtra(REPEAT_MODE, getRepeatMode());
|
||||
final boolean playWhenReady = intent.getBooleanExtra(PLAY_WHEN_READY, true);
|
||||
final boolean isMuted = intent.getBooleanExtra(IS_MUTED, isMuted());
|
||||
|
|
|
|||
|
|
@ -518,18 +518,13 @@ public abstract class PlayQueue implements Serializable {
|
|||
* This method also gives a chance to track history of items in a queue in
|
||||
* VideoDetailFragment without duplicating items from two identical queues
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(@Nullable final Object obj) {
|
||||
if (!(obj instanceof PlayQueue)) {
|
||||
public boolean equalStreams(@Nullable final PlayQueue other) {
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
final PlayQueue other = (PlayQueue) obj;
|
||||
if (size() != other.size()) {
|
||||
return false;
|
||||
}
|
||||
if (other.getIndex() != getIndex()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < size(); i++) {
|
||||
final PlayQueueItem stream = streams.get(i);
|
||||
final PlayQueueItem otherStream = other.streams.get(i);
|
||||
|
|
@ -542,9 +537,11 @@ public abstract class PlayQueue implements Serializable {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return streams.hashCode();
|
||||
public boolean equalStreamsAndIndex(@Nullable final PlayQueue other) {
|
||||
if (equalStreams(other)) {
|
||||
return other.getIndex() == getIndex();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue