[Accessibility] Migrate high text contrast under feature flag

Add Maximize Text contrast into contrast screen and hide it in "Display size and text" under feature flag

Test: manually
Bug: 241805782
Flag: aconfig
com.android.settings.accessibility.enable_color_contrast_control

Change-Id: I69049a136beba00a311c3c94fc9a49b0219a870e
This commit is contained in:
marcusge
2024-02-26 18:09:27 +00:00
parent cddd7b3660
commit 7fb14e1e54
4 changed files with 24 additions and 7 deletions

View File

@@ -4922,6 +4922,10 @@
<string name="accessibility_toggle_high_text_contrast_preference_title">High contrast text</string> <string name="accessibility_toggle_high_text_contrast_preference_title">High contrast text</string>
<!-- Summary for the accessibility preference to high contrast text. [CHAR LIMIT=NONE] --> <!-- Summary for the accessibility preference to high contrast text. [CHAR LIMIT=NONE] -->
<string name="accessibility_toggle_high_text_contrast_preference_summary">Change text color to black or white. Maximizes contrast with the background.</string> <string name="accessibility_toggle_high_text_contrast_preference_summary">Change text color to black or white. Maximizes contrast with the background.</string>
<!-- Title for the accessibility preference to high contrast text. [CHAR LIMIT=35] -->
<string name="accessibility_toggle_maximize_text_contrast_preference_title">Maximize text contrast</string>
<!-- Summary for the accessibility preference to high contrast text. [CHAR LIMIT=NONE] -->
<string name="accessibility_toggle_maximize_text_contrast_preference_summary">Change text color to black or white to increase contrast with the background.</string>
<!-- Title for the accessibility preference to auto update screen magnification. [CHAR LIMIT=35] --> <!-- Title for the accessibility preference to auto update screen magnification. [CHAR LIMIT=35] -->
<string name="accessibility_toggle_screen_magnification_auto_update_preference_title">Auto <string name="accessibility_toggle_screen_magnification_auto_update_preference_title">Auto
update screen magnification</string> update screen magnification</string>

View File

@@ -30,6 +30,14 @@
android:layout="@layout/accessibility_color_contrast_selector" android:layout="@layout/accessibility_color_contrast_selector"
settings:controller="com.android.settings.accessibility.ContrastSelectorPreferenceController"/> settings:controller="com.android.settings.accessibility.ContrastSelectorPreferenceController"/>
<SwitchPreferenceCompat
android:key="toggle_high_text_contrast_preference"
android:persistent="false"
android:summary="@string/accessibility_toggle_maximize_text_contrast_preference_summary"
android:title="@string/accessibility_toggle_maximize_text_contrast_preference_title"
settings:controller=
"com.android.settings.accessibility.HighTextContrastPreferenceController" />
<com.android.settings.accessibility.AccessibilityFooterPreference <com.android.settings.accessibility.AccessibilityFooterPreference
android:title="@string/color_contrast_note" android:title="@string/color_contrast_note"
android:selectable="false" android:selectable="false"

View File

@@ -57,9 +57,7 @@
android:key="toggle_high_text_contrast_preference" android:key="toggle_high_text_contrast_preference"
android:persistent="false" android:persistent="false"
android:summary="@string/accessibility_toggle_high_text_contrast_preference_summary" android:summary="@string/accessibility_toggle_high_text_contrast_preference_summary"
android:title="@string/accessibility_toggle_high_text_contrast_preference_title" android:title="@string/accessibility_toggle_high_text_contrast_preference_title" />
settings:controller=
"com.android.settings.accessibility.HighTextContrastPreferenceController" />
<com.android.settings.accessibility.TextReadingResetPreference <com.android.settings.accessibility.TextReadingResetPreference
android:key="reset" android:key="reset"

View File

@@ -117,6 +117,11 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
} }
} }
} }
if (Flags.enableColorContrastControl()) {
// High text contrast toggle will be added inside Color Contrast page on V+.
removePreference(HIGH_TEXT_CONTRAST_KEY);
}
} }
@Override @Override
@@ -203,10 +208,12 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
mFontWeightAdjustmentController.setEntryPoint(mEntryPoint); mFontWeightAdjustmentController.setEntryPoint(mEntryPoint);
controllers.add(mFontWeightAdjustmentController); controllers.add(mFontWeightAdjustmentController);
if (!Flags.enableColorContrastControl()) {
final HighTextContrastPreferenceController highTextContrastController = final HighTextContrastPreferenceController highTextContrastController =
new HighTextContrastPreferenceController(context, HIGH_TEXT_CONTRAST_KEY); new HighTextContrastPreferenceController(context, HIGH_TEXT_CONTRAST_KEY);
highTextContrastController.setEntryPoint(mEntryPoint); highTextContrastController.setEntryPoint(mEntryPoint);
controllers.add(highTextContrastController); controllers.add(highTextContrastController);
}
final TextReadingResetController resetController = final TextReadingResetController resetController =
new TextReadingResetController(context, RESET_KEY, new TextReadingResetController(context, RESET_KEY,