mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Minor fixes
This commit is contained in:
parent
1962268460
commit
fb21dd2543
@ -32,17 +32,9 @@ class PlayingQueueSheet : BottomSheetDialogFragment() {
|
|||||||
binding.optionsRecycler.adapter = adapter
|
binding.optionsRecycler.adapter = adapter
|
||||||
|
|
||||||
val callback = object : ItemTouchHelper.SimpleCallback(
|
val callback = object : ItemTouchHelper.SimpleCallback(
|
||||||
0,
|
ItemTouchHelper.UP or ItemTouchHelper.DOWN,
|
||||||
ItemTouchHelper.LEFT
|
ItemTouchHelper.LEFT
|
||||||
) {
|
) {
|
||||||
override fun getMovementFlags(
|
|
||||||
recyclerView: RecyclerView,
|
|
||||||
viewHolder: RecyclerView.ViewHolder
|
|
||||||
): Int {
|
|
||||||
val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN
|
|
||||||
return makeMovementFlags(dragFlags, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMove(
|
override fun onMove(
|
||||||
recyclerView: RecyclerView,
|
recyclerView: RecyclerView,
|
||||||
viewHolder: RecyclerView.ViewHolder,
|
viewHolder: RecyclerView.ViewHolder,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.libretube.util
|
package com.github.libretube.util
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import com.github.libretube.api.RetrofitInstance
|
import com.github.libretube.api.RetrofitInstance
|
||||||
import com.github.libretube.api.obj.StreamItem
|
import com.github.libretube.api.obj.StreamItem
|
||||||
import com.github.libretube.extensions.move
|
import com.github.libretube.extensions.move
|
||||||
@ -32,6 +33,7 @@ object PlayingQueue {
|
|||||||
|
|
||||||
fun getNext(): String? {
|
fun getNext(): String? {
|
||||||
return try {
|
return try {
|
||||||
|
Log.e("new video", queue[currentIndex() + 1].toString())
|
||||||
queue[currentIndex() + 1].url?.toID()
|
queue[currentIndex() + 1].url?.toID()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
null
|
null
|
||||||
@ -60,7 +62,15 @@ object PlayingQueue {
|
|||||||
|
|
||||||
fun size() = queue.size
|
fun size() = queue.size
|
||||||
|
|
||||||
fun currentIndex() = queue.indexOf(currentStream)
|
fun currentIndex(): Int {
|
||||||
|
return try {
|
||||||
|
queue.indexOf(
|
||||||
|
queue.first { it.url?.toID() == currentStream?.url?.toID() }
|
||||||
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun contains(streamItem: StreamItem) = queue.any { it.url?.toID() == streamItem.url?.toID() }
|
fun contains(streamItem: StreamItem) = queue.any { it.url?.toID() == streamItem.url?.toID() }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user