From 9c059f5ec45e90985992b11a3fc5f1c4d04f354b Mon Sep 17 00:00:00 2001 From: Kyle Xie Date: Thu, 14 Jul 2016 20:39:03 +0800 Subject: [PATCH 1/2] give us a chance to use the original image as the icon, instead of always use a filter color --- .../com/roughike/bottombar/BottomBar.java | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java index 49c981df..e613ebf6 100644 --- a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java +++ b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java @@ -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; @@ -690,6 +691,23 @@ public void setFixedInactiveIconColor(int iconColor) { } } + /** + * Set a custom color for inactive text in fixed mode. + *

+ * 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 setFixedInactiveIconColor() " + + "before setting any items."); + } + } + /** * Set a custom color for icons in shifting mode. *

@@ -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); } } From bfa12fed654fbbd4767b6a066a3e103d5a0b4b73 Mon Sep 17 00:00:00 2001 From: Kyle Xie Date: Thu, 14 Jul 2016 20:42:28 +0800 Subject: [PATCH 2/2] fixed typo --- bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java index e613ebf6..bbd0da0b 100644 --- a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java +++ b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java @@ -703,7 +703,7 @@ public void setFixedInactiveTextColor(int textColor) { if (mItems != null && mItems.length > 0) { throw new UnsupportedOperationException("This BottomBar " + - "already has items! You must call setFixedInactiveIconColor() " + + "already has items! You must call setFixedInactiveTextColor() " + "before setting any items."); } }