BottomBar icon indicating copy to clipboard operation
BottomBar copied to clipboard

problem with badge cut

Open ankitashah7791 opened this issue 7 years ago • 33 comments

Create a bottombar with 2 behavior app:bb_behavior="shy|shifting" bagde is cut out. badge issue

ankitashah7791 avatar Mar 24 '17 11:03 ankitashah7791

@roughike r It replicates when we apply both "shy" and "shifting" behavior at the same time.

kushmpatel avatar Mar 26 '17 05:03 kushmpatel

Can't replicate. What version are you on?

roughike avatar Mar 26 '17 10:03 roughike

@roughike latest version....

kushmpatel avatar Mar 26 '17 11:03 kushmpatel

@roughike maybe is because he has 5 items and maybe the size of the screen is small

yombunker avatar Mar 26 '17 14:03 yombunker

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 avatar Mar 26 '17 15:03 roughike

@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

yombunker avatar Mar 26 '17 15:03 yombunker

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 ;-)

deisold avatar Mar 26 '17 22:03 deisold

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 avatar Mar 26 '17 22:03 roughike

@roughike size of the icons are mdpi - 3232 hdpi - 4848 xhdpi- 4848 xxhdpi - 7272

files_phone

Attached an icon of 72 * 72 size.

kushmpatel avatar Mar 27 '17 04:03 kushmpatel

@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 avatar Mar 27 '17 04:03 yombunker

@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);

drawable.zip

ankitashah7791 avatar Mar 27 '17 10:03 ankitashah7791

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" />

bottombar_badge_err

marcserrascmspain avatar Mar 27 '17 14:03 marcserrascmspain

@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.

yombunker avatar Mar 27 '17 15:03 yombunker

Thanks @yombunker

marcserrascmspain avatar Mar 28 '17 07:03 marcserrascmspain

@yombunker @roughike Did you find any issue related to this badge cut?

kushmpatel avatar Mar 29 '17 05:03 kushmpatel

@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 avatar Mar 29 '17 06:03 yombunker

@yombunker @roughike Found any solution for this ? I want to use it in my upcoming release. But waiting to resolve this issue.

kushmpatel avatar Apr 06 '17 13:04 kushmpatel

The problem is that I haven't still been able to reproduce this issue.

roughike avatar Apr 06 '17 17:04 roughike

@roughike I reproduce that issue navigating between different buttons with badges in some of these

marcserrascmspain avatar Apr 07 '17 07:04 marcserrascmspain

@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 avatar Apr 07 '17 07:04 kushmpatel

@kushmpatel no need, it repros very simple let me talk to roughike about it.

yombunker avatar Apr 07 '17 07:04 yombunker

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));

marcserrascmspain avatar Apr 07 '17 07:04 marcserrascmspain

@yombunker @roughike Did you find any issue related to this badge cut? Found any solution for this?

ankitashah7791 avatar Apr 26 '17 06:04 ankitashah7791

@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 avatar Apr 28 '17 09:04 kushmpatel

@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.

yombunker avatar Apr 28 '17 14:04 yombunker

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"/>

screen shot 2017-05-10 at 20 50 26

chihung93 avatar May 10 '17 13:05 chihung93

@trihung93 Temporary you can use app:bb_behavior="shy | iconsOnly" to resolve this problem.

kushmpatel avatar May 11 '17 06:05 kushmpatel

Is it going to be resolved in the short term? The issue is from 2 month ago :(

marcserrascmspain avatar May 11 '17 07:05 marcserrascmspain

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 avatar May 12 '17 13:05 xvarlez

@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.

yombunker avatar May 12 '17 13:05 yombunker

Release?

shuhart avatar Jul 17 '17 12:07 shuhart

Any updates on this guys? Release date estimation? This would be really useful.

thiagoferreirap avatar Aug 08 '17 08:08 thiagoferreirap

200w_d 1

marcserrascmspain avatar Oct 23 '17 07:10 marcserrascmspain