本文整理匯總了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;
}