本文整理匯總了Java中android.app.NotificationManager.IMPORTANCE_NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotificationManager.IMPORTANCE_NONE屬性的具體用法?Java NotificationManager.IMPORTANCE_NONE怎麽用?Java NotificationManager.IMPORTANCE_NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.app.NotificationManager
的用法示例。
在下文中一共展示了NotificationManager.IMPORTANCE_NONE屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: NotificationChannelData
NotificationChannelData(Map<String, Object> channel) {
id = (String) channel.get("id");
name = (String) channel.get("name");
description = (String) channel.get("description");
groupId = (String) channel.get("groupId");
importance = (int) CollectionUtil.getOrDefault(channel, "importance",
importance);
enableLights = (boolean) CollectionUtil.getOrDefault(channel, "enable_lights", enableLights);
lightColor = (int) CollectionUtil.getOrDefault(channel, "light_color", lightColor);
enableVibration = (boolean) CollectionUtil.getOrDefault(channel, "enable_vibration",
enableVibration);
lockscreenVisibility = (int) CollectionUtil.getOrDefault(channel, "lockscreen_visibility",
lockscreenVisibility);
bypassDnd = (boolean) CollectionUtil.getOrDefault(channel, "bypass_dnd", bypassDnd);
showBadge = (boolean) CollectionUtil.getOrDefault(channel, "show_badge", showBadge);
try {
List<Number> pattern = CollectionUtil.uncheckedCast(
CollectionUtil.getOrDefault(channel, "vibration_pattern", null));
if (pattern != null) {
vibrationPattern = new long[pattern.size()];
Iterator<Number> iterator = pattern.iterator();
for (int i = 0; i < vibrationPattern.length; i++) {
Number next = iterator.next();
if (next != null) {
vibrationPattern[i] = next.longValue();
}
}
}
} catch (Exception e) {
Log.w("Failed to parse vibration pattern.");
}
// Sanity checks.
if (importance < NotificationManager.IMPORTANCE_NONE &&
importance > NotificationManager.IMPORTANCE_MAX) {
importance = NotificationManager.IMPORTANCE_DEFAULT;
}
if (lockscreenVisibility < Notification.VISIBILITY_SECRET &&
lockscreenVisibility > Notification.VISIBILITY_PUBLIC) {
lockscreenVisibility = Notification.VISIBILITY_PUBLIC;
}
}