Settings: Add a preference controller for Volume steps settings
* Enable volume steps pref by default
This commit is contained in:
@@ -67,4 +67,7 @@
|
|||||||
|
|
||||||
<!-- Whether to show double tap ambient settings -->
|
<!-- Whether to show double tap ambient settings -->
|
||||||
<bool name="config_supports_double_tap_ambient" translatable="false">false</bool>
|
<bool name="config_supports_double_tap_ambient" translatable="false">false</bool>
|
||||||
|
|
||||||
|
<!-- Whether to show volume steps settings -->
|
||||||
|
<bool name="config_supports_volume_steps" translatable="false">true</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -116,8 +116,9 @@
|
|||||||
android:key="volume_steps"
|
android:key="volume_steps"
|
||||||
android:title="@string/volume_steps_title"
|
android:title="@string/volume_steps_title"
|
||||||
android:summary="@string/volume_steps_summary"
|
android:summary="@string/volume_steps_summary"
|
||||||
android:fragment="com.android.settings.sound.VolumeSteps"
|
android:fragment="com.android.settings.sound.VolumeStepsSettings"
|
||||||
android:order="-135"/>
|
android:order="-135"
|
||||||
|
settings:controller="com.android.settings.sound.VolumeStepsPreferenceController"/>
|
||||||
|
|
||||||
<!-- TODO(b/174964721): make this a PrimarySwitchPreference -->
|
<!-- TODO(b/174964721): make this a PrimarySwitchPreference -->
|
||||||
<!-- Interruptions -->
|
<!-- Interruptions -->
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ import com.android.settings.security.SecurityAdvancedSettings;
|
|||||||
import com.android.settings.security.SecuritySettings;
|
import com.android.settings.security.SecuritySettings;
|
||||||
import com.android.settings.shortcut.CreateShortcut;
|
import com.android.settings.shortcut.CreateShortcut;
|
||||||
import com.android.settings.sound.MediaControlsSettings;
|
import com.android.settings.sound.MediaControlsSettings;
|
||||||
import com.android.settings.sound.VolumeSteps;
|
import com.android.settings.sound.VolumeStepsSettings;
|
||||||
import com.android.settings.support.SupportDashboardActivity;
|
import com.android.settings.support.SupportDashboardActivity;
|
||||||
import com.android.settings.system.ResetDashboardFragment;
|
import com.android.settings.system.ResetDashboardFragment;
|
||||||
import com.android.settings.system.SystemDashboardFragment;
|
import com.android.settings.system.SystemDashboardFragment;
|
||||||
@@ -428,7 +428,7 @@ public class SettingsGateway {
|
|||||||
ToggleScreenMagnificationPreferenceFragment.class.getName(),
|
ToggleScreenMagnificationPreferenceFragment.class.getName(),
|
||||||
FlashNotificationsPreferenceFragment.class.getName(),
|
FlashNotificationsPreferenceFragment.class.getName(),
|
||||||
PrivateDnsSettings.class.getName(),
|
PrivateDnsSettings.class.getName(),
|
||||||
VolumeSteps.class.getName(),
|
VolumeStepsSettings.class.getName(),
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final String[] SETTINGS_FOR_RESTRICTED = {
|
public static final String[] SETTINGS_FOR_RESTRICTED = {
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019-2024 The Evolution X Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.sound;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.BasePreferenceController;
|
||||||
|
|
||||||
|
public class VolumeStepsPreferenceController extends BasePreferenceController {
|
||||||
|
|
||||||
|
public VolumeStepsPreferenceController(Context context, String key) {
|
||||||
|
super(context, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAvailabilityStatus() {
|
||||||
|
return mContext.getResources().getBoolean(R.bool.config_supports_volume_steps)
|
||||||
|
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,10 +37,10 @@ import org.evolution.settings.preferences.CustomSeekBarPreference;
|
|||||||
* volume steps settings under sound
|
* volume steps settings under sound
|
||||||
*/
|
*/
|
||||||
@SearchIndexable
|
@SearchIndexable
|
||||||
public class VolumeSteps extends SettingsPreferenceFragment implements
|
public class VolumeStepsSettings extends SettingsPreferenceFragment implements
|
||||||
Preference.OnPreferenceChangeListener {
|
Preference.OnPreferenceChangeListener {
|
||||||
|
|
||||||
private static final String TAG = "VolumeSteps";
|
private static final String TAG = "VolumeStepsSettings";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
Reference in New Issue
Block a user