fix: Show the category color on removable chips

This commit is contained in:
Peter Vacho 2025-01-02 12:04:37 +01:00
parent 908bf293b0
commit 18325d87ad
Signed by: school
GPG key ID: 8CFC3837052871B4

View file

@ -43,12 +43,17 @@ class CategoryChipAdapter(
val category = categories[position]
if (holder is CategoryViewHolder) {
// Regular category chip
holder.textView.text = category.name
holder.textView.backgroundTintList = ColorStateList.valueOf(category.color.toArgb())
} else if (holder is RemovableCategoryViewHolder) {
// Removable category chip
holder.textView.text = category.name
holder.textView.backgroundTintList = ColorStateList.valueOf(category.color.toArgb())
// Apply background tint to the LinearLayout (container)
holder.itemView.backgroundTintList = ColorStateList.valueOf(category.color.toArgb())
// Set up the remove button's click listener
holder.removeButton.setOnClickListener {
onRemoveCategory?.invoke(category, position)
}