This is my code for setting up the chipgroup and chips inside based on list:
val chipGroup = region_list
val inflator = LayoutInflater.from(chipGroup.context)
val children = categoryList.map { categoryName ->
val chip = inflator.inflate(R.layout.region, chipGroup, false) as Chip
chip.text = categoryName.replace('_', ' ')
chip.tag = categoryName
chip.setOnCheckedChangeListener { button, isChecked ->
val s = viewModel.updateFilter(button.tag as String, isChecked)
//s is a string = {"change", "keep"}
//if s is keep that means that the same chip that was selected was pressed again, and in normal chip behaviour in android that chip would then be deselected, I don't want that
}
}
s is a string = {"change", "keep"} if s is keep that means that the same chip that was selected was pressed again, and in normal chip behaviour in android that chip would then be deselected, I don't want that. I can't believe that android team never thought that someone would need a chipgroup where an item can't be deselected, what is the point of chips, to use it as some kind of filter to update view bellow.