Merge pull request #3220 from Bnyro/master

Fix negative subscriber and views count for channels
This commit is contained in:
Bnyro 2023-03-02 16:39:39 +01:00 committed by GitHub
commit 3368708609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,13 +109,18 @@ class SearchAdapter : ListAdapter<ContentItem, SearchViewHolder>(SearchCallback)
binding.apply {
ImageHelper.loadImage(item.thumbnail, searchChannelImage)
searchChannelName.text = item.name
searchViews.text = root.context.getString(
R.string.subscribers,
item.subscribers.formatShort()
) + TextUtils.SEPARATOR + root.context.getString(
R.string.videoCount,
item.videos.toString()
)
searchViews.text = listOfNotNull(
root.context.getString(
R.string.subscribers,
item.subscribers.formatShort()
).takeIf { item.subscribers >= 0 },
root.context.getString(
R.string.videoCount,
item.videos.toString()
).takeIf { item.videos >= 0 }
).joinToString(TextUtils.SEPARATOR)
root.setOnClickListener {
NavigationHelper.navigateChannel(root.context, item.url)
}