diff options
author | Aurelien Hubert <aurel.hubert@gmail.com> | 2016-04-20 16:09:16 +0200 |
---|---|---|
committer | Aurelien Hubert <aurel.hubert@gmail.com> | 2016-04-20 16:09:16 +0200 |
commit | 7123dd87b90e3cd9af7ccf95d0300c030015861d (patch) | |
tree | 282f3ceabd38cca1879cbb07a8ebfe6c9b4cebc5 | |
parent | c748ec7311b3907f5b8ea6eaf2a5eb47a0004039 (diff) | |
download | android_external_ahbottomnavigation-7123dd87b90e3cd9af7ccf95d0300c030015861d.tar.gz android_external_ahbottomnavigation-7123dd87b90e3cd9af7ccf95d0300c030015861d.tar.bz2 android_external_ahbottomnavigation-7123dd87b90e3cd9af7ccf95d0300c030015861d.zip |
Fixed Snackbar when setBehaviorTranslationEnabled(false)
4 files changed, 16 insertions, 9 deletions
@@ -5,9 +5,8 @@ Library to implement the Bottom Navigation component from Material Design guidel ## Demo <img src="https://raw.githubusercontent.com/aurelhubert/ahbottomnavigation/master/demo1.gif" width="208" height="368" /> <img src="https://raw.githubusercontent.com/aurelhubert/ahbottomnavigation/master/demo2.gif" width="208" height="368" /> <img src="https://raw.githubusercontent.com/aurelhubert/ahbottomnavigation/master/demo3.gif" width="208" height="368" /> <img src="https://raw.githubusercontent.com/aurelhubert/ahbottomnavigation/master/demo4.gif" width="208" height="368" /> -## What's new (1.1.2) -* Fixed animations on pre Kit Kat -* Added an example with Vector Drawable +## What's new (1.1.3) +* Fixed Snackbar when setBehaviorTranslationEnabled(false) ## Features * Follow the bottom navigation guidelines (https://www.google.com/design/spec/components/bottom-navigation.html) @@ -22,7 +21,7 @@ Library to implement the Bottom Navigation component from Material Design guidel ### Gradle ```groovy dependencies { - compile 'com.aurelhubert:ahbottomnavigation:1.1.2' + compile 'com.aurelhubert:ahbottomnavigation:1.1.3' } ``` ### XML diff --git a/ahbottomnavigation/build.gradle b/ahbottomnavigation/build.gradle index 0d78d90..9b8fe0b 100644 --- a/ahbottomnavigation/build.gradle +++ b/ahbottomnavigation/build.gradle @@ -13,7 +13,7 @@ ext { siteUrl = 'https://github.com/aurelhubert/ahbottomnavigation' gitUrl = 'https://github.com/aurelhubert/ahbottomnavigation.git' - libraryVersion = '1.1.2' + libraryVersion = '1.1.3' developerId = 'aurelhubert' developerName = 'Aurelien Hubert' @@ -31,8 +31,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 - versionCode 19 - versionName "1.1.2" + versionCode 20 + versionName "1.1.3" } buildTypes { release { diff --git a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java index 81a9214..20e2fc6 100644 --- a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java +++ b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java @@ -825,8 +825,7 @@ public class AHBottomNavigation extends FrameLayout { this.behaviorTranslationEnabled = behaviorTranslationEnabled; if (getParent() instanceof CoordinatorLayout) { ViewGroup.LayoutParams params = getLayoutParams(); - bottomNavigationBehavior = behaviorTranslationEnabled ? - new AHBottomNavigationBehavior<AHBottomNavigation>() : null; + bottomNavigationBehavior = new AHBottomNavigationBehavior<>(behaviorTranslationEnabled); ((CoordinatorLayout.LayoutParams) params).setBehavior(bottomNavigationBehavior); } } diff --git a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigationBehavior.java b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigationBehavior.java index 62515c3..274e69a 100644 --- a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigationBehavior.java +++ b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigationBehavior.java @@ -37,11 +37,17 @@ public class AHBottomNavigationBehavior<V extends View> extends VerticalScrollin private int mSnackbarHeight = -1; private boolean fabBottomMarginInitialized = false; private float targetOffset = 0, fabTargetOffset = 0, fabDefaultBottomMargin = 0, snackBarY = 0; + private boolean behaviorTranslationEnabled = true; public AHBottomNavigationBehavior() { super(); } + public AHBottomNavigationBehavior(boolean behaviorTranslationEnabled) { + super(); + this.behaviorTranslationEnabled = behaviorTranslationEnabled; + } + public AHBottomNavigationBehavior(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AHBottomNavigationBehavior_Params); @@ -113,6 +119,9 @@ public class AHBottomNavigationBehavior<V extends View> extends VerticalScrollin * @param offset */ private void animateOffset(final V child, final int offset) { + if (!behaviorTranslationEnabled) { + return; + } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { ensureOrCancelObjectAnimation(child, offset); translationObjectAnimator.start(); |