diff options
author | Aurelien Hubert <aurel.hubert@gmail.com> | 2016-04-25 15:37:47 +0200 |
---|---|---|
committer | Aurelien Hubert <aurel.hubert@gmail.com> | 2016-04-25 15:37:47 +0200 |
commit | 375aad8ea34cc05c5837114f5981d4424be5c30f (patch) | |
tree | 345a9788d36cf3b27a87535f193281601d6dbcb2 | |
parent | 9e027e823caa29c491912048a842c442ab03da96 (diff) | |
download | android_external_ahbottomnavigation-375aad8ea34cc05c5837114f5981d4424be5c30f.tar.gz android_external_ahbottomnavigation-375aad8ea34cc05c5837114f5981d4424be5c30f.tar.bz2 android_external_ahbottomnavigation-375aad8ea34cc05c5837114f5981d4424be5c30f.zip |
Added getItem(int position)
Added refresh()
-rw-r--r-- | CHANGELOG.md | 7 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | ahbottomnavigation/build.gradle | 6 | ||||
-rw-r--r-- | ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java | 23 |
4 files changed, 34 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a2c8d11..9d08c89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ ## Changelog -### Newest version: 1.1.6 +### Newest version: 1.1.7 + +* Added `public AHBottomNavigationItem getItem(int position)` to get a specific item +* Added `public void refresh()` to force a UI refresh + +### 1.1.6 * Improved `hideBottomNavigation()` and `restoreBottomNavigation()` * Added `setTitleTypeface` @@ -5,12 +5,10 @@ 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.6) - [Changelog](https://github.com/aurelhubert/ahbottomnavigation/blob/master/CHANGELOG.md) +## What's new (1.1.7) - [Changelog](https://github.com/aurelhubert/ahbottomnavigation/blob/master/CHANGELOG.md) -* Improved `hideBottomNavigation()` and `restoreBottomNavigation()` -* Added `setTitleTypeface` -* Changed method name `setNotificationBackgroundColorResource` by `setNotificationTypeface` -* Started working on `onSaveInstanceState` and `onRestoreInstanceState` (currentItem & notifications for now) +* Added `public AHBottomNavigationItem getItem(int position)` to get a specific item +* Added `public void refresh()` to force a UI refresh ## Features * Follow the bottom navigation guidelines (https://www.google.com/design/spec/components/bottom-navigation.html) @@ -25,7 +23,7 @@ Library to implement the Bottom Navigation component from Material Design guidel ### Gradle ```groovy dependencies { - compile 'com.aurelhubert:ahbottomnavigation:1.1.6' + compile 'com.aurelhubert:ahbottomnavigation:1.1.7' } ``` ### XML diff --git a/ahbottomnavigation/build.gradle b/ahbottomnavigation/build.gradle index e111ce4..00463a1 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.6' + libraryVersion = '1.1.7' developerId = 'aurelhubert' developerName = 'Aurelien Hubert' @@ -31,8 +31,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 - versionCode 23 - versionName "1.1.6" + versionCode 24 + versionName "1.1.7" } 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 8dbde92..02b735f 100644 --- a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java +++ b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java @@ -769,6 +769,13 @@ public class AHBottomNavigation extends FrameLayout { } /** + * Refresh the AHBottomView + */ + public void refresh() { + createItems(); + } + + /** * Return the number of items * * @return int @@ -792,7 +799,6 @@ public class AHBottomNavigation extends FrameLayout { createItems(); } - /** * Return the bottom navigation background color * @@ -861,6 +867,19 @@ public class AHBottomNavigation extends FrameLayout { } /** + * Get item at the given index + * + * @param position int: item position + * @return The item at the given position + */ + public AHBottomNavigationItem getItem(int position) { + if (position < 0 || position > items.size() - 1) { + Log.w(TAG, "The position is out of bounds of the items (" + items.size() + " elements)"); + } + return items.get(position); + } + + /** * Get the current item * * @return The current item position @@ -881,7 +900,7 @@ public class AHBottomNavigation extends FrameLayout { /** * Set the current item * - * @param position int: item + * @param position int: item position * @param useCallback boolean: use or not the callback */ public void setCurrentItem(int position, boolean useCallback) { |