Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bdff72f8 authored by Glenn Maynard's avatar Glenn Maynard
Browse files

Add "Always notify on speaker" setting.

parent 4f4eaad8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -888,6 +888,10 @@
    <!-- Sound settings screen, setting option summary text -->
    <string name="vibrate_summary">Vibrate phone for incoming calls</string>
    <!-- Sound settings screen, setting option name -->
    <string name="speaker_notifications">Always notify on speaker</string>
    <!-- Sound settings screen, setting option summary text -->
    <string name="speaker_notifications_summary">Play notifications on the speaker even when using headphones</string>
    <!-- Sound settings screen, setting option name -->
    <string name="notification_sound_title">Notification ringtone</string>
    <!-- Sound settings screen, setting option summary text -->
    <string name="notification_sound_summary">Set your default notification ringtone</string>
+7 −0
Original line number Diff line number Diff line
@@ -75,6 +75,13 @@
                android:order="6"
                android:persistent="false" />

        <CheckBoxPreference
                android:key="speaker_notifications"
                android:title="@string/speaker_notifications"
                android:summary="@string/speaker_notifications_summary"
                android:order="7"
                android:persistent="false" />

        <com.android.settings.DefaultRingtonePreference
                android:key="notification_sound"
                android:title="@string/notification_sound_title"
+13 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements

    private static final String KEY_SILENT = "silent";
    private static final String KEY_VIBRATE = "vibrate";
    private static final String KEY_SPEAKER_NOTIFICATIONS = "speaker_notifications";
    private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
    private static final String KEY_DTMF_TONE = "dtmf_tone";
    private static final String KEY_SOUND_EFFECTS = "sound_effects";
@@ -84,6 +85,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
     * setting.
     */
    private CheckBoxPreference mVibrate;
    private CheckBoxPreference mSpeakerNotifications;
    private CheckBoxPreference mDtmfTone;
    private CheckBoxPreference mSoundEffects;
    private CheckBoxPreference mHapticFeedback;
@@ -136,6 +138,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
        mPlayMediaNotificationSounds = (CheckBoxPreference) findPreference(KEY_PLAY_MEDIA_NOTIFICATION_SOUNDS);

        mVibrate = (CheckBoxPreference) findPreference(KEY_VIBRATE);
        mSpeakerNotifications = (CheckBoxPreference) findPreference(KEY_SPEAKER_NOTIFICATIONS);
        mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
        mDtmfTone.setPersistent(false);
        mDtmfTone.setChecked(Settings.System.getInt(resolver,
@@ -266,6 +269,12 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
            mVibrate.setChecked(vibrateSetting);
        }

	boolean speakerNotificationSetting = Settings.Secure.getInt(getContentResolver(),
                Settings.System.NOTIFICATIONS_TO_SPEAKER, 1) != 0;
        if (speakerNotificationSetting != mSpeakerNotifications.isChecked() || force) {
            mSpeakerNotifications.setChecked(speakerNotificationSetting);
        }

        int silentModeStreams = Settings.System.getInt(getContentResolver(),
                Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
        boolean isAlarmInclSilentMode = (silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0;
@@ -369,6 +378,10 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements
            Settings.System.putInt(getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED,
                    mHapticFeedback.isChecked() ? 1 : 0);

        } else if (preference == mSpeakerNotifications) {
            Settings.System.putInt(getContentResolver(), Settings.System.NOTIFICATIONS_TO_SPEAKER,
                    mSpeakerNotifications.isChecked() ? 1 : 0);

        } else if (preference == mNotificationPulse) {
            value = mNotificationPulse.isChecked();
            Settings.System.putInt(getContentResolver(),