mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
fix: respect sort order when playing private playlist
This commit is contained in:
parent
4834650f81
commit
c3916cd8f2
@ -208,17 +208,19 @@ class PlaylistFragment : DynamicLayoutManagerFragment() {
|
|||||||
|
|
||||||
if (playlistFeed.isEmpty()) {
|
if (playlistFeed.isEmpty()) {
|
||||||
binding.nothingHere.isVisible = true
|
binding.nothingHere.isVisible = true
|
||||||
}
|
|
||||||
|
|
||||||
if (playlistFeed.isEmpty()) {
|
|
||||||
binding.playAll.isGone = true
|
binding.playAll.isGone = true
|
||||||
} else {
|
} else {
|
||||||
binding.playAll.setOnClickListener {
|
binding.playAll.setOnClickListener {
|
||||||
if (playlistFeed.isEmpty()) return@setOnClickListener
|
if (playlistFeed.isEmpty()) return@setOnClickListener
|
||||||
|
|
||||||
|
val sortedStreams = getSortedVideos()
|
||||||
|
PlayingQueue.setStreams(sortedStreams)
|
||||||
|
|
||||||
NavigationHelper.navigateVideo(
|
NavigationHelper.navigateVideo(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
response.relatedStreams.first().url,
|
sortedStreams.first().url,
|
||||||
playlistId
|
playlistId,
|
||||||
|
keepQueue = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,8 +301,8 @@ class PlaylistFragment : DynamicLayoutManagerFragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showPlaylistVideos(playlist: Playlist) {
|
private fun getSortedVideos(): List<StreamItem> {
|
||||||
val videos = when {
|
return when {
|
||||||
selectedSortOrder in listOf(0, 1) || playlistType == PlaylistType.PUBLIC -> {
|
selectedSortOrder in listOf(0, 1) || playlistType == PlaylistType.PUBLIC -> {
|
||||||
playlistFeed
|
playlistFeed
|
||||||
}
|
}
|
||||||
@ -317,6 +319,10 @@ class PlaylistFragment : DynamicLayoutManagerFragment() {
|
|||||||
}.let {
|
}.let {
|
||||||
if (selectedSortOrder % 2 == 0) it else it.reversed()
|
if (selectedSortOrder % 2 == 0) it else it.reversed()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showPlaylistVideos(playlist: Playlist) {
|
||||||
|
val videos = getSortedVideos()
|
||||||
|
|
||||||
playlistAdapter = PlaylistAdapter(
|
playlistAdapter = PlaylistAdapter(
|
||||||
playlistFeed,
|
playlistFeed,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user