2018-04-21 23:10:01 +02:00
|
|
|
package org.schabi.newpipe.player.playqueue;
|
2017-09-05 21:27:12 +02:00
|
|
|
|
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
2017-11-02 06:33:13 +01:00
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
2017-09-05 21:27:12 +02:00
|
|
|
|
2018-01-17 06:12:03 +01:00
|
|
|
import java.util.ArrayList;
|
2017-09-05 21:27:12 +02:00
|
|
|
import java.util.Collections;
|
2018-01-17 06:12:03 +01:00
|
|
|
import java.util.List;
|
2017-09-05 21:27:12 +02:00
|
|
|
|
|
|
|
public final class SinglePlayQueue extends PlayQueue {
|
2017-11-02 06:33:13 +01:00
|
|
|
public SinglePlayQueue(final StreamInfoItem item) {
|
2018-01-17 06:12:03 +01:00
|
|
|
super(0, Collections.singletonList(new PlayQueueItem(item)));
|
2017-11-02 06:33:13 +01:00
|
|
|
}
|
|
|
|
|
2017-09-25 05:14:58 +02:00
|
|
|
public SinglePlayQueue(final StreamInfo info) {
|
2018-01-17 06:12:03 +01:00
|
|
|
super(0, Collections.singletonList(new PlayQueueItem(info)));
|
2017-11-02 06:33:13 +01:00
|
|
|
}
|
|
|
|
|
2019-03-13 02:31:03 +01:00
|
|
|
public SinglePlayQueue(final StreamInfo info, final long startPosition) {
|
|
|
|
super(0, Collections.singletonList(new PlayQueueItem(info)));
|
|
|
|
getItem().setRecoveryPosition(startPosition);
|
|
|
|
}
|
|
|
|
|
2018-01-17 06:12:03 +01:00
|
|
|
public SinglePlayQueue(final List<StreamInfoItem> items, final int index) {
|
|
|
|
super(index, playQueueItemsOf(items));
|
|
|
|
}
|
|
|
|
|
2020-03-31 19:20:15 +02:00
|
|
|
private static List<PlayQueueItem> playQueueItemsOf(final List<StreamInfoItem> items) {
|
2020-08-16 10:24:58 +02:00
|
|
|
final List<PlayQueueItem> playQueueItems = new ArrayList<>(items.size());
|
2018-01-17 06:12:03 +01:00
|
|
|
for (final StreamInfoItem item : items) {
|
|
|
|
playQueueItems.add(new PlayQueueItem(item));
|
|
|
|
}
|
|
|
|
return playQueueItems;
|
2017-09-05 21:27:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isComplete() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-03-31 19:20:15 +02:00
|
|
|
public void fetch() {
|
|
|
|
}
|
2017-09-05 21:27:12 +02:00
|
|
|
}
|