Skip to content

Commit

Permalink
-Add way to change bar programmatically without triggering listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
narfman0 committed Feb 24, 2017
1 parent 338ee86 commit d004792
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ public void selectTabAtPosition(int position) {
* @param animate should the tab change be animated or not.
*/
public void selectTabAtPosition(int position, boolean animate) {
selectTabAtPosition(position, animate, true);
}

public void selectTabAtPosition(int position, boolean animate, boolean triggerListeners) {
if (position > getTabCount() - 1 || position < 0) {
throw new IndexOutOfBoundsException("Can't select tab at position " +
position + ". This BottomBar has no items at that position.");
Expand All @@ -443,7 +447,11 @@ public void selectTabAtPosition(int position, boolean animate) {
oldTab.deselect(animate);
newTab.select(animate);

updateSelectedTab(position);
if(triggerListeners)
updateSelectedTab(position);
else
currentTabPosition = position;

shiftingMagic(oldTab, newTab, animate);
handleBackgroundColorChange(newTab, animate);
}
Expand Down

0 comments on commit d004792

Please sign in to comment.