akshay2211 / BubbleTabBar

BubbleTabBar is a bottom navigation bar with customizable bubble-like tabs

Home Page:https://github.com/akshay2211/BubbleTabBar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

First bubble text shown on activity recreate from saved state

vellrya opened this issue · comments

Hello, thank you for your great work on useful library!

I found a small bug relatively long time ago, but cannot find a way to reproduce it.
Now I can :)

When user left from the app on 2 or any next page and activity with viewpager recreated from saved state after app resume, colored text of first bubble unexpectedly shown. This behaviour can be forced (for testing purpose only, of course) in developer settings in this way: https://stackoverflow.com/a/19622671

I attached screenshot of sample app with force "do not keep activities" enabled.
(In real world this process may take a long time, but it will definitely happen)

image

Please take a look at this when you have time)

Hello @vellrya,
Thank you for trying out BubbleTabBar and submitting this bug,
I will try to resolve this soon as possible.

I hope you don't mind a little help)

This bug was caused by automatically restoring the state of ViewPager components, which caused onPageSelected, then setSelected in the BubbleTabBar, so several animations were playing together.
One working solution is to cancel the previous animations in setSelected and prevent the final callback from executing the animation.
I tried this code in my application and in the example from the repository - everything worked correctly for ViewPager/2 and NavController.

I found the same bug when almost simultaneously clicking on another tab and returning to the original tab (before the animation finishes).
Both bugs are reproduced in the master branch and fixed in the pull request #41.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.