mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +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.text.format.DateUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.updateLayoutParams
|
||||
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")
|
||||
override fun onBindViewHolder(holder: VideosViewHolder, position: Int) {
|
||||
val video = streamItems[position]
|
||||
@ -108,12 +102,6 @@ class VideosAdapter(
|
||||
val videoId = video.url?.toID()
|
||||
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 {
|
||||
(holder.trendingRowBinding?.watchProgress ?: holder.videoRowBinding!!.watchProgress)
|
||||
.setWatchProgressLength(it, video.duration ?: 0L)
|
||||
|
@ -45,7 +45,7 @@ class ChannelFragment : Fragment() {
|
||||
|
||||
private var onScrollEnd: () -> Unit = {}
|
||||
|
||||
val possibleTabs = listOf(
|
||||
private val possibleTabs = listOf(
|
||||
ChannelTabs.Channels,
|
||||
ChannelTabs.Playlists,
|
||||
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
|
||||
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.adapters.VideosAdapter
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import java.io.IOException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.IOException
|
||||
import retrofit2.HttpException
|
||||
|
||||
class TrendsFragment : Fragment() {
|
||||
|
@ -30,7 +30,7 @@ object PlayingQueue {
|
||||
|
||||
fun add(vararg streamItem: 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
|
||||
queue.remove(stream)
|
||||
queue.add(stream)
|
||||
@ -119,7 +119,7 @@ object PlayingQueue {
|
||||
playlistNextPage!!
|
||||
).apply {
|
||||
add(
|
||||
*this.relatedStreams.orEmpty().toTypedArray()
|
||||
*this.relatedStreams.toTypedArray()
|
||||
)
|
||||
playlistNextPage = this.nextpage
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user