BottomBar
BottomBar copied to clipboard
First click on the bottom bar tab doesn't behave correctly. But after that, everything is fine.
Every click after the first click is showing a nice ripple effect. However, the first click instead of ripple effect, it shows a weird and not very pleasant animation.
Anyone notice this as well? I know it's a small issue. I expect it possibly is an easy fix as well. Anyone with any clue about it? Thanks!
I'm experiencing the same issue, I don't know exactly what's going on.. I don't have a spare time to look on it right now :/ Hope someone already got an easy workaround for this..
My 2 cents is that it have something to do with the support for background color changes and circular reveals introduced in this commit https://github.com/roughike/BottomBar/commit/916e8797b2608e7c85280639769ab07d170a11d7
I do think that defaultBackgroundColor field should be assigned to currentBackgroundColor to handle the cases where only the default ripple effect is wanted and the circular reveal animation is not necessary.
Anyone who is looking for a workaround solution, simply put below code after your bottom bar initialization.
final int DEFAULT_CURRENT_COLOR = 0;
for (int i = 0; i < bottomBar.getTabCount(); i++) {
bottomBar.getTabAtPosition(i).setBarColorWhenSelected(DEFAULT_CURRENT_COLOR);
}
In current library, it's "handleBackgroundColorChange()" causing the weird animation. My temporary workaround is programmatically set the bar selected color equals to currentBackgroundColor to prevent this method from executing. (Setting values to 0 in XML didn't work)
Quote the code below
private void handleBackgroundColorChange(BottomBarTab tab, boolean animate) {
int newColor = tab.getBarColorWhenSelected();
if (currentBackgroundColor == newColor) {
return;
}
if (!animate) {
outerContainer.setBackgroundColor(newColor);
return;
}
View clickedView = tab;
if (tab.hasActiveBadge()) {
clickedView = tab.getOuterView();
}
animateBGColorChange(clickedView, newColor);
currentBackgroundColor = newColor;
}
However, if you need this bar color change feature, this solution maybe not ideal for you.
When I have time, I will try to look into it and try to find a more proper solution.