当前位置: 首页>>代码示例>>Java>>正文


Java Notification.FLAG_SHOW_LIGHTS属性代码示例

本文整理汇总了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();
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:20,代码来源:NotificationUtils.java

示例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);
}
 
开发者ID:androidDaniel,项目名称:treasure,代码行数:11,代码来源:NotificationUtil.java

示例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);
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:53,代码来源:LedSettingsActivity.java

示例4: enableLights

private void enableLights(Notification notification) {
	notification.flags |= Notification.FLAG_SHOW_LIGHTS;
	notification.ledOnMS = 200;
	notification.ledOffMS = 200;
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:5,代码来源:NotificationOptions.java


注:本文中的android.app.Notification.FLAG_SHOW_LIGHTS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。