feat: limit genre tags on home to 2 lines and on result page, 10 tags max (#885)

This commit is contained in:
IndusAryan 2024-01-16 23:11:43 +05:30 committed by GitHub
parent 9733d0b316
commit 601483e103
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -81,6 +81,7 @@ class HomeScrollAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
binding.homeScrollPreviewTags.apply { binding.homeScrollPreviewTags.apply {
text = card.tags?.joinToString("") ?: "" text = card.tags?.joinToString("") ?: ""
isGone = card.tags.isNullOrEmpty() isGone = card.tags.isNullOrEmpty()
maxLines = 2
} }
binding.homeScrollPreviewTitle.text = card.name binding.homeScrollPreviewTitle.text = card.name
} }

View file

@ -90,8 +90,9 @@ object UIHelper {
if (view == null) return if (view == null) return
view.removeAllViews() view.removeAllViews()
val context = view.context ?: return val context = view.context ?: return
val maxTags = tags.take(10) // Limited because they are too much
tags.forEach { tag -> maxTags.forEach { tag ->
val chip = Chip(context) val chip = Chip(context)
val chipDrawable = ChipDrawable.createFromAttributes( val chipDrawable = ChipDrawable.createFromAttributes(
context, context,