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

(JAVA) Adding text to AnimatedBottomBar.Badge() not working #27

Closed ZenHap closed 3 years ago

ZenHap commented 3 years ago

Code (Java) bottom_bar.setBadgeAtTabIndex(1, new AnimatedBottomBar.Badge("1"));

Cannot resolve constructor 'Badge(java.lang.String)'

Not sure if this is working in kotlin, but so far this means badges can't have text when using java

ZenHap commented 3 years ago

To fix: bottom_bar.setBadgeAtTabIndex(1, new AnimatedBottomBar.Badge("1", Color.BLACK, Color.WHITE, 9));

AnimatedBottomBar.Badge(badge_value, background_color, text_color, font_size)

you must set the values for the text and badge properties or you'll get an error, no default values

Droppers commented 3 years ago

I am reopening this as this definitely needs to be improved for easier use with Java.

ZenHap commented 3 years ago

something else I noticed is that it can sometimes be extremely unreliable to set, especially with time based or long running functions. I have a function where it retrieves the count of notifications to set the number within the dot to, and when it's in this function it does not work.

I also tried using a webview, and using onPageFinished, it's impossible to change or remove the badge inside onPageFinished

Droppers commented 3 years ago

Next version will have new constructors which allows the following: new AnimatedBottomBar.Badge() or new AnimatedBottomBar.Badge("1")