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 { binding.apply {
ImageHelper.loadImage(item.thumbnail, searchChannelImage) ImageHelper.loadImage(item.thumbnail, searchChannelImage)
searchChannelName.text = item.name searchChannelName.text = item.name
searchViews.text = root.context.getString(
R.string.subscribers, searchViews.text = listOfNotNull(
item.subscribers.formatShort() root.context.getString(
) + TextUtils.SEPARATOR + root.context.getString( R.string.subscribers,
R.string.videoCount, item.subscribers.formatShort()
item.videos.toString() ).takeIf { item.subscribers >= 0 },
) root.context.getString(
R.string.videoCount,
item.videos.toString()
).takeIf { item.videos >= 0 }
).joinToString(TextUtils.SEPARATOR)
root.setOnClickListener { root.setOnClickListener {
NavigationHelper.navigateChannel(root.context, item.url) NavigationHelper.navigateChannel(root.context, item.url)
} }