Droppers / AnimatedBottomBar

A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.
MIT License
1.37k stars 109 forks source link

Improve performance #37

Closed pelmenstar1 closed 2 years ago

pelmenstar1 commented 3 years ago

This PR reduces memory allocations, improves animation performance.

More information about changes in commit messages but if to be briefly:

Droppers commented 3 years ago

Not sure how but the animations of the indicator are twice as slow as the tab animations nows, other than that it looks and appears to be working as expected!

pelmenstar1 commented 3 years ago

Haven't understood what's wrong.

Old:

https://user-images.githubusercontent.com/55542136/131187125-2049830f-9076-4d05-a1af-37e5c073c4a0.mp4

New:

https://user-images.githubusercontent.com/55542136/131187223-900de6f1-8d6a-4ca1-b6bd-a0c389c05a6c.mp4

As for me, everything's ok

Droppers commented 3 years ago

Ah yes, it's a fun one, depending on the animation speed you have configured in developer settings (I have set it to 0.5), some animations are affected by it.

It used to be fine, I did something in the existing code to fix it, but I am not sure what.

pelmenstar1 commented 3 years ago

Well, there is fixDurationScale method. But I think it shouldn't be used, because it sets sDurationScale globally and it affects to another views in application. Ergo, it may create some difficulties for developers testing animations with developer settings

Droppers commented 2 years ago

I'll merge it, but I am not too sure what the behavior should be, since at the moment both animations behave differently depending on the developer settings. I will have to dig deeper in how this is actually applied for animations.