Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ 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 (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)
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions ahbottomnavigation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -31,8 +31,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 40
versionName "2.1.0"
versionCode 41
versionName "2.2.0"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 :
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down