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

All icons disappears when i set badge twice #33

Open iballan opened 3 years ago

iballan commented 3 years ago

In the activity's onResume function I added code to check badge every time activity rersumes:

if (badgeNumber > 0) bn_menu.setBadgeAtTabIndex(1, AnimatedBottomBar.Badge("$badgeNumber")) else bn_menu.clearBadgeAtTabIndex(1)

So this code caused an issue to the users. i improved it to be like this and the issue was solved:

val notifTab = bn_menu.tabs[1] if (badgeNumber > 0) { if (notifTab.badge == null) { bn_menu.setBadgeAtTab(notifTab, AnimatedBottomBar.Badge("$badgeNumber")) } } else { if(notifTab.badge != null) { bn_menu.clearBadgeAtTab(notifTab) } }

But the issue here that the badge is not updated once it is added. Only cleared if badge is 0.

I think those checks must be done inside the library, like if I call clearBadgeAtTab or setBadgeAtTab(notifTab, AnimatedBottomBar.Badge("$badgeNumber")) twice It must not hide all icons.