diff --git a/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadger.java b/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadger.java
old mode 100644
new mode 100755
index fa0ffa1..eeb76d4
--- a/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadger.java
+++ b/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/ShortcutBadger.java
@@ -250,10 +250,13 @@ else if (Build.MANUFACTURER.equalsIgnoreCase("ZTE"))
* is NOT used by sShortcutBadger.
*/
private static boolean isLauncherVersionSupported(Context context, String currentHomePackage) {
- if (!YandexLauncherBadger.PACKAGE_NAME.equals(currentHomePackage)) {
+ if (YandexLauncherBadger.PACKAGE_NAME.equals(currentHomePackage)) {
+ return YandexLauncherBadger.isVersionSupported(context);
+ } else if (ZTEHomeBadger.PACKAGE_NAME_MFV.equals(currentHomePackage)) {
+ return ZTEHomeBadger.isMFVLauncher(currentHomePackage);
+ } else {
return true;
}
- return YandexLauncherBadger.isVersionSupported(context);
}
/**
diff --git a/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl/ZTEHomeBadger.java b/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl/ZTEHomeBadger.java
old mode 100644
new mode 100755
index 7f9d78d..f1eb45b
--- a/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl/ZTEHomeBadger.java
+++ b/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl/ZTEHomeBadger.java
@@ -7,6 +7,7 @@
import android.os.Bundle;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import me.leolin.shortcutbadger.Badger;
@@ -14,6 +15,10 @@
public class ZTEHomeBadger implements Badger {
+ public static final String PACKAGE_NAME_MFV = "com.zte.mifavor.launcher";
+ public static final String PACKAGE_NAME_STOCK = "com.android.launcher3";
+ private static boolean mMFVBadger = false;
+
@Override
public void executeBadge(Context context, ComponentName componentName, int badgeCount)
throws ShortcutBadgeException {
@@ -22,15 +27,30 @@ public void executeBadge(Context context, ComponentName componentName, int badge
extra.putString("app_badge_component_name", componentName.flattenToString());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- context.getContentResolver().call(
- Uri.parse("content://com.android.launcher3.cornermark.unreadbadge"),
- "setAppUnreadCount", null, extra);
+ if (mMFVBadger) {
+ context.getContentResolver().call(
+ Uri.parse("content://com.zte.mifavor.launcher.unreadbadge"),
+ "setAppUnreadCount", null, extra);
+ } else {
+ context.getContentResolver().call(
+ Uri.parse("content://com.android.launcher3.cornermark.unreadbadge"),
+ "setAppUnreadCount", null, extra);
+ }
+ }
+ }
+
+ public static boolean isMFVLauncher(String currentHomePackage) {
+ if (PACKAGE_NAME_MFV.equals(currentHomePackage)) {
+ mMFVBadger = true;
+ } else {
+ mMFVBadger = false;
}
+ return mMFVBadger;
}
@Override
public List getSupportLaunchers() {
- return new ArrayList(0);
+ return Collections.singletonList(PACKAGE_NAME_MFV);
}
}