更新优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package cn.shangyu.gdxzExpert.netease.bagder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
|
||||
import com.netease.nim.uikit.api.NimUIKit;
|
||||
@@ -29,6 +30,22 @@ public class Badger {
|
||||
SharePrefUtil.saveInt(UIUtils.getContext(),"unreadFollow",unreadFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除桌面角标:随访未读计数、ShortcutBadger 角标,并同步为 0。
|
||||
*/
|
||||
public static void clearAllBadges(Context context) {
|
||||
Context appContext = context != null ? context.getApplicationContext() : UIUtils.getContext();
|
||||
unreadFollow = 0;
|
||||
saveUnreadFollow();
|
||||
support = true;
|
||||
try {
|
||||
ShortcutBadger.removeCount(appContext);
|
||||
ShortcutBadger.applyCount(appContext, 0);
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
updateBadgerCount(0);
|
||||
}
|
||||
|
||||
public static void updateBadgerCount(final int unreadCount) {
|
||||
if (!support) {
|
||||
return; // O版本及以上不再支持
|
||||
|
||||
Reference in New Issue
Block a user