From fa5702b193c3754b59f8f1410a95fe8ea33029f5 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 24 Jun 2016 19:46:40 +0800 Subject: [PATCH 1/2] Ability to use custom selected color in shift mode --- .../main/java/com/roughike/bottombar/BottomBar.java | 10 +++++++++- 1 file changed, 9 insertions(+), 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 c29ec368..0d6134ac 100644 --- a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java +++ b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java @@ -130,6 +130,7 @@ public class BottomBar extends RelativeLayout implements View.OnClickListener, V private boolean mShouldUpdateFragmentInitially; private int mMaxFixedTabCount = 3; + private boolean mForceUseCustomActiveColor = false; /** * Bind the BottomBar to your Activity, and inflate your layout here. @@ -614,6 +615,13 @@ public void useDarkTheme() { mIsDarkTheme = true; } + /** + * Always use custom color for selected tab + */ + public void forceUseCustomColor() { + mForceUseCustomActiveColor = true; + } + /** * Ignore the automatic Night Mode detection and use a light theme by default, * even if the Night Mode is on. @@ -1398,7 +1406,7 @@ private void selectTab(View tab, boolean animate) { int tabPosition = findItemPosition(tab); - if (!mIsShiftingMode || mIsTabletMode) { + if (mForceUseCustomActiveColor || (!mIsShiftingMode || mIsTabletMode)) { int activeColor = mCustomActiveTabColor != 0 ? mCustomActiveTabColor : mPrimaryColor; icon.setColorFilter(activeColor); From 03b3bc4a79eee7510f72c8006f87f0034113cec8 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 24 Jun 2016 19:46:40 +0800 Subject: [PATCH 2/2] Ability to use custom selected color in shift mode --- 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 0d6134ac..a55d75f0 100644 --- a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java +++ b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java @@ -1471,7 +1471,7 @@ private void unselectTab(View tab, boolean animate) { ImageView icon = (ImageView) tab.findViewById(R.id.bb_bottom_bar_icon); TextView title = (TextView) tab.findViewById(R.id.bb_bottom_bar_title); - if (!mIsShiftingMode || mIsTabletMode) { + if (mForceUseCustomActiveColor || !mIsShiftingMode || mIsTabletMode) { int inActiveColor = mIsDarkTheme ? mWhiteColor : mInActiveColor; icon.setColorFilter(inActiveColor);