Git Product home page Git Product logo

Comments (16)

tfonfara avatar tfonfara commented on July 30, 2024 2

@bret-fears thanks a lot for approving and merging! Could you create a new release version from the updated master branch so this change is available as gradle dependency?

from spruce-android.

bret-fears avatar bret-fears commented on July 30, 2024 2

Fix has been merged and is available in patch version 1.0.3
https://github.com/willowtreeapps/spruce-android/releases/tag/1.0.3

from spruce-android.

bret-fears avatar bret-fears commented on July 30, 2024 1

The current example for recycler is calling the animation start in onLayoutChildren which, as you can see, is applying the animation to the children rather than when they are added. The proper path to take is to run the animation from a RecyclerView.ItemAnimator#animateAdd() call so the children are animated when they are added.

The drawback to using animateAdd is it'd apply the animations one at a time rather than to the group.

The path moving forward is to add native RecyclerView.ItemAnimator support which will hopefully be available in an upcoming release.

Thank you for calling this out!

from spruce-android.

tfonfara avatar tfonfara commented on July 30, 2024 1

I think I found an easier solution for that problem than #79 is.

In Spruce.java:71 the animation will be delayed using setStartDelay(). This also delays the "setup" of the items which means the initial hiding.

If I change now

animatorCopy.setStartDelay(childView.getTimeOffset());

to

animatorCopy.start();
animatorCopy.cancel();
animatorCopy.setStartDelay(childView.getTimeOffset());

the animation starts (items will be hidden) but the actual animation is cancelled immediately. After that I can add the start delay and the full animation will be played as expected.

What do you think about that?
CC: @bret-fears

PS: Looks like this change only affects the initial recycler view animation, all other animations (recycler view onClick animation, all sort animations) still work fine and as previously in the sample app.

from spruce-android.

bret-fears avatar bret-fears commented on July 30, 2024 1

@tfonfara cheers! good work.

from spruce-android.

filol avatar filol commented on July 30, 2024

+1
I look forward to this new version

from spruce-android.

rf43 avatar rf43 commented on July 30, 2024

@bret-fears We could probably label this as an Enhancement

from spruce-android.

tfonfara avatar tfonfara commented on July 30, 2024

+1 looking forward to that!

from spruce-android.

bret-fears avatar bret-fears commented on July 30, 2024

@tfonfara I like it! It's simple and solves the issue described by @lokither

from spruce-android.

tfonfara avatar tfonfara commented on July 30, 2024

@bret-fears I'm pleased to hear that :) I noticed that you declined your pr, will you integrate my approach into the main code? ;)

from spruce-android.

bret-fears avatar bret-fears commented on July 30, 2024

@tfonfara you're welcome to submit a pull request. Otherwise, I'll gladly add that suggested change when I have time to.

from spruce-android.

tfonfara avatar tfonfara commented on July 30, 2024

@bret-fears there you go ;)

from spruce-android.

bret-fears avatar bret-fears commented on July 30, 2024

Closing this issue for now. Feel free to leave feedback here or open new issues as appropriate.

from spruce-android.

amanzan avatar amanzan commented on July 30, 2024

Hey @bret-fears I don't think this is fixed in version 1.0.2. In the Recycler Example, I still see what @16meyrat commented: RecyclerView is animated is first almost fully displayed, then disappears, and then the animation starts. It's quick but clearly visible...which is not ideal.

Is there anything I am missing? Attached video of the sample app

Screenrecorder-2021-01-13-15-18-23-263.mp4

from spruce-android.

amanzan avatar amanzan commented on July 30, 2024

Also, @tfonfara fix makes children's setStartDelay to stop working. I added the fix manually, and now all RecyclerView children animate at the same time, instead of one by one!

Spruce.mp4

Edited for adding video.

@bret-fears I see this issue is quite old, maybe there is another way to fix this in the latest version?

from spruce-android.

bret-fears avatar bret-fears commented on July 30, 2024

@amanzan I have completely forgotten about this. I will re-open and investigate possible options around it so it doesn't interfere with other types of set animations.

from spruce-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.