andkulikov / Transitions-Everywhere

Set of extra Transitions on top of Jetpack Transitions Library
Apache License 2.0
4.83k stars 486 forks source link

setTransitionName not working within RecyclerView #62

Closed percula closed 7 years ago

percula commented 7 years ago

First off, thank you for this amazing library. It is simple and beautiful!

Now onto the issue: I added setTransitionName() to my RecyclerVIew and it helped, but it didn't catch all the views. My ViewHolder consists of the parent item View, an ImageView, and a TextView. I used setTransitionName() on all three, making sure each name is unique:

holder.mNameView.setText(name);
TransitionManager.setTransitionName(holder.mView, name);
TransitionManager.setTransitionName(holder.mIconView, name + "icon");
TransitionManager.setTransitionName(holder.mNameView, name + "name");

I have uploaded a short video to demonstrate the issue. Also, the three files I use TransitionsEverywhere in my project are here, here, and here, just search for "TransitionManager".

Perhaps I am doing something wrong or it's a bug.

andkulikov commented 7 years ago

Hi, Its hard to use transitions for recycler view because recycler view has some complex asynchronous layout logics. So, why don't you just use build-in animation from recyclerview? I mean in your case you could 1) call appropriate notifyInserted, notifyChanged methods from the adapter 2) do the same things in a more clever way with DiffUtils 3) apply stable ids for adapter.

percula commented 7 years ago

Thanks @andkulikov, great suggestions and I'll give one of those options a shot. Probably DiffUtils, seems easiest to implement in my app.