diff --git a/app/src/main/java/com/github/libretube/ui/sheets/PlayingQueueSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/PlayingQueueSheet.kt index 71f3de37e..1292b7377 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/PlayingQueueSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/PlayingQueueSheet.kt @@ -32,17 +32,9 @@ class PlayingQueueSheet : BottomSheetDialogFragment() { binding.optionsRecycler.adapter = adapter val callback = object : ItemTouchHelper.SimpleCallback( - 0, + ItemTouchHelper.UP or ItemTouchHelper.DOWN, 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( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, diff --git a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt index 578843554..863cd004a 100644 --- a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt +++ b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt @@ -1,5 +1,6 @@ package com.github.libretube.util +import android.util.Log import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.obj.StreamItem import com.github.libretube.extensions.move @@ -32,6 +33,7 @@ object PlayingQueue { fun getNext(): String? { return try { + Log.e("new video", queue[currentIndex() + 1].toString()) queue[currentIndex() + 1].url?.toID() } catch (e: Exception) { null @@ -60,7 +62,15 @@ object PlayingQueue { 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() }