当前位置: 首页>>代码示例>>Java>>正文


Java ShortcutBadger.removeCount方法代码示例

本文整理汇总了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);
  }

}
 
开发者ID:Daskiworks,项目名称:ghwatch,代码行数:22,代码来源:UnreadNotificationsService.java

示例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);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:11,代码来源:MessageNotifier.java

示例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;
	}
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:13,代码来源:XmppConnectionService.java

示例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);
    }
}
 
开发者ID:evollu,项目名称:react-native-fcm,代码行数:11,代码来源:BadgeHelper.java

示例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();
}
 
开发者ID:phonegap,项目名称:phonegap-plugin-push,代码行数:12,代码来源:PushPlugin.java

示例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());
}
 
开发者ID:Daskiworks,项目名称:ghwatch,代码行数:32,代码来源:MainActivity.java

示例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);
  }
}
 
开发者ID:Daskiworks,项目名称:ghwatch,代码行数:33,代码来源:UnreadNotificationsService.java

示例8: clearBadge

import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
/**
 * Clear the badge number.
 */
public void clearBadge () {
    saveBadge(0);
    ShortcutBadger.removeCount(ctx);
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:8,代码来源:BadgeImpl.java

示例9: clearBadge

import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
@ReactMethod
public void clearBadge() {
    saveBadge(0);
    ShortcutBadger.removeCount(reactContext);
}
 
开发者ID:uuau99999,项目名称:react-native-icon-badge,代码行数:6,代码来源:RNIconBadgeModule.java


注:本文中的me.leolin.shortcutbadger.ShortcutBadger.removeCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。