Skip to content

Commit 31f8dd0

Browse files
Convert play queue classes to Kotlin
1 parent c2b6c71 commit 31f8dd0

4 files changed

Lines changed: 324 additions & 459 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
@@ -397,7 +397,7 @@ public void handleIntent(@NonNull final Intent intent) {
397397
&& newQueue.size() == 1 && newQueue.getItem() != null
398398
&& playQueue != null && playQueue.size() == 1 && playQueue.getItem() != null
399399
&& newQueue.getItem().getUrl().equals(playQueue.getItem().getUrl())
400-
&& newQueue.getItem().getRecoveryPosition() != PlayQueueItem.RECOVERY_UNSET) {
400+
&& newQueue.getItem().getRecoveryPosition() != Long.MIN_VALUE) {
401401
// Player can have state = IDLE when playback is stopped or failed
402402
// and we should retry in this case
403403
if (simpleExoPlayer.getPlaybackState()
@@ -425,7 +425,7 @@ public void handleIntent(@NonNull final Intent intent) {
425425
&& !samePlayQueue
426426
&& !newQueue.isEmpty()
427427
&& newQueue.getItem() != null
428-
&& newQueue.getItem().getRecoveryPosition() == PlayQueueItem.RECOVERY_UNSET) {
428+
&& newQueue.getItem().getRecoveryPosition() == Long.MIN_VALUE) {
429429
databaseUpdateDisposable.add(recordManager.loadStreamState(newQueue.getItem())
430430
.observeOn(AndroidSchedulers.mainThread())
431431
// Do not place initPlayback() in doFinally() because
@@ -1588,7 +1588,7 @@ public void onPlaybackSynchronize(@NonNull final PlayQueueItem item, final boole
15881588
}
15891589

15901590
// sync the player index with the queue index, and seek to the correct position
1591-
if (item.getRecoveryPosition() != PlayQueueItem.RECOVERY_UNSET) {
1591+
if (item.getRecoveryPosition() != Long.MIN_VALUE) {
15921592
simpleExoPlayer.seekTo(playQueueIndex, item.getRecoveryPosition());
15931593
playQueue.unsetRecovery(playQueueIndex);
15941594
} else {

app/src/main/java/org/schabi/newpipe/player/playback/MediaSourceManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
import io.reactivex.rxjava3.schedulers.Schedulers;
3939
import io.reactivex.rxjava3.subjects.PublishSubject;
4040

41+
import static org.schabi.newpipe.BuildConfig.DEBUG;
4142
import static org.schabi.newpipe.player.mediasource.FailedMediaSource.MediaSourceResolutionException;
4243
import static org.schabi.newpipe.player.mediasource.FailedMediaSource.StreamInfoLoadException;
43-
import static org.schabi.newpipe.player.playqueue.PlayQueue.DEBUG;
4444
import static org.schabi.newpipe.util.ServiceHelper.getCacheExpirationMillis;
4545

4646
public class MediaSourceManager {

0 commit comments

Comments
 (0)