Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add way to change bar programmatically without triggering listeners #652

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -469,6 +469,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 @@ -480,7 +484,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