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

Commit 6877ca71 authored by Eran's avatar Eran
Browse files

Updated settings to conform with volume button behaviour.

Change-Id: I470974ffdc28d8062210d510a8976ad6507ad091
parent 0a3d73ca
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1035,6 +1035,10 @@
    <string name="vibrate_title">Vibrate</string>
    <!-- Sound settings screen, setting option summary text -->
    <string name="vibrate_summary">Vibration feedback for calls and notifications</string>
    <!-- Sound settings screen, setting option name checkbox -->
    <string name="volume_control_silent_title">Silent state</string>
    <!-- Sound settings screen, setting option summary text -->
    <string name="volume_control_silent_summary">Add a state for complete silence to volume control</string>
    <!-- Sound settings screen, setting option name -->
    <string name="notification_sound_title">Notification ringtone</string>
    <!-- Sound settings screen, setting option summary text -->
+7 −0
Original line number Diff line number Diff line
@@ -36,6 +36,13 @@
            android:entries="@array/vibrate_entries"
            android:entryValues="@array/vibrate_values" />

    <CheckBoxPreference
            android:key="volume_control_silent"
            android:title="@string/volume_control_silent_title"
            android:summary="@string/volume_control_silent_summary"
            android:persistent="false"
            android:disableDependentsState="true" />

    <com.android.settings.RingerVolumePreference
            android:key="ring_volume"
            android:dependency="silent"
+17 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public class SoundSettings extends PreferenceActivity implements

    private static final String KEY_SILENT = "silent";
    private static final String KEY_VIBRATE = "vibrate";
    private static final String KEY_VOLUME_CONTROL_SILENT = "volume_control_silent";
    private static final String KEY_DTMF_TONE = "dtmf_tone";
    private static final String KEY_SOUND_EFFECTS = "sound_effects";
    private static final String KEY_HAPTIC_FEEDBACK = "haptic_feedback";
@@ -66,6 +67,7 @@ public class SoundSettings extends PreferenceActivity implements
    private static final String VALUE_VIBRATE_UNLESS_SILENT = "notsilent";

    private CheckBoxPreference mSilent;
    private CheckBoxPreference mVolumeControlSilent;

    /*
     * If we are currently in one of the silent modes (the ringer mode is set to either
@@ -117,6 +119,11 @@ public class SoundSettings extends PreferenceActivity implements
        mVibrate = (ListPreference) findPreference(KEY_VIBRATE);
        mVibrate.setOnPreferenceChangeListener(this);

        mVolumeControlSilent = (CheckBoxPreference)
                findPreference(KEY_VOLUME_CONTROL_SILENT);
        mVolumeControlSilent.setChecked(Settings.System.getInt(resolver,
                Settings.System.VOLUME_CONTROL_SILENT, 0) == 1);

        mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
        mDtmfTone.setPersistent(false);
        mDtmfTone.setChecked(Settings.System.getInt(resolver,
@@ -301,6 +308,10 @@ public class SoundSettings extends PreferenceActivity implements
        }
        mVibrate.setSummary(mVibrate.getEntry());

        boolean vibeInSilent = (1 == Settings.System.getInt(getContentResolver(),
                                                            Settings.System.VIBRATE_IN_SILENT,1));
        mVolumeControlSilent.setEnabled(vibeInSilent);

        int silentModeStreams = Settings.System.getInt(getContentResolver(),
                Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
        boolean isAlarmInclSilentMode = (silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0;
@@ -324,6 +335,12 @@ public class SoundSettings extends PreferenceActivity implements
                mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
            }
            updateState(false);

        } else if (preference == mVolumeControlSilent) {
            boolean value = mVolumeControlSilent.isChecked();
            Settings.System.putInt(getContentResolver(),
                    Settings.System.VOLUME_CONTROL_SILENT, value ? 1 : 0);

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