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

Commit 5d567ff1 authored by sallyyuen's avatar sallyyuen
Browse files

set enabled state of persist switch when Extra Dim state is changed

Bug: 186806715
Test: manual,
atest ReduceBrightColorsPersistencePreferenceControllerTest

Change-Id: Icad35cb6bc8ac3a6b8edf518d18898c277cca5e3
parent ffbea30a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.content.Context;
import android.hardware.display.ColorDisplayManager;
import android.provider.Settings;

import androidx.preference.Preference;

import com.android.settings.core.TogglePreferenceController;

/** PreferenceController for persisting feature activation state after a restart. */
@@ -54,4 +56,10 @@ public class ReduceBrightColorsPersistencePreferenceController extends TogglePre
        return Settings.Secure.putInt(mContext.getContentResolver(),
                Settings.Secure.REDUCE_BRIGHT_COLORS_PERSIST_ACROSS_REBOOTS, (isChecked ? 1 : 0));
    }

    @Override
    public final void updateState(Preference preference) {
        super.updateState(preference);
        preference.setEnabled(mColorDisplayManager.isReduceBrightColorsActivated());
    }
}