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

Commit d8e437ce authored by Steve Kondik's avatar Steve Kondik
Browse files

settings: Move headset option, hide MoreDeviceSettings if empty

 * This option fits much better in the sound menu under "automation
   and effects", and on many devices it's the only option in the
   "More..." menu under Tap & Pay.
 * Move it, and remove the MoreDeviceSettings top-level category if
   there's nothing else in it.

Change-Id: Idd82f582a1ba54f8b45fbd4fbe631057e9515f86
parent bb223dca
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -51,15 +51,4 @@

    </PreferenceCategory>

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

        <com.android.settings.cyanogenmod.SystemSettingCheckBoxPreference
            android:key="headset_connect_player"
            android:title="@string/headset_connect_player_title"
            android:summary="@string/headset_connect_player_summary"
            android:defaultValue="false" />

    </PreferenceCategory>

</PreferenceScreen>
+7 −0
Original line number Diff line number Diff line
@@ -56,6 +56,13 @@
            android:key="musicfx"
            android:title="@string/musicfx_title" />

    <!-- Headset -->
    <com.android.settings.cyanogenmod.SystemSettingCheckBoxPreference
            android:key="headset_connect_player"
            android:title="@string/headset_connect_player_title"
            android:summary="@string/headset_connect_player_summary"
            android:defaultValue="false" />

    <PreferenceCategory
            android:key="category_calls_and_notification"
            android:title="@string/sound_category_call_ringtone_vibrate_title"/>
+4 −0
Original line number Diff line number Diff line
@@ -680,6 +680,10 @@ public class Settings extends PreferenceActivity
                if(!Utils.isPackageInstalled(this, VOICE_WAKEUP_PACKAGE_NAME)) {
                    target.remove(header);
                }
            } else if (id == R.id.more_device_settings) {
                if (!MoreDeviceSettings.hasItems()) {
                    target.remove(header);
                }
            }

            if (i < target.size() && target.get(i) == header
+6 −4
Original line number Diff line number Diff line
@@ -16,13 +16,10 @@

package com.android.settings.cyanogenmod;

import android.content.ContentResolver;
import android.content.Context;
import android.os.Bundle;
import android.os.Vibrator;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;

import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
@@ -43,7 +40,6 @@ public class MoreDeviceSettings extends SettingsPreferenceFragment {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.xml.more_device_settings);
        ContentResolver resolver = getContentResolver();

        Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
        if (!VibratorIntensity.isSupported() || vibrator == null || !vibrator.hasVibrator()) {
@@ -64,4 +60,10 @@ public class MoreDeviceSettings extends SettingsPreferenceFragment {
            }
        }
    }

    public static boolean hasItems() {
        return DisplayColor.isSupported() ||
               DisplayGamma.isSupported() ||
               VibratorIntensity.isSupported();
    }
}