Skip to content

Commit

Permalink
Merge branch 'release/v3.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Dec 27, 2016
2 parents 2fd0946 + 6613e3c commit 13bfb2d
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 46 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ The ActionItemBadge Library is pushed to [Maven Central], so you just need to ad

```javascript
dependencies {
compile 'com.mikepenz:actionitembadge:3.3.0@aar'
compile 'com.mikepenz:actionitembadge:3.3.1@aar'

//SUB-DEPENDENCIES
//Android-Iconics - used to provide an easy API for icons
compile 'com.mikepenz:iconics-core:2.8.0@aar'
compile 'com.mikepenz:iconics-core:2.8.1@aar'

//appcompat
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
}
```

Expand Down Expand Up @@ -62,7 +65,7 @@ Override the onCreateOptionsMenu method

//If you want to add your ActionItem programmatically you can do this too. You do the following:
new ActionItemBadgeAdder().act(this).menu(menu).title(R.string.sample_2).itemDetails(0, SAMPLE2_ID, 1).showAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS).add(bigStyle, 1);
return true;
return super.onCreateOptionsMenu(menu);
}
```

Expand Down
19 changes: 12 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ android {

defaultConfig {
minSdkVersion 14
targetSdkVersion 24
versionCode 330
versionName "3.3.0"
targetSdkVersion 25
versionCode 331
versionName "3.3.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
abortOnError false
}

enforceUniquePackageName false
}

Expand All @@ -35,20 +40,20 @@ dependencies {
// used to fill the RecyclerView with the DrawerItems
// and provides single and multi selection, expandable items
// https://github.com/mikepenz/FastAdapter
compile 'com.mikepenz:fastadapter:1.7.0@aar'
compile 'com.mikepenz:fastadapter:2.1.5@aar'

// used to provide out of the box icon font support. simplifies development,
// and provides scalable icons. the core is very very light
// https://github.com/mikepenz/Android-Iconics
compile 'com.mikepenz:iconics-core:2.8.0@aar'
compile 'com.mikepenz:iconics-core:2.8.1@aar'

//used to generate the drawer on the left
//https://github.com/mikepenz/MaterialDrawer
compile 'com.mikepenz:materialdrawer:5.5.0@aar'
compile 'com.mikepenz:materialdrawer:5.8.1@aar'

//used to generate the Open Source section
//https://github.com/mikepenz/AboutLibraries
compile 'com.mikepenz:aboutlibraries:5.8.0@aar'
compile 'com.mikepenz:aboutlibraries:5.9.1@aar'

//used to display the icons in the drawer and in the menu
//https://github.com/mikepenz/Android-Iconics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
Expand All @@ -18,7 +19,6 @@
import com.mikepenz.actionitembadge.library.ActionItemBadgeAdder;
import com.mikepenz.actionitembadge.library.utils.BadgeStyle;
import com.mikepenz.actionitembadge.library.utils.NumberUtils;
import com.mikepenz.actionitembadge.library.utils.UIUtil;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
Expand Down Expand Up @@ -143,7 +143,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
if (badgeDrawableCount == 0) {
ActionItemBadge.hide(menu.findItem(R.id.item_sampleBadge_drawable));
} else {
ActionItemBadge.update(this, menu.findItem(R.id.item_sampleBadge_drawable), UIUtil.getCompatDrawable(this, R.drawable.ic_notification), style, NumberUtils.formatNumber(badgeDrawableCount));
ActionItemBadge.update(this, menu.findItem(R.id.item_sampleBadge_drawable), ContextCompat.getDrawable(this, R.drawable.ic_notification), style, NumberUtils.formatNumber(badgeDrawableCount));
}

new ActionItemBadgeAdder().act(this).menu(menu).title(R.string.sample_2).itemDetails(0, SAMPLE2_ID, 1).showAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS).add(bigStyle, 1);
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ buildscript {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.android.tools.build:gradle:2.3.0-beta1'
classpath 'com.novoda:bintray-release:0.3.4'
}
}

ext {
compileSdkVersion = 24
buildToolsVersion = "24.0.1"
supportLibVersion = "24.2.0"
compileSdkVersion = 25
buildToolsVersion = "25.0.2"
supportLibVersion = "25.1.0"
}

allprojects {
Expand All @@ -23,5 +23,5 @@ allprojects {
}

task wrapper(type: Wrapper) {
gradleVersion = '2.14'
gradleVersion = '3.2'
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
VERSION_NAME=3.3.0
VERSION_CODE=330
VERSION_NAME=3.3.1
VERSION_CODE=331
GROUP=com.mikepenz
POM_DESCRIPTION=Android-ActionItemBadge Library
POM_URL=https://github.com/mikepenz/Android-ActionItemBadge
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Aug 21 20:02:02 CEST 2016
#Tue Dec 27 09:05:09 CET 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip
8 changes: 4 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ android {

defaultConfig {
minSdkVersion 14
targetSdkVersion 24
versionCode 330
versionName "3.3.0"
targetSdkVersion 25
versionCode 331
versionName "3.3.1"
}
buildTypes {
release {
Expand All @@ -25,7 +25,7 @@ dependencies {
// used to provide out of the box icon font support. simplifies development,
// and provides scalable icons. the core is very very light
// https://github.com/mikepenz/Android-Iconics
compile 'com.mikepenz:iconics-core:2.8.0@aar'
compile 'com.mikepenz:iconics-core:2.8.1@aar'

compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ public static void update(final MenuItem menu, Drawable icon, String badgeCount)

}


public static void update(final Activity activity, final MenuItem menu, Drawable icon, BadgeStyle style, int badgeCount) {
update (activity, menu, icon, style, badgeCount, null);
}

public static void update(final Activity activity, final MenuItem menu, Drawable icon, BadgeStyle style, int badgeCount, ActionItemBadgeListener listener) {
if (badgeCount == Integer.MIN_VALUE) {
update(activity, menu, icon, style, null);
update(activity, menu, icon, style, null, listener);
} else {
update(activity, menu, icon, style, String.valueOf(badgeCount));
update(activity, menu, icon, style, String.valueOf(badgeCount), listener);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,47 +69,47 @@ public ActionItemBadgeAdder showAsAction(int showAsAction) {
return this;
}

public Menu add(int badgeCount) {
public MenuItem add(int badgeCount) {
return add(ActionItemBadge.BadgeStyles.GREY_LARGE, badgeCount);
}

public Menu add(ActionItemBadge.BadgeStyles style, int badgeCount) {
public MenuItem add(ActionItemBadge.BadgeStyles style, int badgeCount) {
return add(style.getStyle(), badgeCount);
}

public Menu add(BadgeStyle style, int badgeCount) {
return add((Drawable) null, style, badgeCount);
public MenuItem add(BadgeStyle style, int badgeCount) {
return add((Drawable) null, style, badgeCount, null);
}

public Menu add(IIcon icon, int badgeCount) {
public MenuItem add(IIcon icon, int badgeCount) {
return add(icon, Color.WHITE, badgeCount);
}

public Menu add(IIcon icon, int iconColor, int badgeCount) {
public MenuItem add(IIcon icon, int iconColor, int badgeCount) {
return add(new IconicsDrawable(activity, icon).color(iconColor).actionBar(), ActionItemBadge.BadgeStyles.GREY, badgeCount);
}

public Menu add(Drawable icon, int badgeCount) {
public MenuItem add(Drawable icon, int badgeCount) {
return add(icon, ActionItemBadge.BadgeStyles.GREY, badgeCount);
}

public Menu add(IIcon icon, ActionItemBadge.BadgeStyles style, int badgeCount) {
public MenuItem add(IIcon icon, ActionItemBadge.BadgeStyles style, int badgeCount) {
return add(icon, style.getStyle(), badgeCount);
}

public Menu add(IIcon icon, BadgeStyle style, int badgeCount) {
public MenuItem add(IIcon icon, BadgeStyle style, int badgeCount) {
return add(icon, Color.WHITE, style, badgeCount);
}

public Menu add(IIcon icon, int iconColor, BadgeStyle style, int badgeCount) {
return add(new IconicsDrawable(activity, icon).color(iconColor).actionBar(), style, badgeCount);
public MenuItem add(IIcon icon, int iconColor, BadgeStyle style, int badgeCount) {
return add(new IconicsDrawable(activity, icon).color(iconColor).actionBar(), style, badgeCount, null);
}

public Menu add(Drawable icon, ActionItemBadge.BadgeStyles style, int badgeCount) {
return add(icon, style.getStyle(), badgeCount);
public MenuItem add(Drawable icon, ActionItemBadge.BadgeStyles style, int badgeCount) {
return add(icon, style.getStyle(), badgeCount, null);
}

public Menu add(Drawable icon, BadgeStyle style, int badgeCount) {
public MenuItem add(Drawable icon, BadgeStyle style, int badgeCount, ActionItemBadge.ActionItemBadgeListener listener) {
MenuItem item;
if (groupId != null && itemId != null && order != null) {
item = menu.add(groupId, itemId, order, title);
Expand All @@ -122,7 +122,7 @@ public Menu add(Drawable icon, BadgeStyle style, int badgeCount) {
}

item.setActionView(style.getLayout());
ActionItemBadge.update(activity, item, icon, style, badgeCount);
return menu;
ActionItemBadge.update(activity, item, icon, style, badgeCount, listener);
return item;
}
}
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.3.0</string>
<string name="library_AndroidActionItemBadge_libraryVersion">3.3.1</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 13bfb2d

Please sign in to comment.