aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Hubert <aurel.hubert@gmail.com>2016-04-20 16:09:16 +0200
committerAurelien Hubert <aurel.hubert@gmail.com>2016-04-20 16:09:16 +0200
commit7123dd87b90e3cd9af7ccf95d0300c030015861d (patch)
tree282f3ceabd38cca1879cbb07a8ebfe6c9b4cebc5
parentc748ec7311b3907f5b8ea6eaf2a5eb47a0004039 (diff)
downloadandroid_external_ahbottomnavigation-7123dd87b90e3cd9af7ccf95d0300c030015861d.tar.gz
android_external_ahbottomnavigation-7123dd87b90e3cd9af7ccf95d0300c030015861d.tar.bz2
android_external_ahbottomnavigation-7123dd87b90e3cd9af7ccf95d0300c030015861d.zip
Fixed Snackbar when setBehaviorTranslationEnabled(false)
-rw-r--r--README.md7
-rw-r--r--ahbottomnavigation/build.gradle6
-rw-r--r--ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java3
-rw-r--r--ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigationBehavior.java9
4 files changed, 16 insertions, 9 deletions
diff --git a/README.md b/README.md
index 4d30e4f..a4c1bbd 100644
--- a/README.md
+++ b/README.md
@@ -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();