diff --git a/CHANGELOG.md b/CHANGELOG.md
index 58e76fd3..3d862792 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
## Changelog
-### Newest version: 2.1.0
+### Newest version: 2.2.0
+* Update libraries versions
+* Add another state for titles: `SHOW_WHEN_ACTIVE_FORCE` (PR #313)
+
+### 2.1.0
* Update libraries versions
* Add enable/disable tab state (with custom color)
diff --git a/README.md b/README.md
index e4ecae74..14ca38b3 100644
--- a/README.md
+++ b/README.md
@@ -5,14 +5,9 @@ Library to implement the Bottom Navigation component from Material Design guidel
## Demo
-## What's new (2.1.0) - [Changelog](https://github.com/aurelhubert/ahbottomnavigation/blob/master/CHANGELOG.md)
+## What's new (2.2.0) - [Changelog](https://github.com/aurelhubert/ahbottomnavigation/blob/master/CHANGELOG.md)
* Update libraries versions
-* Add enable/disable tab state (with custom color)
-* Add new xml attributes (`colored`, `accentColor`, `inactiveColor`, `disableColor`, `coloredActive`, `coloredInactive`)
-* Add param `notificationAnimationDuration`
-* Update getDrawable method with `AppCompatResources.getDrawable(context, drawableRes);`
-If you use drawable selector and target API < 21, don't forget to add this:
-`AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
`
+* Add another state for titles: `SHOW_WHEN_ACTIVE_FORCE` (PR #313)
## Features
* Follow the bottom navigation guidelines (https://www.google.com/design/spec/components/bottom-navigation.html)
@@ -28,7 +23,7 @@ If you use drawable selector and target API < 21, don't forget to add this:
### Gradle
```groovy
dependencies {
- compile 'com.aurelhubert:ahbottomnavigation:2.1.0'
+ compile 'com.aurelhubert:ahbottomnavigation:2.2.0'
}
```
### XML
@@ -153,7 +148,7 @@ Feel free to create issues / pull requests.
## License
```
AHBottomNavigation library for Android
-Copyright (c) 2017 Aurelien Hubert (http://github.com/aurelhubert).
+Copyright (c) 2018 Aurelien Hubert (http://github.com/aurelhubert).
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/ahbottomnavigation/build.gradle b/ahbottomnavigation/build.gradle
index b41b2f28..ad494790 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 = '2.1.0'
+ libraryVersion = '2.2.0'
developerId = 'aurelhubert'
developerName = 'Aurelien Hubert'
@@ -31,8 +31,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
- versionCode 40
- versionName "2.1.0"
+ versionCode 41
+ versionName "2.2.0"
}
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 91e362e6..6adfc9f7 100644
--- a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java
+++ b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java
@@ -242,8 +242,7 @@ private void init(Context context, AttributeSet attrs) {
notificationAnimationDuration = 150;
ViewCompat.setElevation(this, resources.getDimension(R.dimen.bottom_navigation_elevation));
- setClipToPadding(false);
-
+
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, bottomNavigationHeight);
setLayoutParams(params);
@@ -262,6 +261,7 @@ private void createItems() {
int layoutHeight = (int) resources.getDimension(R.dimen.bottom_navigation_height);
removeAllViews();
+
views.clear();
backgroundColorView = new View(context);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
@@ -280,7 +280,7 @@ private void createItems() {
if (titleState != TitleState.ALWAYS_HIDE &&
titleState != TitleState.SHOW_WHEN_ACTIVE_FORCE &&
- (items.size() == MIN_ITEMS || titleState == TitleState.ALWAYS_SHOW)) {
+ (items.size() >= MIN_ITEMS || titleState == TitleState.ALWAYS_SHOW)) {
createClassicItems(linearLayoutContainer);
} else {
createSmallItems(linearLayoutContainer);
@@ -469,10 +469,13 @@ public void onClick(View v) {
current ? itemActiveColor : itemInactiveColor, forceTint));
title.setTextColor(current ? itemActiveColor : itemInactiveColor);
view.setSoundEffectsEnabled(soundEffectsEnabled);
+ view.setEnabled(true);
} else {
icon.setImageDrawable(AHHelper.getTintDrawable(items.get(i).getDrawable(context),
itemDisableColor, forceTint));
title.setTextColor(itemDisableColor);
+ view.setClickable(true);
+ view.setEnabled(false);
}
LayoutParams params = new LayoutParams((int) itemWidth, (int) height);
@@ -593,11 +596,14 @@ public void onClick(View v) {
}
});
view.setSoundEffectsEnabled(soundEffectsEnabled);
+ view.setEnabled(true);
} else {
icon.setImageDrawable(AHHelper.getTintDrawable(items.get(i).getDrawable(context),
itemDisableColor, forceTint));
title.setTextColor(itemDisableColor);
title.setAlpha(0);
+ view.setClickable(true);
+ view.setEnabled(false);
}
int width = i == currentItem ? (int) selectedItemWidth :
diff --git a/build.gradle b/build.gradle
index 6a772838..2e8fb1fc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,11 +3,12 @@
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
+ classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
+ classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}