diff --git a/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt index e385e3d52..07da86ad1 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt @@ -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) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt index b5cfecc57..2aff76887 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/ChannelFragment.kt @@ -45,7 +45,7 @@ class ChannelFragment : Fragment() { private var onScrollEnd: () -> Unit = {} - val possibleTabs = listOf( + private val possibleTabs = listOf( ChannelTabs.Channels, ChannelTabs.Playlists, ChannelTabs.Livestreams, diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index 754ddffb0..06ebeabb3 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -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 diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt index 2822fc5d0..ff27398ba 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt @@ -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() ) diff --git a/app/src/main/java/com/github/libretube/ui/fragments/TrendsFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/TrendsFragment.kt index d200cbc6e..88cece414 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/TrendsFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/TrendsFragment.kt @@ -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() { 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 6856ef7d0..5201c2414 100644 --- a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt +++ b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt @@ -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 }