I didn't expect to get so many views on my Shared Element Transition blog series. But making it into Android Dev Digest and Android Weekly has increased the number of people looking at my work. I'm happy and proud of this achievement. With so many people looking it, it has also led to some clarifications and fixing of some mistakes. This has been great for me, I've learned a lot more about Shared Element Transitions, though obviously I never wanted this to be a result of misinformation from my posts.

For that reason, I've gone back through my posts and updated them accordingly, either correcting or clarifying them. Where necessary, some text has been struck through. Code wise, it would be best to look at the commits that I've made to see the changes. The commit messages should be explanation enough of why they have been changed. There's a pull request which tidies a lot of code up such as moving animal names to strings.xml and removing unused attributes. When the code samples in the posts have been updated it will be merged in.

I'm going to add quick summaries of the changes of the posts here. Just so you don't have to go back all the way through to check.

Part 1 - Activities

  • Clarified that transitionName needs to be unique in the view hierarchy and not necessarily the same on the two views that the Shared Element Transition is taking place using.
  • Used ViewCompat.getTransitionName in code sample for creating ActivityOptionsCompat instead of using getString.

Part 2 - Fragments

  • Used ViewCompat.getTransitionName in code sample when creating a FragmentTransaction and explained that we use it as we know both transitionName are the same in both Fragment layouts.

Part 3 - Picasso & Glide

  • Used ViewCompat.getTransitionName in code samples for creating ActivityOptionsCompat instead of using getString.

Part 4 - RecyclerView

  • Used ViewCompat.getTransitionName on the passed through ImageView in code samples for creating ActivityOptionsCompat instead of using a String passed through as part of a parameter in the AnimalItemClickListener. This means simpler code.
  • Made note that the transitionName can be set on the AnimalDetailActivity or AnimalDetailFragment ImageView in XML, as a transitionName needs to only be unique for its view hierarchy.
  • Changed the code example of the AnimalGalleryAdapter to use the Animal name as a unique transitionName rather than using the position in the RecyclerView which could be volatile. It's better to use some unique identifier on your derived from your model.
  • I intend to update the ViewPager code example with a way to do the Shared Element Transition when returning to the list when you've moved in the ViewPager. If you'd like to be notified then watch this issue.

Part 5 - Fixing Flashing/Blinking

  • Added a link to an explanation on the reason you can't exclude Toolbar from a transition by default.

If you'd like clarification on any of the above then please post in the comments.

Lastly, you should definitely go watch this video from io16 on transitions, even if it's just the first 8 minutes!

A big thanks to Benjamin Weiss, Nick Butcher, Christophe Beyls, Keith Smyth, David Cryer and Jonathan Caryl for keeping me on my toes. Much appreciated 🙂

And also a big thanks to everyone that's been reading them all, I hope I've been of some help and there will be more to come in the future.