diff options
Diffstat (limited to 'src/com/android/settings/notification/NotificationSettings.java')
-rw-r--r-- | src/com/android/settings/notification/NotificationSettings.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java index e0d5e8c..f513378 100644 --- a/src/com/android/settings/notification/NotificationSettings.java +++ b/src/com/android/settings/notification/NotificationSettings.java @@ -81,6 +81,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements private static final String KEY_NOTIFICATION_PULSE = "notification_pulse"; private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "lock_screen_notifications"; private static final String KEY_NOTIFICATION_ACCESS = "manage_notification_access"; + private static final String KEY_INCREASING_RING_VOLUME = "increasing_ring_volume"; private static final String KEY_ZEN_ACCESS = "manage_zen_access"; private static final String KEY_ZEN_MODE = "zen_mode"; @@ -96,6 +97,14 @@ public class NotificationSettings extends SettingsPreferenceFragment implements private static final int SAMPLE_CUTOFF = 2000; // manually cap sample playback at 2 seconds private final VolumePreferenceCallback mVolumeCallback = new VolumePreferenceCallback(); + private final IncreasingRingVolumePreference.Callback mIncreasingRingVolumeCallback = + new IncreasingRingVolumePreference.Callback() { + @Override + public void onStartingSample() { + mVolumeCallback.stopSample(); + } + }; + private final H mHandler = new H(); private final SettingsObserver mSettingsObserver = new SettingsObserver(); private final Receiver mReceiver = new Receiver(); @@ -108,6 +117,8 @@ public class NotificationSettings extends SettingsPreferenceFragment implements private AudioManager mAudioManager; private VolumeSeekBarPreference mRingOrNotificationPreference; + private TwoStatePreference mIncreasingRing; + private IncreasingRingVolumePreference mIncreasingRingVolume; private Preference mPhoneRingtonePreference; private Preference mNotificationRingtonePreference; private TwoStatePreference mVibrateWhenRinging; @@ -162,6 +173,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements } initRingtones(sound); initVibrateWhenRinging(sound); + initIncreasingRing(sound); final PreferenceCategory notification = (PreferenceCategory) findPreference(KEY_NOTIFICATION); @@ -277,6 +289,9 @@ public class NotificationSettings extends SettingsPreferenceFragment implements if (mCurrent != null && mCurrent != sbv) { mCurrent.stopSample(); } + if (mIncreasingRingVolume != null) { + mIncreasingRingVolume.stopSample(); + } mCurrent = sbv; if (mCurrent != null) { mHandler.removeMessages(H.STOP_SAMPLE); @@ -371,6 +386,28 @@ public class NotificationSettings extends SettingsPreferenceFragment implements return summary; } + // === Increasing ringtone === + + private void initIncreasingRing(PreferenceCategory root) { + mIncreasingRing = (TwoStatePreference) + root.findPreference(Settings.System.INCREASING_RING); + mIncreasingRingVolume = (IncreasingRingVolumePreference) + root.findPreference(KEY_INCREASING_RING_VOLUME); + + if (mIncreasingRing == null || mIncreasingRingVolume == null || !mVoiceCapable) { + if (mIncreasingRing != null) { + root.removePreference(mIncreasingRing); + mIncreasingRing = null; + } + if (mIncreasingRingVolume != null) { + root.removePreference(mIncreasingRingVolume); + mIncreasingRingVolume = null; + } + } else { + mIncreasingRingVolume.setCallback(mIncreasingRingVolumeCallback); + } + } + // === Vibrate when ringing === private void initVibrateWhenRinging(PreferenceCategory root) { |