Skip to content

Commit a430517

Browse files
committed
Re-add PlayQueueItem.RECOVERY_UNSET
This was removed in #12347 / 31f8dd0
1 parent e006328 commit a430517

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/Player.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public void handleIntent(@NonNull final Intent intent) {
480480
&& newQueue.size() == 1 && newQueue.getItem() != null
481481
&& playQueue != null && playQueue.size() == 1 && playQueue.getItem() != null
482482
&& newQueue.getItem().equals(playQueue.getItem())
483-
&& newQueue.getItem().getRecoveryPosition() != Long.MIN_VALUE) {
483+
&& newQueue.getItem().getRecoveryPosition() != PlayQueueItem.RECOVERY_UNSET) {
484484
// Player can have state = IDLE when playback is stopped or failed
485485
// and we should retry in this case
486486
if (simpleExoPlayer.getPlaybackState()
@@ -509,7 +509,7 @@ public void handleIntent(@NonNull final Intent intent) {
509509
&& (playQueue == null || !playQueue.equalStreamsAndIndex(newQueue))
510510
&& !newQueue.isEmpty()
511511
&& newQueue.getItem() != null
512-
&& newQueue.getItem().getRecoveryPosition() == Long.MIN_VALUE) {
512+
&& newQueue.getItem().getRecoveryPosition() == PlayQueueItem.RECOVERY_UNSET) {
513513
databaseUpdateDisposable.add(recordManager.loadStreamState(newQueue.getItem())
514514
.observeOn(AndroidSchedulers.mainThread())
515515
// Do not place initPlayback() in doFinally() because
@@ -1700,7 +1700,7 @@ public void onPlaybackSynchronize(@NonNull final PlayQueueItem item, final boole
17001700
}
17011701

17021702
// sync the player index with the queue index, and seek to the correct position
1703-
if (item.getRecoveryPosition() != Long.MIN_VALUE) {
1703+
if (item.getRecoveryPosition() != PlayQueueItem.RECOVERY_UNSET) {
17041704
simpleExoPlayer.seekTo(playQueueIndex, item.getRecoveryPosition());
17051705
playQueue.unsetRecovery(playQueueIndex);
17061706
} else {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import org.schabi.newpipe.player.playqueue.PlayQueueEvent.RecoveryEvent
1515
import org.schabi.newpipe.player.playqueue.PlayQueueEvent.RemoveEvent
1616
import org.schabi.newpipe.player.playqueue.PlayQueueEvent.ReorderEvent
1717
import org.schabi.newpipe.player.playqueue.PlayQueueEvent.SelectEvent
18+
import org.schabi.newpipe.player.playqueue.PlayQueueItem
1819

1920
/**
2021
* PlayQueue is responsible for keeping track of a list of streams and the index of
@@ -390,7 +391,7 @@ abstract class PlayQueue internal constructor(
390391
*/
391392
@Synchronized
392393
fun unsetRecovery(index: Int) {
393-
setRecovery(index, Long.Companion.MIN_VALUE)
394+
setRecovery(index, PlayQueueItem.RECOVERY_UNSET)
394395
}
395396

396397
/**

app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItem.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PlayQueueItem private constructor(
2828
var isAutoQueued: Boolean = false
2929

3030
// package-private
31-
var recoveryPosition = Long.Companion.MIN_VALUE
31+
var recoveryPosition = RECOVERY_UNSET
3232
var error: Throwable? = null
3333
private set
3434

@@ -68,4 +68,8 @@ class PlayQueueItem private constructor(
6868
override fun equals(o: Any?) = o is PlayQueueItem && serviceId == o.serviceId && url == o.url
6969

7070
override fun hashCode() = Objects.hash(url, serviceId)
71+
72+
companion object {
73+
const val RECOVERY_UNSET = Long.MIN_VALUE
74+
}
7175
}

0 commit comments

Comments
 (0)