Skip to content
Open
Show file tree
Hide file tree
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
30 changes: 28 additions & 2 deletions bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,27 @@ public void selectTabAtPosition(int position, boolean animate) {
shiftingMagic(oldTab, newTab, animate);
}

/**
* Unselect a tab at the specified position.
*
* @param position the position to unselect.
*/
public void unselectTabAtPosition(int position, boolean animate) {
if (mItems == null || mItems.length == 0) {
throw new UnsupportedOperationException("Can't select tab at " +
"position " + position + ". This BottomBar has no items set yet.");
} else if (position > mItems.length - 1 || position < 0) {
throw new IndexOutOfBoundsException("Can't select tab at position " +
position + ". This BottomBar has no items at that position.");
}

View tab = mItemContainer.getChildAt(position);

unselectTab(tab, animate);

updateSelectedTab(position);
}

/**
* Sets the default tab for this BottomBar that is shown until the user changes
* the selection.
Expand Down Expand Up @@ -1067,10 +1088,15 @@ private void handleClick(View v) {
if (v.getTag().equals(TAG_BOTTOM_BAR_VIEW_INACTIVE)) {
View oldTab = findViewWithTag(TAG_BOTTOM_BAR_VIEW_ACTIVE);

unselectTab(oldTab, true);
if (oldTab != null) {
unselectTab(oldTab, true);
}

selectTab(v, true);

shiftingMagic(oldTab, v, true);
if (oldTab != null) {
shiftingMagic(oldTab, v, true);
}
}
updateSelectedTab(findItemPosition(v));
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

Expand Down