Honor badger

pull/213/head
M66B 2 years ago
parent 819e86615f
commit f049fb0cad

@ -445,6 +445,9 @@ The following permissions are needed to show the count of unread messages as a b
* *com.huawei.android.launcher.permission.CHANGE_BADGE*
* *com.huawei.android.launcher.permission.READ_SETTINGS*
* *com.huawei.android.launcher.permission.WRITE_SETTINGS*
* *com.hihonor.android.launcher.permission.CHANGE_BADGE*
* *com.hihonor.android.launcher.permission.READ_SETTINGS*
* *com.hihonor.android.launcher.permission.WRITE_SETTINGS*
* *android.permission.READ_APP_BADGE*
* *com.oppo.launcher.permission.READ_SETTINGS*
* *com.oppo.launcher.permission.WRITE_SETTINGS*

@ -55,6 +55,11 @@
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
<!--for hihonor-->
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.hihonor.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.hihonor.android.launcher.permission.WRITE_SETTINGS" />
<!-- for ZUK -->
<uses-permission android:name="android.permission.READ_APP_BADGE" />

@ -57,6 +57,11 @@
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
<!--for hihonor-->
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.hihonor.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.hihonor.android.launcher.permission.WRITE_SETTINGS" />
<!-- for ZUK -->
<uses-permission android:name="android.permission.READ_APP_BADGE" />

@ -57,6 +57,11 @@
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
<!--for hihonor-->
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.hihonor.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.hihonor.android.launcher.permission.WRITE_SETTINGS" />
<!-- for ZUK -->
<uses-permission android:name="android.permission.READ_APP_BADGE" />

@ -55,6 +55,11 @@
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
<!--for hihonor-->
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.hihonor.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.hihonor.android.launcher.permission.WRITE_SETTINGS" />
<!-- for ZUK -->
<uses-permission android:name="android.permission.READ_APP_BADGE" />

@ -21,6 +21,7 @@ import me.leolin.shortcutbadger.impl.AsusHomeBadger;
import me.leolin.shortcutbadger.impl.DefaultBadger;
import me.leolin.shortcutbadger.impl.EverythingMeHomeBadger;
import me.leolin.shortcutbadger.impl.HuaweiHomeBadger;
import me.leolin.shortcutbadger.impl.HonorHomeBadger;
import me.leolin.shortcutbadger.impl.NewHtcHomeBadger;
import me.leolin.shortcutbadger.impl.NovaHomeBadger;
import me.leolin.shortcutbadger.impl.OPPOHomeBader;
@ -54,6 +55,7 @@ public final class ShortcutBadger {
BADGERS.add(SonyHomeBadger.class);
BADGERS.add(AsusHomeBadger.class);
BADGERS.add(HuaweiHomeBadger.class);
BADGERS.add(HonorHomeBadger.class);
BADGERS.add(OPPOHomeBader.class);
BADGERS.add(SamsungHomeBadger.class);
BADGERS.add(ZukHomeBadger.class);

@ -0,0 +1,34 @@
package me.leolin.shortcutbadger.impl;
import android.content.ComponentName;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import java.util.Arrays;
import java.util.List;
import me.leolin.shortcutbadger.Badger;
import me.leolin.shortcutbadger.ShortcutBadgeException;
/**
* @author Jason Ling
*/
public class HonorHomeBadger implements Badger {
@Override
public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException {
Bundle localBundle = new Bundle();
localBundle.putString("package", context.getPackageName());
localBundle.putString("class", componentName.getClassName());
localBundle.putInt("badgenumber", badgeCount);
context.getContentResolver().call(Uri.parse("content://com.hihonor.android.launcher.settings/badge/"), "change_badge", null, localBundle);
}
@Override
public List<String> getSupportLaunchers() {
return Arrays.asList(
"com.hihonor.android.launcher"
);
}
}

@ -55,6 +55,11 @@
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
<!--for hihonor-->
<uses-permission android:name="com.hihonor.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.hihonor.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.hihonor.android.launcher.permission.WRITE_SETTINGS" />
<!-- for ZUK -->
<uses-permission android:name="android.permission.READ_APP_BADGE" />

Loading…
Cancel
Save