當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。