diff --git a/README.md b/README.md index 87471d0..44e9f57 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,10 @@ Please use version 1.1.0+ CHANGE LOG =================================== +1.1.8:
+Remove SolidBadger, now solid launcher will use default badger. + + 1.1.7:
add huawei launcher support.

diff --git a/ShortcutBadger/build.gradle b/ShortcutBadger/build.gradle index 84973ab..34e2a24 100644 --- a/ShortcutBadger/build.gradle +++ b/ShortcutBadger/build.gradle @@ -12,7 +12,10 @@ android { versionName "1.0" consumerProguardFiles 'proguard-rules.pro' } - + + lintOptions { + abortOnError false + } } diff --git a/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadgeException.java b/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadgeException.java index 3b36161..148e82d 100644 --- a/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadgeException.java +++ b/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadgeException.java @@ -4,4 +4,9 @@ public class ShortcutBadgeException extends Exception { public ShortcutBadgeException(String message) { super(message); } + + public ShortcutBadgeException(String message, Exception e) { + super(message, e); + } + } diff --git a/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadger.java b/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadger.java index 8b09d4f..bcab21b 100644 --- a/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadger.java +++ b/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadger.java @@ -7,6 +7,7 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Build; import android.util.Log; + import me.leolin.shortcutbadger.impl.*; import java.lang.reflect.Constructor; @@ -41,7 +42,8 @@ public final class ShortcutBadger { /** * Tries to update the notification count - * @param context Caller context + * + * @param context Caller context * @param badgeCount Desired badge count * @return true in case of success, false otherwise */ @@ -57,7 +59,8 @@ public final class ShortcutBadger { /** * Tries to update the notification count, throw a {@link ShortcutBadgeException} if it fails - * @param context Caller context + * + * @param context Caller context * @param badgeCount Desired badge count */ public static void applyCountOrThrow(Context context, int badgeCount) throws ShortcutBadgeException { @@ -77,6 +80,7 @@ public final class ShortcutBadger { /** * Tries to remove the notification count + * * @param context Caller context * @return true in case of success, false otherwise */ @@ -86,6 +90,7 @@ public final class ShortcutBadger { /** * Tries to remove the notification count, throw a {@link ShortcutBadgeException} if it fails + * * @param context Caller context */ public static void removeCountOrThrow(Context context) throws ShortcutBadgeException { @@ -108,8 +113,12 @@ public final class ShortcutBadger { String currentHomePackage = resolveInfo.activityInfo.packageName; for (Class badger : BADGERS) { - Badger shortcutBadger = badger.newInstance(); - if (shortcutBadger.getSupportLaunchers().contains(currentHomePackage)) { + Badger shortcutBadger = null; + try { + shortcutBadger = badger.newInstance(); + } catch (Exception e) { + } + if (shortcutBadger != null && shortcutBadger.getSupportLaunchers().contains(currentHomePackage)) { sShortcutBadger = shortcutBadger; break; } diff --git a/build.gradle b/build.gradle index 0a903df..e6fc6c8 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { POM_NAME = 'Shortcutbadger' POM_PACKAGING = 'aar' POM_ARTIFACT_ID = 'shortcutbadger' - VERSION_NAME = '1.1.7' + VERSION_NAME = '1.1.8' VERSION_CODE = 1 GROUP = 'me.leolin' }