Hi, have someone tried making dynamic RecyclerVie...
# anko
k
Hi, have someone tried making dynamic RecyclerView items? For example, simple item with text and optional image, I write the layout in Anko and make if else check for the image. In case if there’s no image I don’t inflate ImageView but only TextView. The problem is that in this case I need 2 itemViewTypes so the viewHolder reuse would work correctly, I could just define them in ids.xml but in real scenario I have item with 3 optional elements and that means 7 combinations, if I later would add one more optional element, then it would be already 15 combinations. Writing all those possible combinations in ids.xml feels like a bit too complicated. So I am thinking about using bitmask to simplify if else with optional elements, but have no idea how I could manage those ids for itemViewTypes. Have anyone got any clue?