aboutsummaryrefslogtreecommitdiffstats
path: root/ahbottomnavigation/src/main/java/com/aurelhubert
diff options
context:
space:
mode:
authorFlavius Popescu <flavius.popescu@gmail.com>2016-06-06 23:26:05 -0700
committerJoey Rizzoli <joey@cyanogenmoditalia.it>2016-06-09 22:52:18 +0200
commitba9690791781cf05ef60d2b3476b8d7e2174508c (patch)
tree2c3f8033652bc32a506d4df2c587e1dbb0c51183 /ahbottomnavigation/src/main/java/com/aurelhubert
parent27452512ef7ed375690e8ce3e949c97a3f4c732c (diff)
downloadandroid_external_ahbottomnavigation-ba9690791781cf05ef60d2b3476b8d7e2174508c.tar.gz
android_external_ahbottomnavigation-ba9690791781cf05ef60d2b3476b8d7e2174508c.tar.bz2
android_external_ahbottomnavigation-ba9690791781cf05ef60d2b3476b8d7e2174508c.zip
Notification animates margin top in order to stick to the tab icon
Diffstat (limited to 'ahbottomnavigation/src/main/java/com/aurelhubert')
-rw-r--r--ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java
index 7603937..4181cae 100644
--- a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java
+++ b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java
@@ -89,6 +89,7 @@ public class AHBottomNavigation extends FrameLayout {
private Drawable notificationBackgroundDrawable;
private Typeface notificationTypeface;
private int notificationActiveMarginLeft, notificationInactiveMarginLeft;
+ private int notificationActiveMarginTop, notificationInactiveMarginTop;
/**
* Constructors
@@ -173,6 +174,8 @@ public class AHBottomNavigation extends FrameLayout {
// Notifications
notificationActiveMarginLeft = (int) resources.getDimension(R.dimen.bottom_navigation_notification_margin_left_active);
notificationInactiveMarginLeft = (int) resources.getDimension(R.dimen.bottom_navigation_notification_margin_left);
+ notificationActiveMarginTop = (int) resources.getDimension(R.dimen.bottom_navigation_notification_margin_top_active);
+ notificationInactiveMarginTop = (int) resources.getDimension(R.dimen.bottom_navigation_notification_margin_top);
ViewCompat.setElevation(this, resources.getDimension(R.dimen.bottom_navigation_elevation));
setClipToPadding(false);
@@ -402,7 +405,7 @@ public class AHBottomNavigation extends FrameLayout {
ViewGroup.MarginLayoutParams paramsNotification = (ViewGroup.MarginLayoutParams)
notification.getLayoutParams();
- paramsNotification.setMargins(notificationActiveMarginLeft, paramsNotification.topMargin,
+ paramsNotification.setMargins(notificationActiveMarginLeft, notificationActiveMarginTop,
paramsNotification.rightMargin, paramsNotification.bottomMargin);
view.requestLayout();
@@ -411,7 +414,7 @@ public class AHBottomNavigation extends FrameLayout {
icon.setSelected(false);
ViewGroup.MarginLayoutParams paramsNotification = (ViewGroup.MarginLayoutParams)
notification.getLayoutParams();
- paramsNotification.setMargins(notificationInactiveMarginLeft, paramsNotification.topMargin,
+ paramsNotification.setMargins(notificationInactiveMarginLeft, notificationInactiveMarginTop,
paramsNotification.rightMargin, paramsNotification.bottomMargin);
}
@@ -591,6 +594,7 @@ public class AHBottomNavigation extends FrameLayout {
icon.setSelected(true);
AHHelper.updateTopMargin(icon, inactiveMargin, activeMarginTop);
AHHelper.updateLeftMargin(notification, notificationInactiveMarginLeft, notificationActiveMarginLeft);
+ AHHelper.updateTopMargin(notification, notificationInactiveMarginTop, notificationActiveMarginTop);
AHHelper.updateTextColor(title, itemInactiveColor, itemActiveColor);
AHHelper.updateAlpha(title, 0, 1);
AHHelper.updateWidth(container, notSelectedItemWidth, selectedItemWidth);
@@ -649,6 +653,7 @@ public class AHBottomNavigation extends FrameLayout {
icon.setSelected(false);
AHHelper.updateTopMargin(icon, activeMarginTop, inactiveMargin);
AHHelper.updateLeftMargin(notification, notificationActiveMarginLeft, notificationInactiveMarginLeft);
+ AHHelper.updateTopMargin(notification, notificationActiveMarginTop, notificationInactiveMarginTop);
AHHelper.updateTextColor(title, itemActiveColor, itemInactiveColor);
AHHelper.updateAlpha(title, 1, 0);
AHHelper.updateWidth(container, selectedItemWidth, notSelectedItemWidth);