mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
Merge pull request #5057 from Bnyro/master
fix: channel avatar placeholder visible for shorts of a channel
This commit is contained in:
commit
8a95bff496
@ -3,6 +3,7 @@ package com.github.libretube.ui.adapters
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
|
import androidx.core.view.isGone
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
@ -83,6 +84,7 @@ class SearchAdapter(
|
|||||||
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
|
||||||
|
|
||||||
val viewsString = item.views.takeIf { it != -1L }?.formatShort().orEmpty()
|
val viewsString = item.views.takeIf { it != -1L }?.formatShort().orEmpty()
|
||||||
val uploadDate = item.uploaded.takeIf { it > 0 }?.let {
|
val uploadDate = item.uploaded.takeIf { it > 0 }?.let {
|
||||||
" ${TextUtils.SEPARATOR} ${TextUtils.formatRelativeDate(root.context, it)}"
|
" ${TextUtils.SEPARATOR} ${TextUtils.formatRelativeDate(root.context, it)}"
|
||||||
@ -92,16 +94,20 @@ class SearchAdapter(
|
|||||||
viewsString,
|
viewsString,
|
||||||
uploadDate
|
uploadDate
|
||||||
)
|
)
|
||||||
|
|
||||||
// only display channel related info if not in a channel tab
|
// only display channel related info if not in a channel tab
|
||||||
if (!isChannelAdapter) {
|
if (!isChannelAdapter) {
|
||||||
channelName.text = item.uploaderName
|
channelName.text = item.uploaderName
|
||||||
ImageHelper.loadImage(item.uploaderAvatar, channelImage)
|
ImageHelper.loadImage(item.uploaderAvatar, channelImage)
|
||||||
|
} else {
|
||||||
|
channelContainer.isGone = true
|
||||||
}
|
}
|
||||||
|
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
NavigationHelper.navigateVideo(root.context, item.url, timestamp = timeStamp)
|
NavigationHelper.navigateVideo(root.context, item.url, timestamp = timeStamp)
|
||||||
}
|
}
|
||||||
val videoId = item.url.toID()
|
|
||||||
|
|
||||||
|
val videoId = item.url.toID()
|
||||||
val activity = (root.context as BaseActivity)
|
val activity = (root.context as BaseActivity)
|
||||||
val fragmentManager = activity.supportFragmentManager
|
val fragmentManager = activity.supportFragmentManager
|
||||||
root.setOnLongClickListener {
|
root.setOnLongClickListener {
|
||||||
|
Loading…
Reference in New Issue
Block a user