Honor badger

This commit is contained in:
M66B 2023-05-28 17:13:49 +02:00
parent 98e7473893
commit c39f280eb8
8 changed files with 64 additions and 0 deletions

3
FAQ.md
View File

@ -440,6 +440,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*

View File

@ -54,6 +54,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" />

View File

@ -56,6 +56,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" />

View File

@ -56,6 +56,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" />

View File

@ -54,6 +54,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" />

View File

@ -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);

View File

@ -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"
);
}
}

View File

@ -54,6 +54,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" />