本文整理汇总了Java中android.app.Notification.FLAG_SHOW_LIGHTS属性的典型用法代码示例。如果您正苦于以下问题:Java Notification.FLAG_SHOW_LIGHTS属性的具体用法?Java Notification.FLAG_SHOW_LIGHTS怎么用?Java Notification.FLAG_SHOW_LIGHTS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.app.Notification
的用法示例。
在下文中一共展示了Notification.FLAG_SHOW_LIGHTS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configOtherPushNotification
public static void configOtherPushNotification(Notification notification) {
int mask = Settings.get()
.notifications()
.getOtherNotificationMask();
if (Utils.hasFlag(mask, ISettings.INotificationSettings.FLAG_LED)) {
notification.ledARGB = 0xFF0000FF;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.ledOnMS = 100;
notification.ledOffMS = 1000;
}
if (Utils.hasFlag(mask, ISettings.INotificationSettings.FLAG_VIBRO))
notification.defaults |= Notification.DEFAULT_VIBRATE;
if (Utils.hasFlag(mask, ISettings.INotificationSettings.FLAG_SOUND)) {
notification.sound = Settings.get()
.notifications()
.getFeedbackRingtoneUri();
}
}
示例2: lightLed
public static void lightLed(Context context, int colorOx, int startOffMS, int durationMS) {
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification();
notification.ledARGB = colorOx;
notification.ledOffMS = startOffMS;
notification.ledOnMS = durationMS;
notification.flags = Notification.FLAG_SHOW_LIGHTS;
LedID++;
nm.notify(LedID, notification);
nm.cancel(LedID);
}
示例3: previewSettings
private void previewSettings() {
Notification.Builder builder = new Notification.Builder(this)
.setContentTitle(getString(R.string.lc_preview_notif_title))
.setContentText(String.format(Locale.getDefault(),
getString(R.string.lc_preview_notif_text), getTitle()))
.setSmallIcon(R.drawable.ic_notif_gravitybox)
.setLargeIcon(Icon.createWithResource(this, R.drawable.ic_launcher));
final Notification n = builder.build();
if (mPrefsFragment.getLedMode() == LedMode.OFF) {
n.defaults &= ~Notification.DEFAULT_LIGHTS;
n.flags &= ~Notification.FLAG_SHOW_LIGHTS;
} else if (mPrefsFragment.getLedMode() == LedMode.OVERRIDE) {
n.defaults &= ~Notification.DEFAULT_LIGHTS;
n.flags |= Notification.FLAG_SHOW_LIGHTS;
n.ledARGB = mPrefsFragment.getColor();
n.ledOnMS = mPrefsFragment.getLedOnMs();
n.ledOffMS = mPrefsFragment.getLedOffMs();
}
if (mPrefsFragment.getSoundOverride() && mPrefsFragment.getSoundUri() != null) {
n.defaults &= ~Notification.DEFAULT_SOUND;
n.sound = mPrefsFragment.getSoundUri();
}
if (mPrefsFragment.getInsistent()) {
n.flags |= Notification.FLAG_INSISTENT;
}
if (mPrefsFragment.getVibrateOverride()) {
try {
long[] pattern = LedSettings.parseVibratePatternString(
mPrefsFragment.getVibratePatternAsString());
n.defaults &= ~Notification.DEFAULT_VIBRATE;
n.vibrate = pattern;
} catch (Exception e) {
Toast.makeText(this, getString(R.string.lc_vibrate_pattern_invalid),
Toast.LENGTH_SHORT).show();
}
}
if (mPrefsFragment.getVisibility() != Visibility.DEFAULT) {
n.visibility = mPrefsFragment.getVisibility().getValue();
}
if (mPrefsFragment.getVisibilityLs() != VisibilityLs.DEFAULT) {
n.extras.putString(ModLedControl.NOTIF_EXTRA_VISIBILITY_LS,
mPrefsFragment.getVisibilityLs().toString());
}
n.extras.putBoolean("gbIgnoreNotification", true);
Intent intent = new Intent(ModHwKeys.ACTION_SLEEP);
sendBroadcast(intent);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).notify(++NOTIF_ID, n);
}
}, 1000);
}
示例4: enableLights
private void enableLights(Notification notification) {
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.ledOnMS = 200;
notification.ledOffMS = 200;
}