diff --git a/README.md b/README.md
index 567a2ee..2a3a616 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ The ActionItemBadge Library is pushed to [Maven Central], so you just need to ad
```javascript
dependencies {
- compile('com.mikepenz:actionitembadge:3.1.7@aar') {
+ compile('com.mikepenz:actionitembadge:3.1.8@aar') {
transitive = true
}
}
diff --git a/app/build.gradle b/app/build.gradle
index 69c3bd5..e368606 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,8 +8,8 @@ android {
applicationId "com.mikepenz.actionitembadge.sample"
minSdkVersion 14
targetSdkVersion 23
- versionCode 317
- versionName "3.1.7"
+ versionCode 318
+ versionName "3.1.8"
}
buildTypes {
release {
diff --git a/gradle.properties b/gradle.properties
index c0fc793..8b61fde 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,8 +17,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
-VERSION_NAME=3.1.7
-VERSION_CODE=317
+VERSION_NAME=3.1.8
+VERSION_CODE=318
GROUP=com.mikepenz
POM_DESCRIPTION=Android-ActionItemBadge Library
diff --git a/library/build.gradle b/library/build.gradle
index 550350b..88bb2f8 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
- versionCode 317
- versionName "3.1.7"
+ versionCode 318
+ versionName "3.1.8"
}
buildTypes {
release {
diff --git a/library/src/main/java/com/mikepenz/actionitembadge/library/ActionItemBadge.java b/library/src/main/java/com/mikepenz/actionitembadge/library/ActionItemBadge.java
index a9b4035..cd57e5a 100644
--- a/library/src/main/java/com/mikepenz/actionitembadge/library/ActionItemBadge.java
+++ b/library/src/main/java/com/mikepenz/actionitembadge/library/ActionItemBadge.java
@@ -151,6 +151,20 @@ public static void update(final Activity activity, final MenuItem menu, Drawable
* @param badgeCount
*/
public static void update(final Activity activity, final MenuItem menu, Drawable icon, BadgeStyle style, String badgeCount) {
+ update(activity, menu, icon, style, badgeCount, null);
+ }
+
+ /**
+ * update the given menu item with icon, badgeCount and style
+ *
+ * @param activity use to bind onOptionsItemSelected / and to display the toast
+ * @param menu
+ * @param icon
+ * @param style
+ * @param badgeCount
+ * @param listener
+ */
+ public static void update(final Activity activity, final MenuItem menu, Drawable icon, BadgeStyle style, String badgeCount, final ActionItemBadgeListener listener) {
if (menu == null) return;
FrameLayout badge;
@@ -176,7 +190,13 @@ public static void update(final Activity activity, final MenuItem menu, Drawable
badge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- activity.onOptionsItemSelected(menu);
+ boolean consumed = false;
+ if (listener != null) {
+ consumed = listener.onOptionsItemSelected(menu);
+ }
+ if (!consumed) {
+ activity.onOptionsItemSelected(menu);
+ }
}
});
@@ -221,4 +241,9 @@ public boolean onLongClick(View v) {
public static void hide(MenuItem menu) {
menu.setVisible(false);
}
+
+
+ public interface ActionItemBadgeListener {
+ boolean onOptionsItemSelected(MenuItem menu);
+ }
}
diff --git a/library/src/main/res/values/aboutlibraries.xml b/library/src/main/res/values/aboutlibraries.xml
index 3ef308e..56bf81b 100644
--- a/library/src/main/res/values/aboutlibraries.xml
+++ b/library/src/main/res/values/aboutlibraries.xml
@@ -9,7 +9,7 @@
Android-ActionItemBadge is a library which offers a simple and easy to use method to add a badge to your action item!!
]]>
- 3.1.7
+ 3.1.8
https://github.com/mikepenz/Android-ActionItemBadge
apache_2_0
true