Skip to content
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
29 changes: 26 additions & 3 deletions bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class BottomBar extends RelativeLayout implements View.OnClickListener, V

private Integer mPrimaryColor;
private Integer mInActiveColor;
private Integer mInActiveTextColor;
private Integer mDarkBackgroundColor;
private Integer mWhiteColor;
private float mTabAlpha = 0.6f;
Expand Down Expand Up @@ -690,6 +691,23 @@ public void setFixedInactiveIconColor(int iconColor) {
}
}

/**
* Set a custom color for inactive text in fixed mode.
* <p/>
* NOTE: This value is ignored if not in fixed mode.
*
* @param textColor a hex color used for icons, such as 0xFF00FF00.
*/
public void setFixedInactiveTextColor(int textColor) {
mInActiveTextColor = textColor;

if (mItems != null && mItems.length > 0) {
throw new UnsupportedOperationException("This BottomBar " +
"already has items! You must call setFixedInactiveTextColor() " +
"before setting any items.");
}
}

/**
* Set a custom color for icons in shifting mode.
* <p/>
Expand Down Expand Up @@ -1552,11 +1570,16 @@ private void unselectTab(View tab, boolean animate) {
TextView title = (TextView) tab.findViewById(R.id.bb_bottom_bar_title);

if (!mIsShiftingMode || mIsTabletMode) {
int inActiveColor = mIsDarkTheme ? mWhiteColor : mInActiveColor;
icon.setColorFilter(inActiveColor);
Integer inActiveColor = mIsDarkTheme ? mWhiteColor : mInActiveColor;
if (inActiveColor == null) {
icon.clearColorFilter();
} else {
icon.setColorFilter(inActiveColor);
}

if (title != null) {
title.setTextColor(inActiveColor);
int inActiveTextColor = mInActiveTextColor == null ? inActiveColor : mInActiveTextColor;
title.setTextColor(inActiveTextColor);
}
}

Expand Down