Skip to content

Commit 835c5e9

Browse files
committed
Better equals check
It ensures that queues are not the same. Without this check when you have multiple videos in the backstack and navigating back via Back button you'll get duplicated videos
1 parent af80d96 commit 835c5e9

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,16 @@ public boolean equals(@Nullable final Object obj) {
528528
return false;
529529
}
530530
final PlayQueue other = (PlayQueue) obj;
531-
return streams.equals(other.streams);
531+
if (size() != other.size()) {
532+
return false;
533+
}
534+
for (int i = 0; i < size(); i++) {
535+
// Check is based on URL
536+
if (!streams.get(i).getUrl().equals(other.streams.get(i).getUrl())) {
537+
return false;
538+
}
539+
}
540+
return true;
532541
}
533542

534543
@Override

0 commit comments

Comments
 (0)