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

Commit ec491e41 authored by Bruno Martins's avatar Bruno Martins
Browse files

ButtonSettings: Implement support for keyboard lights toggle mode only

Up until now, it was assumed that all devices with keyboard lights
had variable brightness control. Add support for those that only
support lights on / lights off.

Change-Id: If6c79411fd046efdea6554946b192cf2d135395a
parent 92e3fd38
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ public class ButtonBacklightBrightness extends CustomDialogPreference<AlertDialo
        SeekBar.OnSeekBarChangeListener {
    private static final int BUTTON_BRIGHTNESS_TOGGLE_MODE_ONLY = 1;
    private static final int DEFAULT_BUTTON_TIMEOUT = 5;
    private static final int KEYBOARD_BRIGHTNESS_TOGGLE_MODE_ONLY = 1;

    public static final String KEY_BUTTON_BACKLIGHT = "pre_navbar_button_backlight";

@@ -69,8 +70,11 @@ public class ButtonBacklightBrightness extends CustomDialogPreference<AlertDialo
        setDialogLayoutResource(R.layout.button_backlight);

        if (DeviceUtils.hasKeyboardBacklightSupport(context)) {
            final boolean isSingleValue = KEYBOARD_BRIGHTNESS_TOGGLE_MODE_ONLY ==
                    context.getResources().getInteger(org.lineageos.platform.internal.R.integer
                            .config_deviceSupportsKeyboardBrightnessControl);
            mKeyboardBrightness = new BrightnessControl(
                    LineageSettings.Secure.KEYBOARD_BRIGHTNESS, false);
                    LineageSettings.Secure.KEYBOARD_BRIGHTNESS, isSingleValue);
            mActiveControl = mKeyboardBrightness;
        }
        if (DeviceUtils.hasButtonBacklightSupport(context)) {