Methods Summary |
---|
private void | cleanup()
if (mNotificationSeekBarVolumizer != null) {
mNotificationSeekBarVolumizer.stop();
mNotificationSeekBarVolumizer = null;
}
|
public void | onActivityStop()
super.onActivityStop();
cleanup();
|
protected void | onBindDialogView(android.view.View view)
super.onBindDialogView(view);
mNotificationsUseRingVolumeCheckbox =
(CheckBox) view.findViewById(R.id.same_notification_volume);
mNotificationsUseRingVolumeCheckbox.setOnCheckedChangeListener(this);
mNotificationsUseRingVolumeCheckbox.setChecked(Settings.System.getInt(
getContext().getContentResolver(),
Settings.System.NOTIFICATIONS_USE_RING_VOLUME, 1) == 1);
final SeekBar seekBar = (SeekBar) view.findViewById(R.id.notification_volume_seekbar);
mNotificationSeekBarVolumizer = new SeekBarVolumizer(getContext(), seekBar,
AudioManager.STREAM_NOTIFICATION);
mNotificationVolumeTitle = (TextView) view.findViewById(R.id.notification_volume_title);
setNotificationVolumeVisibility(!mNotificationsUseRingVolumeCheckbox.isChecked());
|
public void | onCheckedChanged(android.widget.CompoundButton buttonView, boolean isChecked)
setNotificationVolumeVisibility(!isChecked);
Settings.System.putInt(getContext().getContentResolver(),
Settings.System.NOTIFICATIONS_USE_RING_VOLUME, isChecked ? 1 : 0);
if (isChecked) {
// The user wants the notification to be same as ring, so do a
// one-time sync right now
AudioManager audioManager = (AudioManager) getContext()
.getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION,
audioManager.getStreamVolume(AudioManager.STREAM_RING), 0);
}
|
protected void | onDialogClosed(boolean positiveResult)
super.onDialogClosed(positiveResult);
if (!positiveResult && mNotificationSeekBarVolumizer != null) {
mNotificationSeekBarVolumizer.revertVolume();
}
cleanup();
|
protected void | onSampleStarting(android.preference.VolumePreference.SeekBarVolumizer volumizer)
super.onSampleStarting(volumizer);
if (mNotificationSeekBarVolumizer != null && volumizer != mNotificationSeekBarVolumizer) {
mNotificationSeekBarVolumizer.stopSample();
}
|
private void | setNotificationVolumeVisibility(boolean visible)
if (mNotificationSeekBarVolumizer != null) {
mNotificationSeekBarVolumizer.getSeekBar().setVisibility(
visible ? View.VISIBLE : View.GONE);
mNotificationVolumeTitle.setVisibility(visible ? View.VISIBLE : View.GONE);
}
|