diff options
author | Aurelien Hubert <aurel.hubert@gmail.com> | 2016-05-18 14:48:14 +0200 |
---|---|---|
committer | Aurelien Hubert <aurel.hubert@gmail.com> | 2016-05-18 14:48:14 +0200 |
commit | af3226da03cb84d6ad49299e07f50fc5ab533ebf (patch) | |
tree | 7f2ac179e3154ea0e2f3b628b06c99109f546a38 | |
parent | 02abd87fb555353331a0220b3de3061901d4e7a4 (diff) | |
download | android_external_ahbottomnavigation-af3226da03cb84d6ad49299e07f50fc5ab533ebf.tar.gz android_external_ahbottomnavigation-af3226da03cb84d6ad49299e07f50fc5ab533ebf.tar.bz2 android_external_ahbottomnavigation-af3226da03cb84d6ad49299e07f50fc5ab533ebf.zip |
Fixed bug when switching between normal and colored mode
-rw-r--r-- | ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java index 8cbf821..238ab0f 100644 --- a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java +++ b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java @@ -74,6 +74,7 @@ public class AHBottomNavigation extends FrameLayout { //private int accentColor = Color.WHITE; //private int inactiveColor = Color.WHITE; private @ColorInt int itemActiveColor, itemInactiveColor; + private @ColorInt int titleColorActive, titleColorInactive; private @ColorInt int coloredTitleColorActive, coloredTitleColorInactive; private float titleActiveTextSize, titleInactiveTextSize; private int bottomNavigationHeight; @@ -159,12 +160,15 @@ public class AHBottomNavigation extends FrameLayout { bottomNavigationHeight = (int) resources.getDimension(R.dimen.bottom_navigation_height); // Item colors - itemActiveColor = ContextCompat.getColor(context, R.color.colorBottomNavigationAccent); - itemInactiveColor = ContextCompat.getColor(context, R.color.colorBottomNavigationInactive); + titleColorActive = ContextCompat.getColor(context, R.color.colorBottomNavigationAccent); + titleColorInactive = ContextCompat.getColor(context, R.color.colorBottomNavigationInactive); // Colors for colored bottom navigation coloredTitleColorActive = ContextCompat.getColor(context, R.color.colorBottomNavigationActiveColored); coloredTitleColorInactive = ContextCompat.getColor(context, R.color.colorBottomNavigationInactiveColored); + itemActiveColor = titleColorActive; + itemInactiveColor = titleColorInactive; + // Notifications notificationActiveMarginLeft = (int) resources.getDimension(R.dimen.bottom_navigation_notification_margin_left_active); notificationInactiveMarginLeft = (int) resources.getDimension(R.dimen.bottom_navigation_notification_margin_left); @@ -803,8 +807,8 @@ public class AHBottomNavigation extends FrameLayout { */ public void setColored(boolean colored) { this.colored = colored; - this.itemActiveColor = colored ? coloredTitleColorActive : itemActiveColor; - this.itemInactiveColor = colored ? coloredTitleColorInactive : itemInactiveColor; + this.itemActiveColor = colored ? coloredTitleColorActive : titleColorActive; + this.itemInactiveColor = colored ? coloredTitleColorInactive : titleColorInactive; createItems(); } @@ -842,6 +846,7 @@ public class AHBottomNavigation extends FrameLayout { * @param accentColor The new accent color */ public void setAccentColor(int accentColor) { + this.titleColorActive = accentColor; this.itemActiveColor = accentColor; createItems(); } @@ -861,6 +866,7 @@ public class AHBottomNavigation extends FrameLayout { * @param inactiveColor The inactive color */ public void setInactiveColor(int inactiveColor) { + this.titleColorInactive = inactiveColor; this.itemInactiveColor = inactiveColor; createItems(); } |