Loading res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -5598,6 +5598,10 @@ </string> <!-- Title for setting the brightness intensity of the display using Reduce Brightness. [CHAR LIMIT=NONE] --> <string name="reduce_bright_colors_intensity_preference_title">Intensity</string> <!-- Start label for slider that reduces the brightness intensity of the display using Extra Dim. [CHAR LIMIT=NONE] --> <string name="reduce_bright_colors_intensity_start_label">Dimmer</string> <!-- End label for slider that reduces the brightness intensity of the display using Extra Dim. [CHAR LIMIT=NONE] --> <string name="reduce_bright_colors_intensity_end_label">Brighter</string> <!-- Title for setting whether the Reduce Brightness activation state persists across reboots. [CHAR LIMIT=NONE] --> <string name="reduce_bright_colors_persist_preference_title">Keep on after device restarts</string> res/xml/reduce_bright_colors_settings.xml +7 −2 Original line number Diff line number Diff line Loading @@ -17,13 +17,18 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:persistent="false" android:title="@string/reduce_bright_colors_preference_title"> <com.android.settings.widget.SeekBarPreference <com.android.settings.widget.LabeledSeekBarPreference android:key="rbc_intensity" android:persistent="false" android:title="@string/reduce_bright_colors_intensity_preference_title"/> android:title="@string/reduce_bright_colors_intensity_preference_title" settings:textStart="@string/reduce_bright_colors_intensity_start_label" settings:textEnd="@string/reduce_bright_colors_intensity_end_label" settings:tickMark="@android:color/transparent" /> <SwitchPreference android:key="rbc_persist" Loading src/com/android/settings/accessibility/ReduceBrightColorsIntensityPreferenceController.java +8 −4 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.settings.widget.SeekBarPreference; /** PreferenceController for feature intensity. */ public class ReduceBrightColorsIntensityPreferenceController extends SliderPreferenceController { private static final int INVERSE_PERCENTAGE_BASE = 100; private final ColorDisplayManager mColorDisplayManager; public ReduceBrightColorsIntensityPreferenceController(Context context, String key) { Loading Loading @@ -66,21 +67,24 @@ public class ReduceBrightColorsIntensityPreferenceController extends SliderPrefe @Override public int getSliderPosition() { return mColorDisplayManager.getReduceBrightColorsStrength(); return INVERSE_PERCENTAGE_BASE - mColorDisplayManager.getReduceBrightColorsStrength(); } @Override public boolean setSliderPosition(int position) { return mColorDisplayManager.setReduceBrightColorsStrength(position); return mColorDisplayManager.setReduceBrightColorsStrength( INVERSE_PERCENTAGE_BASE - position); } @Override public int getMax() { return ColorDisplayManager.getMaximumReduceBrightColorsStrength(mContext); return INVERSE_PERCENTAGE_BASE - ColorDisplayManager.getMinimumReduceBrightColorsStrength(mContext); } @Override public int getMin() { return ColorDisplayManager.getMinimumReduceBrightColorsStrength(mContext); return INVERSE_PERCENTAGE_BASE - ColorDisplayManager.getMaximumReduceBrightColorsStrength(mContext); } } tests/unit/src/com/android/settings/accessibility/ReduceBrightColorsIntensityPreferenceControllerTest.java +5 −3 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ public class ReduceBrightColorsIntensityPreferenceControllerTest { assertThat( Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL, 0)) .isEqualTo(20); .isEqualTo(80); } @Test Loading @@ -92,8 +92,10 @@ public class ReduceBrightColorsIntensityPreferenceControllerTest { when(mResources.getInteger( R.integer.config_reduceBrightColorsStrengthMax)).thenReturn(90); when(mResources.getInteger( R.integer.config_reduceBrightColorsStrengthMin)).thenReturn(10); R.integer.config_reduceBrightColorsStrengthMin)).thenReturn(15); assertThat(mPreferenceController.getMax()).isEqualTo(85); assertThat(mPreferenceController.getMin()).isEqualTo(10); assertThat(mPreferenceController.getMax() - mPreferenceController.getMin()) .isEqualTo(80); .isEqualTo(75); } } Loading
res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -5598,6 +5598,10 @@ </string> <!-- Title for setting the brightness intensity of the display using Reduce Brightness. [CHAR LIMIT=NONE] --> <string name="reduce_bright_colors_intensity_preference_title">Intensity</string> <!-- Start label for slider that reduces the brightness intensity of the display using Extra Dim. [CHAR LIMIT=NONE] --> <string name="reduce_bright_colors_intensity_start_label">Dimmer</string> <!-- End label for slider that reduces the brightness intensity of the display using Extra Dim. [CHAR LIMIT=NONE] --> <string name="reduce_bright_colors_intensity_end_label">Brighter</string> <!-- Title for setting whether the Reduce Brightness activation state persists across reboots. [CHAR LIMIT=NONE] --> <string name="reduce_bright_colors_persist_preference_title">Keep on after device restarts</string>
res/xml/reduce_bright_colors_settings.xml +7 −2 Original line number Diff line number Diff line Loading @@ -17,13 +17,18 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:persistent="false" android:title="@string/reduce_bright_colors_preference_title"> <com.android.settings.widget.SeekBarPreference <com.android.settings.widget.LabeledSeekBarPreference android:key="rbc_intensity" android:persistent="false" android:title="@string/reduce_bright_colors_intensity_preference_title"/> android:title="@string/reduce_bright_colors_intensity_preference_title" settings:textStart="@string/reduce_bright_colors_intensity_start_label" settings:textEnd="@string/reduce_bright_colors_intensity_end_label" settings:tickMark="@android:color/transparent" /> <SwitchPreference android:key="rbc_persist" Loading
src/com/android/settings/accessibility/ReduceBrightColorsIntensityPreferenceController.java +8 −4 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import com.android.settings.widget.SeekBarPreference; /** PreferenceController for feature intensity. */ public class ReduceBrightColorsIntensityPreferenceController extends SliderPreferenceController { private static final int INVERSE_PERCENTAGE_BASE = 100; private final ColorDisplayManager mColorDisplayManager; public ReduceBrightColorsIntensityPreferenceController(Context context, String key) { Loading Loading @@ -66,21 +67,24 @@ public class ReduceBrightColorsIntensityPreferenceController extends SliderPrefe @Override public int getSliderPosition() { return mColorDisplayManager.getReduceBrightColorsStrength(); return INVERSE_PERCENTAGE_BASE - mColorDisplayManager.getReduceBrightColorsStrength(); } @Override public boolean setSliderPosition(int position) { return mColorDisplayManager.setReduceBrightColorsStrength(position); return mColorDisplayManager.setReduceBrightColorsStrength( INVERSE_PERCENTAGE_BASE - position); } @Override public int getMax() { return ColorDisplayManager.getMaximumReduceBrightColorsStrength(mContext); return INVERSE_PERCENTAGE_BASE - ColorDisplayManager.getMinimumReduceBrightColorsStrength(mContext); } @Override public int getMin() { return ColorDisplayManager.getMinimumReduceBrightColorsStrength(mContext); return INVERSE_PERCENTAGE_BASE - ColorDisplayManager.getMaximumReduceBrightColorsStrength(mContext); } }
tests/unit/src/com/android/settings/accessibility/ReduceBrightColorsIntensityPreferenceControllerTest.java +5 −3 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ public class ReduceBrightColorsIntensityPreferenceControllerTest { assertThat( Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.REDUCE_BRIGHT_COLORS_LEVEL, 0)) .isEqualTo(20); .isEqualTo(80); } @Test Loading @@ -92,8 +92,10 @@ public class ReduceBrightColorsIntensityPreferenceControllerTest { when(mResources.getInteger( R.integer.config_reduceBrightColorsStrengthMax)).thenReturn(90); when(mResources.getInteger( R.integer.config_reduceBrightColorsStrengthMin)).thenReturn(10); R.integer.config_reduceBrightColorsStrengthMin)).thenReturn(15); assertThat(mPreferenceController.getMax()).isEqualTo(85); assertThat(mPreferenceController.getMin()).isEqualTo(10); assertThat(mPreferenceController.getMax() - mPreferenceController.getMin()) .isEqualTo(80); .isEqualTo(75); } }