mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
playing queue improvements
This commit is contained in:
parent
d99386bbc2
commit
60b49f2120
@ -89,6 +89,9 @@ class VideoOptionsBottomSheet(
|
||||
// using parentFragmentManager is important here
|
||||
shareDialog.show(parentFragmentManager, ShareDialog::class.java.name)
|
||||
}
|
||||
context?.getString(R.string.play_next) -> {
|
||||
PlayingQueue.playNext(videoId)
|
||||
}
|
||||
context?.getString(R.string.add_to_queue) -> {
|
||||
PlayingQueue.add(videoId)
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.github.libretube.util
|
||||
|
||||
object PlayingQueue {
|
||||
val queue = mutableListOf<String>()
|
||||
val currentVideoId: String? = null
|
||||
|
||||
fun clear() {
|
||||
queue.clear()
|
||||
@ -11,10 +12,16 @@ object PlayingQueue {
|
||||
queue.add(videoId)
|
||||
}
|
||||
|
||||
fun playNext(currentVideoId: String, nextVideoId: String) {
|
||||
fun playNext(nextVideoId: String) {
|
||||
queue.add(
|
||||
queue.indexOf(currentVideoId),
|
||||
nextVideoId
|
||||
)
|
||||
}
|
||||
|
||||
fun getNext(): String? {
|
||||
val currentIndex = queue.indexOf(currentVideoId)
|
||||
return if (currentIndex > queue.size) null
|
||||
else queue[currentIndex + 1]
|
||||
}
|
||||
}
|
||||
|
@ -329,6 +329,7 @@
|
||||
<string name="backup_customInstances">Custom Instances</string>
|
||||
<string name="save_feed">Load feed in background</string>
|
||||
<string name="save_feed_summary">Load the subscription feed in the background and prevent it from being auto-refreshed.</string>
|
||||
<string name="play_next">Play next</string>
|
||||
|
||||
<!-- Notification channel strings -->
|
||||
<string name="download_channel_name">Download Service</string>
|
||||
|
Loading…
Reference in New Issue
Block a user