Great transitions
If you click on any of the cards it will display the entry view again with the comments and a preview of the picture that we took previously.
We do not just want to move from the list view to the detail view. Material design also takes care of great natural transitions. This recipe is going to apply just that.
Getting ready
To go through this recipe, you will need to have the previous recipes up and running. This recipe is going to add some animations to it.
How to do it…
The following steps will help us to add the animations to our app:
- Add a
mDrink
member toViewHolder
in theMainAdapter
class:public Drink mDrink;
- In the same file in the
onBindViewHolder
method inform theview holder
about the actual drink, just after the initialization ofcurrentDrink
:Drink currentDrink = mDrinks.get(position); holder.mDrink = currentDrink;
- In the
onCreateViewHolder
method, add anOnClickListener
to the end:v.setTag(viewHolder); v.setOnClickListener(new View.OnClickListener() { ...