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

Commit 9dabc596 authored by Danesh Mondegarian's avatar Danesh Mondegarian Committed by Gerrit Code Review
Browse files

Launch music player on headset connect

Launches the default music player when a headset is connected

Patchset 2 - Add headset category
Patchset 3 - Remove summary

Change-Id: I1ee973bec35d95285a646b86213ced3dd15852ed
parent afbd026c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3663,6 +3663,10 @@
         [CHAR LIMIT=40] -->
    <string name="sound_category_system_title">System</string>

    <!-- Category title for headset specific Settings.
         [CHAR LIMIT=40] -->
    <string name="headset_category_title">Headset</string>

    <!-- Wifi Setup For Setup Wizard with XL screen -->
    <!-- Title shown in Wifi Setup Wizard with XL screen -->
    <string name="wifi_setup_title">Wi-Fi setup</string>
@@ -4855,6 +4859,7 @@
    <string name="volume_overlay_title">Volume panel style</string>
    <string name="volbtn_music_controls_title">Volume rocker music controls</string>
    <string name="volbtn_music_controls_summary">When screen off, long-pressing the volume rockers will seek music tracks</string>
    <string name="headset_connect_player_title">Launch music app on connect</string>
    <string name="volume_ring_only_description">Ringtone</string>
    <string name="ring_mode_title">Ring mode</string>
    <string name="ring_mode_normal">Normal</string>
+7 −0
Original line number Diff line number Diff line
@@ -137,4 +137,11 @@
        android:title="@string/dock_sounds_enable_title"
        android:defaultValue="false" />

    <PreferenceCategory
            android:title="@string/headset_category_title"/>

    <CheckBoxPreference
            android:key="headset_connect_player"
            android:title="@string/headset_connect_player_title"
            android:persistent="false" />
</PreferenceScreen>
+9 −1
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
    private static final String KEY_DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
    private static final String KEY_QUIET_HOURS = "quiet_hours";
    private static final String KEY_VOLBTN_MUSIC_CTRL = "volbtn_music_controls";
    private static final String KEY_HEADSET_CONNECT_PLAYER = "headset_connect_player";

    private static final String RING_MODE_NORMAL = "normal";
    private static final String RING_MODE_VIBRATE = "vibrate";
@@ -106,6 +107,7 @@ public class SoundSettings extends SettingsPreferenceFragment implements
    private Preference mMusicFx;
    private CheckBoxPreference mLockSounds;
    private CheckBoxPreference mVolBtnMusicCtrl;
    private CheckBoxPreference mHeadsetConnectPlayer;
    private Preference mRingtonePreference;
    private Preference mNotificationPreference;
    private PreferenceScreen mQuietHours;
@@ -212,6 +214,10 @@ public class SoundSettings extends SettingsPreferenceFragment implements
        mVolBtnMusicCtrl.setChecked(Settings.System.getInt(resolver,
                Settings.System.VOLBTN_MUSIC_CONTROLS, 1) != 0);

        mHeadsetConnectPlayer = (CheckBoxPreference) findPreference(KEY_HEADSET_CONNECT_PLAYER);
        mHeadsetConnectPlayer.setChecked(Settings.System.getInt(resolver,
                Settings.System.HEADSET_CONNECT_PLAYER, 0) != 0);

        mRingtonePreference = findPreference(KEY_RINGTONE);
        mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);

@@ -430,7 +436,9 @@ public class SoundSettings extends SettingsPreferenceFragment implements
        } else if (preference == mVolBtnMusicCtrl) {
            Settings.System.putInt(getContentResolver(), Settings.System.VOLBTN_MUSIC_CONTROLS,
                    mVolBtnMusicCtrl.isChecked() ? 1 : 0);

        } else if (preference == mHeadsetConnectPlayer) {
            Settings.System.putInt(getContentResolver(), Settings.System.HEADSET_CONNECT_PLAYER,
                    mHeadsetConnectPlayer.isChecked() ? 1 : 0);
        } else {
            // If we didn't handle it, let preferences handle it.
            return super.onPreferenceTreeClick(preferenceScreen, preference);