本文整理汇总了Java中me.leolin.shortcutbadger.ShortcutBadger.removeCount方法的典型用法代码示例。如果您正苦于以下问题:Java ShortcutBadger.removeCount方法的具体用法?Java ShortcutBadger.removeCount怎么用?Java ShortcutBadger.removeCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.leolin.shortcutbadger.ShortcutBadger
的用法示例。
在下文中一共展示了ShortcutBadger.removeCount方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markAndroidNotificationBundledDetailRead
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
/**
* Call this when you want to mark android notification issued by this app as read - remove it
*/
public void markAndroidNotificationBundledDetailRead(int androidNotificationIdToCancel) {
Utils.getNotificationManager(context).cancel(androidNotificationIdToCancel);
long c = PreferencesUtils.getLong(context, NUM_OF_BUNDLED_ANDROID_NOTIFICATIONS,0);
if(c>1){
PreferencesUtils.storeLong(context, NUM_OF_BUNDLED_ANDROID_NOTIFICATIONS, --c);
} else {
markAndroidNotificationsRead();
}
int bc = PreferencesUtils.getInt(context, NUM_OF_BADGED_ANDROID_NOTIFICATIONS,0);
if(bc>1){
PreferencesUtils.storeInt(context, NUM_OF_BADGED_ANDROID_NOTIFICATIONS, --bc);
ShortcutBadger.applyCount(context, bc);
} else {
ShortcutBadger.removeCount(context);
}
}
示例2: updateBadge
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
private static void updateBadge(Context context, int count) {
try {
if (count == 0) ShortcutBadger.removeCount(context);
else ShortcutBadger.applyCount(context, count);
} catch (Throwable t) {
// NOTE :: I don't totally trust this thing, so I'm catching
// everything.
Log.w("MessageNotifier", t);
}
}
示例3: updateUnreadCountBadge
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
public synchronized void updateUnreadCountBadge() {
int count = unreadCount();
if (unreadCount != count) {
Log.d(Config.LOGTAG, "update unread count to " + count);
if (count > 0) {
ShortcutBadger.applyCount(getApplicationContext(), count);
} else {
ShortcutBadger.removeCount(getApplicationContext());
}
unreadCount = count;
}
}
示例4: setBadgeCount
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
public void setBadgeCount(int badgeCount) {
storeBadgeCount(badgeCount);
if (badgeCount == 0) {
ShortcutBadger.removeCount(mContext);
Log.d(TAG, "Remove count");
} else {
ShortcutBadger.applyCount(mContext, badgeCount);
Log.d(TAG, "Apply count: " + badgeCount);
}
}
示例5: setApplicationIconBadgeNumber
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
public static void setApplicationIconBadgeNumber(Context context, int badgeCount) {
if (badgeCount > 0) {
ShortcutBadger.applyCount(context, badgeCount);
} else {
ShortcutBadger.removeCount(context);
}
SharedPreferences.Editor editor = context.getSharedPreferences(BADGE, Context.MODE_PRIVATE).edit();
editor.putInt(BADGE, Math.max(badgeCount, 0));
editor.apply();
}
示例6: onResume
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (!checkUserLoggedIn()) {
finish();
return;
}
ActivityTracker.sendView(this, TAG);
Intent intent = getIntent();
Log.d(TAG, "onResume() intent: " + getIntent());
if (intent != null && INTENT_ACTION_DISMISS_ALL.equals(intent.getAction())) {
showMarkAllNotificationsAsReadDialog();
} else {
if (intent != null && INTENT_ACTION_RESET_FILTER.equals(intent.getAction())) {
resetNotificationsFilter();
}
if (NewVersionInfoDialogFragment.isShowScheduled(this)) {
showDialog(new NewVersionInfoDialogFragment());
} else if (SupportAppDevelopmentDialogFragment.isAutoShowScheduled(this)) {
showSupportAppDevelopmentDialog();
}
}
if (intent != null)
intent.setAction(null);
refreshList(refreshOnNextResume ? ViewDataReloadStrategy.ALWAYS : ViewDataReloadStrategy.IF_TIMED_OUT, false);
refreshOnNextResume = false;
unreadNotificationsService.markAndroidWidgetsAsRead();
unreadNotificationsService.markAndroidNotificationsRead();
ShortcutBadger.removeCount(getApplicationContext());
}
示例7: fireAndroidNotification
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
protected void fireAndroidNotification(NotificationStream newStream, NotificationStream oldStream) {
if (newStream == null || !PreferencesUtils.getBoolean(context, PreferencesUtils.PREF_NOTIFY, true))
return;
Log.d(TAG, "fireAndroidNotification count before filter " + newStream.size());
newStream = filterForAndroidNotification(newStream);
Log.d(TAG, "fireAndroidNotification count after filter " + newStream.size());
if (newStream.isNewNotification(oldStream)) {
ShortcutBadger.applyCount(context, newStream.size());
PreferencesUtils.storeInt(context, NUM_OF_BADGED_ANDROID_NOTIFICATIONS, newStream.size());
//TEST with only one notification
if(false) {
Notification on = newStream.get(0);
Notification on2 = newStream.get(1);
newStream = new NotificationStream();
newStream.addNotification(on);
newStream.addNotification(on2);
}
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.N) {
fireAndroidNotificationInboxStyle(newStream);
} else {
fireAndroidNotificationBundledStyle(newStream);
}
ActivityTracker.sendEvent(context, ActivityTracker.CAT_NOTIF, "new_notif", "notif count: " + newStream.size(), Long.valueOf(newStream.size()));
} else if (newStream.isEmpty()) {
// #54 dismiss previous android notification if no any Github notification is available (as it was read on another device)
Utils.getNotificationManager(context).cancel(ANDROID_NOTIFICATION_MAIN_ID);
ShortcutBadger.removeCount(context);
}
}
示例8: clearBadge
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
/**
* Clear the badge number.
*/
public void clearBadge () {
saveBadge(0);
ShortcutBadger.removeCount(ctx);
}
示例9: clearBadge
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
@ReactMethod
public void clearBadge() {
saveBadge(0);
ShortcutBadger.removeCount(reactContext);
}