mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
Merge pull request #5654 from Bnyro/master
fix: placeholders not properly shown at fast scrolling
This commit is contained in:
commit
9c41a2d76b
@ -64,6 +64,9 @@ object ImageHelper {
|
|||||||
* load an image from a url into an imageView
|
* load an image from a url into an imageView
|
||||||
*/
|
*/
|
||||||
fun loadImage(url: String?, target: ImageView, whiteBackground: Boolean = false) {
|
fun loadImage(url: String?, target: ImageView, whiteBackground: Boolean = false) {
|
||||||
|
// clear image to avoid loading issues at fast scrolling
|
||||||
|
target.setImageBitmap(null)
|
||||||
|
|
||||||
// only load the image if the data saver mode is disabled
|
// only load the image if the data saver mode is disabled
|
||||||
if (DataSaverMode.isEnabled(target.context) || url.isNullOrEmpty()) return
|
if (DataSaverMode.isEnabled(target.context) || url.isNullOrEmpty()) return
|
||||||
val urlToLoad = ProxyHelper.unwrapImageUrl(url)
|
val urlToLoad = ProxyHelper.unwrapImageUrl(url)
|
||||||
|
@ -69,7 +69,6 @@ class CommentPagingAdapter(
|
|||||||
commentText.text = comment.commentText?.replace("</a>", "</a> ")
|
commentText.text = comment.commentText?.replace("</a>", "</a> ")
|
||||||
?.parseAsHtml(tagHandler = HtmlParser(LinkHandler(handleLink ?: {})))
|
?.parseAsHtml(tagHandler = HtmlParser(LinkHandler(handleLink ?: {})))
|
||||||
|
|
||||||
commentorImage.setImageDrawable(null)
|
|
||||||
ImageHelper.loadImage(comment.thumbnail, commentorImage, true)
|
ImageHelper.loadImage(comment.thumbnail, commentorImage, true)
|
||||||
likesTextView.text = comment.likeCount.formatShort()
|
likesTextView.text = comment.likeCount.formatShort()
|
||||||
|
|
||||||
|
@ -76,17 +76,20 @@ class PlaylistAdapter(
|
|||||||
|
|
||||||
override fun onBindViewHolder(holder: PlaylistViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: PlaylistViewHolder, position: Int) {
|
||||||
val streamItem = sortedFeed[position]
|
val streamItem = sortedFeed[position]
|
||||||
|
val videoId = streamItem.url!!.toID()
|
||||||
|
|
||||||
holder.binding.apply {
|
holder.binding.apply {
|
||||||
videoTitle.text = streamItem.title
|
videoTitle.text = streamItem.title
|
||||||
videoInfo.text = streamItem.uploaderName
|
videoInfo.text = streamItem.uploaderName
|
||||||
channelImage.isGone = true
|
channelImage.isGone = true
|
||||||
|
|
||||||
thumbnailDuration.setFormattedDuration(streamItem.duration!!, streamItem.isShort)
|
thumbnailDuration.setFormattedDuration(streamItem.duration!!, streamItem.isShort)
|
||||||
|
|
||||||
ImageHelper.loadImage(streamItem.thumbnail, thumbnail)
|
ImageHelper.loadImage(streamItem.thumbnail, thumbnail)
|
||||||
|
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
NavigationHelper.navigateVideo(root.context, streamItem.url, playlistId)
|
NavigationHelper.navigateVideo(root.context, streamItem.url, playlistId)
|
||||||
}
|
}
|
||||||
val videoId = streamItem.url!!.toID()
|
|
||||||
|
|
||||||
val activity = (root.context as BaseActivity)
|
val activity = (root.context as BaseActivity)
|
||||||
val fragmentManager = activity.supportFragmentManager
|
val fragmentManager = activity.supportFragmentManager
|
||||||
|
@ -70,7 +70,6 @@ class SearchChannelAdapter : ListAdapter<ContentItem, SearchViewHolder>(SearchCa
|
|||||||
|
|
||||||
private fun bindVideo(item: ContentItem, binding: VideoRowBinding, position: Int) {
|
private fun bindVideo(item: ContentItem, binding: VideoRowBinding, position: Int) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
thumbnail.setImageDrawable(null)
|
|
||||||
ImageHelper.loadImage(item.thumbnail, thumbnail)
|
ImageHelper.loadImage(item.thumbnail, thumbnail)
|
||||||
thumbnailDuration.setFormattedDuration(item.duration, item.isShort)
|
thumbnailDuration.setFormattedDuration(item.duration, item.isShort)
|
||||||
videoTitle.text = item.title
|
videoTitle.text = item.title
|
||||||
@ -117,7 +116,6 @@ class SearchChannelAdapter : ListAdapter<ContentItem, SearchViewHolder>(SearchCa
|
|||||||
|
|
||||||
private fun bindChannel(item: ContentItem, binding: ChannelRowBinding) {
|
private fun bindChannel(item: ContentItem, binding: ChannelRowBinding) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
searchChannelImage.setImageDrawable(null)
|
|
||||||
ImageHelper.loadImage(item.thumbnail, searchChannelImage, true)
|
ImageHelper.loadImage(item.thumbnail, searchChannelImage, true)
|
||||||
searchChannelName.text = item.name
|
searchChannelName.text = item.name
|
||||||
|
|
||||||
@ -156,7 +154,6 @@ class SearchChannelAdapter : ListAdapter<ContentItem, SearchViewHolder>(SearchCa
|
|||||||
|
|
||||||
private fun bindPlaylist(item: ContentItem, binding: PlaylistsRowBinding) {
|
private fun bindPlaylist(item: ContentItem, binding: PlaylistsRowBinding) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
playlistThumbnail.setImageDrawable(null)
|
|
||||||
ImageHelper.loadImage(item.thumbnail, playlistThumbnail)
|
ImageHelper.loadImage(item.thumbnail, playlistThumbnail)
|
||||||
if (item.videos != -1L) videoCount.text = item.videos.toString()
|
if (item.videos != -1L) videoCount.text = item.videos.toString()
|
||||||
playlistTitle.text = item.name
|
playlistTitle.text = item.name
|
||||||
|
@ -103,8 +103,6 @@ class VideosAdapter(
|
|||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onBindViewHolder(holder: VideosViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: VideosViewHolder, position: Int) {
|
||||||
holder.trendingRowBinding?.thumbnail?.setImageDrawable(null)
|
|
||||||
|
|
||||||
val video = streamItems[position]
|
val video = streamItems[position]
|
||||||
val videoId = video.url?.toID()
|
val videoId = video.url?.toID()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user