use of android.service.notification.Condition in project platform_packages_apps_Settings by BlissRoms.
the class ZenModeVoiceActivity method onVoiceSettingInteraction.
@Override
protected boolean onVoiceSettingInteraction(Intent intent) {
if (intent.hasExtra(EXTRA_DO_NOT_DISTURB_MODE_ENABLED)) {
int minutes = intent.getIntExtra(EXTRA_DO_NOT_DISTURB_MODE_MINUTES, -1);
Condition condition = null;
int mode = Global.ZEN_MODE_OFF;
if (intent.getBooleanExtra(EXTRA_DO_NOT_DISTURB_MODE_ENABLED, false)) {
if (minutes > 0) {
condition = ZenModeConfig.toTimeCondition(this, minutes, UserHandle.myUserId());
}
mode = Global.ZEN_MODE_ALARMS;
}
setZenModeConfig(mode, condition);
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if (audioManager != null) {
// Show the current Zen Mode setting.
audioManager.adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
}
notifySuccess(getChangeSummary(mode, minutes));
} else {
Log.v(TAG, "Missing extra android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_ENABLED");
finish();
}
return false;
}
use of android.service.notification.Condition in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenModeVoiceActivity method onVoiceSettingInteraction.
@Override
protected boolean onVoiceSettingInteraction(Intent intent) {
if (intent.hasExtra(EXTRA_DO_NOT_DISTURB_MODE_ENABLED)) {
int minutes = intent.getIntExtra(EXTRA_DO_NOT_DISTURB_MODE_MINUTES, -1);
Condition condition = null;
int mode = Global.ZEN_MODE_OFF;
if (intent.getBooleanExtra(EXTRA_DO_NOT_DISTURB_MODE_ENABLED, false)) {
if (minutes > 0) {
condition = ZenModeConfig.toTimeCondition(this, minutes, UserHandle.myUserId());
}
mode = Global.ZEN_MODE_ALARMS;
}
setZenModeConfig(mode, condition);
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if (audioManager != null) {
// Show the current Zen Mode setting.
audioManager.adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
}
notifySuccess(getChangeSummary(mode, minutes));
} else {
Log.v(TAG, "Missing extra android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_ENABLED");
finish();
}
return false;
}
Aggregations