mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #3204 from Bnyro/master
Remove playlists from the playing queue
This commit is contained in:
commit
edf32b078e
@ -4,7 +4,6 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
@ -96,11 +95,6 @@ class VideosAdapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideItemView(holder: VideosViewHolder) {
|
|
||||||
holder.itemView.visibility = View.GONE
|
|
||||||
holder.itemView.layoutParams = RecyclerView.LayoutParams(0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onBindViewHolder(holder: VideosViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: VideosViewHolder, position: Int) {
|
||||||
val video = streamItems[position]
|
val video = streamItems[position]
|
||||||
@ -108,12 +102,6 @@ class VideosAdapter(
|
|||||||
val videoId = video.url?.toID()
|
val videoId = video.url?.toID()
|
||||||
val videoName = video.title
|
val videoName = video.title
|
||||||
|
|
||||||
// hide the item if there was an extractor error
|
|
||||||
if (video.title == null && video.type != "caught") {
|
|
||||||
hideItemView(holder)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
videoId?.let {
|
videoId?.let {
|
||||||
(holder.trendingRowBinding?.watchProgress ?: holder.videoRowBinding!!.watchProgress)
|
(holder.trendingRowBinding?.watchProgress ?: holder.videoRowBinding!!.watchProgress)
|
||||||
.setWatchProgressLength(it, video.duration ?: 0L)
|
.setWatchProgressLength(it, video.duration ?: 0L)
|
||||||
|
@ -45,7 +45,7 @@ class ChannelFragment : Fragment() {
|
|||||||
|
|
||||||
private var onScrollEnd: () -> Unit = {}
|
private var onScrollEnd: () -> Unit = {}
|
||||||
|
|
||||||
val possibleTabs = listOf(
|
private val possibleTabs = listOf(
|
||||||
ChannelTabs.Channels,
|
ChannelTabs.Channels,
|
||||||
ChannelTabs.Playlists,
|
ChannelTabs.Playlists,
|
||||||
ChannelTabs.Livestreams,
|
ChannelTabs.Livestreams,
|
||||||
|
@ -980,7 +980,7 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initializeRelatedVideos(streams.relatedStreams)
|
initializeRelatedVideos(streams.relatedStreams.filter { !it.title.isNullOrBlank() })
|
||||||
// set video description
|
// set video description
|
||||||
val description = streams.description
|
val description = streams.description
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@ import com.github.libretube.helpers.LocaleHelper
|
|||||||
import com.github.libretube.ui.activities.SettingsActivity
|
import com.github.libretube.ui.activities.SettingsActivity
|
||||||
import com.github.libretube.ui.adapters.VideosAdapter
|
import com.github.libretube.ui.adapters.VideosAdapter
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
|
import java.io.IOException
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.IOException
|
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
|
|
||||||
class TrendsFragment : Fragment() {
|
class TrendsFragment : Fragment() {
|
||||||
|
@ -30,7 +30,7 @@ object PlayingQueue {
|
|||||||
|
|
||||||
fun add(vararg streamItem: StreamItem) {
|
fun add(vararg streamItem: StreamItem) {
|
||||||
for (stream in streamItem) {
|
for (stream in streamItem) {
|
||||||
if (currentStream?.url?.toID() == stream.url?.toID()) continue
|
if (currentStream?.url?.toID() == stream.url?.toID() || stream.title.isNullOrBlank()) continue
|
||||||
// remove if already present
|
// remove if already present
|
||||||
queue.remove(stream)
|
queue.remove(stream)
|
||||||
queue.add(stream)
|
queue.add(stream)
|
||||||
@ -119,7 +119,7 @@ object PlayingQueue {
|
|||||||
playlistNextPage!!
|
playlistNextPage!!
|
||||||
).apply {
|
).apply {
|
||||||
add(
|
add(
|
||||||
*this.relatedStreams.orEmpty().toTypedArray()
|
*this.relatedStreams.toTypedArray()
|
||||||
)
|
)
|
||||||
playlistNextPage = this.nextpage
|
playlistNextPage = this.nextpage
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user