Skip to content

Commit

Permalink
Merge branch 'release/v3.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Nov 16, 2015
2 parents b5e61e1 + c118d97 commit 8d62313
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 317
versionName "3.1.7"
versionCode 318
versionName "3.1.8"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}
});

Expand Down Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion library/src/main/res/values/aboutlibraries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Android-<b>ActionItemBadge</b> is a library which offers a simple and easy to use method to add a badge to your action item!!
]]>
</string>
<string name="library_AndroidActionItemBadge_libraryVersion">3.1.7</string>
<string name="library_AndroidActionItemBadge_libraryVersion">3.1.8</string>
<string name="library_AndroidActionItemBadge_libraryWebsite">https://github.com/mikepenz/Android-ActionItemBadge</string>
<string name="library_AndroidActionItemBadge_licenseId">apache_2_0</string>
<string name="library_AndroidActionItemBadge_isOpenSource">true</string>
Expand Down

0 comments on commit 8d62313

Please sign in to comment.