本文整理汇总了Java中me.leolin.shortcutbadger.ShortcutBadger.setBadge方法的典型用法代码示例。如果您正苦于以下问题:Java ShortcutBadger.setBadge方法的具体用法?Java ShortcutBadger.setBadge怎么用?Java ShortcutBadger.setBadge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.leolin.shortcutbadger.ShortcutBadger
的用法示例。
在下文中一共展示了ShortcutBadger.setBadge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateBadge
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
private static void updateBadge(Context context, int count) {
try {
ShortcutBadger.setBadge(context, count);
} catch (Throwable t) {
// NOTE :: I don't totally trust this thing, so I'm catching
// everything.
Log.w("MessageNotifier", t);
}
}
示例2: logout
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
/**
* Logout the current user.
* @param activity the caller activity
*/
public static void logout(Activity activity) {
stopEventStream(activity);
try {
ShortcutBadger.setBadge(activity, 0);
} catch (Exception e) {
}
// warn that the user logs out
Collection<MXSession> sessions = Matrix.getMXSessions(activity);
for(MXSession session : sessions) {
// Publish to the server that we're now offline
MyPresenceManager.getInstance(activity, session).advertiseOffline();
MyPresenceManager.remove(session);
}
// clear the preferences
PreferenceManager.getDefaultSharedPreferences(activity).edit().clear().commit();
// reset the GCM
Matrix.getInstance(activity).getSharedGcmRegistrationManager().reset();
// clear credentials
Matrix.getInstance(activity).clearSessions(activity, true);
// ensure that corrupted values are cleared
Matrix.getInstance(activity).getLoginStorage().clear();
// reset the contacts
PIDsRetriever.getIntance().reset();
ContactsManager.reset();
MXMediasCache.clearThumbnailsCache(activity);
// go to login page
activity.startActivity(new Intent(activity, LoginActivity.class));
activity.finish();
}
示例3: updateUnreadMessagesBadge
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
public static void updateUnreadMessagesBadge(Context context, int badgeValue) {
try {
ShortcutBadger.setBadge(context, badgeValue);
} catch (Exception e) {
}
}
示例4: updateBadgeCount
import me.leolin.shortcutbadger.ShortcutBadger; //导入方法依赖的package包/类
/**
* Update the application badge value.
*
* @param context the context
* @param badgeValue the new badge value
*/
public static void updateBadgeCount(Context context, int badgeValue) {
try {
mBadgeValue = badgeValue;
ShortcutBadger.setBadge(context, badgeValue);
} catch (Exception e) {
Log.e(LOG_TAG, "## updateBadgeCount(): Exception Msg=" + e.getMessage());
}
}