Skip to content

Commit

Permalink
Fix selection/unselection when using badges
Browse files Browse the repository at this point in the history
When using badges, an extra FrameLayout is inserted as the container
for each tab. This container inherits the tag of the pre-badge tab view,
but the tag is not reset on the pre-badge tab view. This causes selection
and unselection of tabs to fail because findViewWithTag will erroneously
find the now obsolete tab views when searching for active tabs, resulting
in multiple tabs being visually selected when changing tabs.

By clearing the tag of the old (now inner) view when putting it in the new
tab container, we can ensure that findViewWithTag will only find relevant
views.

This fixes roughike#266.
  • Loading branch information
henhal committed Jun 2, 2016
1 parent 24c1ac6 commit e3f2e9e
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ protected BottomBarBadge(Context context, int position, final View tabToAddTo, /
parent.removeView(tabToAddTo);

container.setTag(tabToAddTo.getTag());
tabToAddTo.setTag(null);
container.addView(tabToAddTo);
container.addView(this);

Expand Down

0 comments on commit e3f2e9e

Please sign in to comment.