From 375aad8ea34cc05c5837114f5981d4424be5c30f Mon Sep 17 00:00:00 2001 From: Aurelien Hubert Date: Mon, 25 Apr 2016 15:37:47 +0200 Subject: Added getItem(int position) Added refresh() --- CHANGELOG.md | 7 ++++++- README.md | 10 ++++------ ahbottomnavigation/build.gradle | 6 +++--- .../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` diff --git a/README.md b/README.md index 4e425df..39a0169 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,10 @@ Library to implement the Bottom Navigation component from Material Design guidel ## Demo -## 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 @@ -768,6 +768,13 @@ public class AHBottomNavigation extends FrameLayout { createItems(); } + /** + * Refresh the AHBottomView + */ + public void refresh() { + createItems(); + } + /** * Return the number of items * @@ -792,7 +799,6 @@ public class AHBottomNavigation extends FrameLayout { createItems(); } - /** * Return the bottom navigation background color * @@ -860,6 +866,19 @@ public class AHBottomNavigation extends FrameLayout { createItems(); } + /** + * 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 * @@ -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) { -- cgit v1.2.3