mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Don't insert videos having a blank title to queue
This commit is contained in:
parent
efa036113b
commit
44e66d0d74
@ -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
|
||||
|
||||
|
@ -128,7 +128,7 @@ class PlaylistFragment : Fragment() {
|
||||
|
||||
binding.playlistInfo.text =
|
||||
(if (response.uploader != null) response.uploader + TextUtils.SEPARATOR else "") +
|
||||
getString(R.string.videoCount, response.videos.toString())
|
||||
getString(R.string.videoCount, response.videos.toString())
|
||||
|
||||
// show playlist options
|
||||
binding.optionsMenu.setOnClickListener {
|
||||
@ -197,12 +197,12 @@ class PlaylistFragment : Fragment() {
|
||||
|
||||
val info = binding.playlistInfo.text.split(TextUtils.SEPARATOR)
|
||||
binding.playlistInfo.text = (
|
||||
if (info.size == 2) {
|
||||
info[0] + TextUtils.SEPARATOR
|
||||
} else {
|
||||
""
|
||||
}
|
||||
) + getString(
|
||||
if (info.size == 2) {
|
||||
info[0] + TextUtils.SEPARATOR
|
||||
} else {
|
||||
""
|
||||
}
|
||||
) + getString(
|
||||
R.string.videoCount,
|
||||
playlistAdapter!!.itemCount.toString()
|
||||
)
|
||||
|
@ -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