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