i'm working on a RecyclerView in Android which should contains expandable cards. I've already seen some questions like this or this but I can't figure out how to manage some things.
In my app (pic below) the expandable part is the one with the "maps" icon and "plus" icon.
During Google I/O 2016, Nick Butcher explained some of his code but i can't solve the part in which he divides the layout in two parts (the one that is always visibile itemView, and the expandable one, details) in the onBindViewHolder method.
final boolean isExpanded = position==mExpandedPosition;
holder.details.setVisibility(isExpanded?View.VISIBLE:View.GONE);
holder.itemView.setActivated(isExpanded);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mExpandedPosition = isExpanded ? -1:position;
TransitionManager.beginDelayedTransition(recyclerView);
notifyDataSetChanged();
}
});
Can anyone explain me this and the other parts that make the animation and the expansion possible? You could find useful the Heisenberg's reply in this question Thanks!