BottomBar
BottomBar copied to clipboard
problem with badge cut
Create a bottombar with 2 behavior app:bb_behavior="shy|shifting"
bagde is cut out.
@roughike r It replicates when we apply both "shy" and "shifting" behavior at the same time.
Can't replicate. What version are you on?
@roughike latest version....
@roughike maybe is because he has 5 items and maybe the size of the screen is small
That seems more like a real weird quirk. If you look at the badge on the third tab, the position hasn't for some reason been updated. It should be partially on top of the icon, just like in the first tab.
Also wasn't able to reproduce this with smaller screen and bigger number of tabs.
@roughike maybe is like the other issue you close earlier, that the image had padding, cause that would explain why the badge is so out of place. @kushmpatel can you make sure that you have 0 padding on the picture. like open it on your IDE and make sure has no transparent areas
I had the same issue on 2.1.1. Also using 5 icons with 24dp without padding and shifting as behavior. The bug occured occasionally when clicking on different tabs back and forth. So far I couldn't find a reproducible way to provoke it. Will try out the 2.2.0 version, but also need to get the issue fixed ;-)
If you could set up a sample project that you eventually or from time to time encounter this bug, it would help.
Otherwise I'm stuck to doing the "I'm sure if everything is the same, but let's hope I can reproduce this in following hour" thing and then wasting all that time because some tiny step is missing. 💩
@roughike size of the icons are mdpi - 3232 hdpi - 4848 xhdpi- 4848 xxhdpi - 7272
Attached an icon of 72 * 72 size.
@kushmpatel those icon measurements are wrong, but don't know if that has something to do. You sizes should be (based on the 32x32).
24 x 24 ldpi 32 x 32 mdpi 48 x48 hdpi 64 x 64 xhpdi 96 x96 xxhdpi
@yombunker Now added vector icons. Still badges are cuts on re-selection of tab. I attached icons.
BottomBar created as follows:
<com.roughike.bottombar.BottomBar android:id="@+id/bottom_bar_id" android:layout_width="match_parent" android:layout_height="60dp" android:layout_gravity="bottom" android:background="@color/colorPrimary" app:bb_activeTabColor="@color/white" app:bb_behavior="shy|shifting" app:bb_inActiveTabAlpha="0.6" app:bb_inActiveTabColor="@color/white" />
Adding tab programmatically,
mBottomBar.setItems(R.xml.bottombar_menu);
I have similar problem:
<com.roughike.bottombar.BottomBar android:id="@+id/bottomBar" android:layout_width="match_parent" android:layout_height="@dimen/content_margin_56" android:layout_alignParentBottom="true" app:bb_tabXmlResource="@xml/main_bottom_tabs" app:bb_behavior="shifting|underNavbar" app:bb_activeTabColor="@color/white" app:bb_inActiveTabColor="@color/white" app:bb_inActiveTabAlpha="0.6" app:bb_showShadow="false" />
@marcserrascmspain @ankitashah7791 @kushmpatel i just tried it out and you are right, when is selected doesn't matter the icon it will shift to the left as if you clicked the next tab. let me check was wrong and see if i can fix it today.
Thanks @yombunker
@yombunker @roughike Did you find any issue related to this badge cut?
@kushmpatel sorry haven't had time to look into it, I'm working on custom badges, which I'll be sending for PR tomorrow
@yombunker @roughike Found any solution for this ? I want to use it in my upcoming release. But waiting to resolve this issue.
The problem is that I haven't still been able to reproduce this issue.
@roughike I reproduce that issue navigating between different buttons with badges in some of these
@marcserrascmspain If possible and your code is not confidential then can you please share it ? So it's easy for @roughike to reproduce it.
@kushmpatel no need, it repros very simple let me talk to roughike about it.
I'm using compile ("com.roughike:bottom-bar:2.2.0")
This is the activity layout:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/extra_statusbar_padding"
android:layout_above="@+id/bottomBar"
/>
<com.roughike.bottombar.BottomBar
android:id="@+id/bottomBar"
android:layout_width="match_parent"
android:layout_height="@dimen/content_margin_56"
android:layout_alignParentBottom="true"
app:bb_tabXmlResource="@xml/main_bottom_tabs"
app:bb_behavior="shifting|underNavbar"
app:bb_activeTabColor="@color/white"
app:bb_inActiveTabColor="@color/white"
app:bb_inActiveTabAlpha="0.6"
app:bb_showShadow="false" />
</RelativeLayout>
How i set the badges:
if (count == null || count <= 0) {
tabWithId.removeBadge();
} else {
tabWithId.setBadgeCount(count.intValue());
}
One example:
runOnUiThread(() -> uiNavigation.updateBadge(Enumerators.MainFragments.MESSAGES, count));
@yombunker @roughike Did you find any issue related to this badge cut? Found any solution for this?
@yombunker @roughike This only replicates when I use shifting behavior. Is there any way so I can show icons with titles? If I show icons with titles (doesn't matter whether tab is selected or not), temporarily I can get rid of this issue.
@kushmpatel don't think you can show the text while in shifting behavior currently, we have something call titleless that does the opposite, it shows icons only, but, try setting it to false so see if that works :) @roughike he is out for a couple of days which is the one that worked on that functionality.
I have a similar problem on your Sample: Step 1: select Food Step 2: Select NearBy => you will see it .
Version: 2.3.1
<com.roughike.bottombar.BottomBar android:id="@+id/bottomBar" android:layout_width="match_parent" android:layout_height="64dp" android:layout_alignParentBottom="true" android:background="#FFFFFF" app:bb_tabXmlResource="@xml/bottombar_tabs_five" app:bb_behavior="shifting" app:bb_badgesHideWhenActive="false" app:bb_inActiveTabAlpha="0.3" app:bb_inActiveTabColor="@color/bottom_bar_inactive_tab" app:bb_activeTabColor="@color/colorAccent" app:bb_titleTypeFace="fonts/GreatVibes-Regular.otf" app:bb_titleTextAppearance="@style/CustomTitleTextAppearance"/>

@trihung93 Temporary you can use app:bb_behavior="shy | iconsOnly" to resolve this problem.
Is it going to be resolved in the short term? The issue is from 2 month ago :(
I have been experiencing this issue in my own app but was unable to reproduce it in the sample demo app.
I managed to identify the source of this bug as the animation. The badge is displayed at the end of the animation on the icon:
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!isActive && badge != null) {
badge.adjustPositionAndSize(BottomBarTab.this);
badge.show();
}
}
});
However, there seems to be a problem with the onAnimationEnd()
listener in the Android platform. Several people online have been reporting inconsistent behaviour (cf. Stackoverflow) where it's triggered but the animation hasn't finished.
I managed to solve this by replacing the faulty listener with a postDelayed()
call:
postDelayed(new Runnable() {
@Override
public void run() {
if (!isActive && badge != null) {
clearAnimation();
badge.adjustPositionAndSize(BottomBarTab.this);
badge.show();
}
}
}, animator.getDuration());
Not really "clean" but I really need this feature to work 😅 Haven't been able to reproduce the issue since this fix. Let me know if you want me to send a PR @roughike @yombunker
@xvarlez feel free to send a PR, i always try to look at them as quickly as possible, and the feature we haven't spend time fixing it, because a new "big" version change is coming, is just i haven't had free time to finish it :(
@marcserrascmspain sorry if is taking long, but, you have to remember we all have day jobs, and mine is taking most of my time lately, but, i do intent on fixing it, i hope this next week i get some slack so that i can finish it and release the 3.0 version that introduces a lot of new features and fixes.
Release?
Any updates on this guys? Release date estimation? This would be really useful.