mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +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
|
// using parentFragmentManager is important here
|
||||||
shareDialog.show(parentFragmentManager, ShareDialog::class.java.name)
|
shareDialog.show(parentFragmentManager, ShareDialog::class.java.name)
|
||||||
}
|
}
|
||||||
|
context?.getString(R.string.play_next) -> {
|
||||||
|
PlayingQueue.playNext(videoId)
|
||||||
|
}
|
||||||
context?.getString(R.string.add_to_queue) -> {
|
context?.getString(R.string.add_to_queue) -> {
|
||||||
PlayingQueue.add(videoId)
|
PlayingQueue.add(videoId)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.github.libretube.util
|
|||||||
|
|
||||||
object PlayingQueue {
|
object PlayingQueue {
|
||||||
val queue = mutableListOf<String>()
|
val queue = mutableListOf<String>()
|
||||||
|
val currentVideoId: String? = null
|
||||||
|
|
||||||
fun clear() {
|
fun clear() {
|
||||||
queue.clear()
|
queue.clear()
|
||||||
@ -11,10 +12,16 @@ object PlayingQueue {
|
|||||||
queue.add(videoId)
|
queue.add(videoId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun playNext(currentVideoId: String, nextVideoId: String) {
|
fun playNext(nextVideoId: String) {
|
||||||
queue.add(
|
queue.add(
|
||||||
queue.indexOf(currentVideoId),
|
queue.indexOf(currentVideoId),
|
||||||
nextVideoId
|
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="backup_customInstances">Custom Instances</string>
|
||||||
<string name="save_feed">Load feed in background</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="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 -->
|
<!-- Notification channel strings -->
|
||||||
<string name="download_channel_name">Download Service</string>
|
<string name="download_channel_name">Download Service</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user