Use TextInputLayout for the name field in the create/rename mode page

In addition to looking nicer, this fixes two accessibility issues ("no hint when text is entered" and "reason for disabled button is unclear").

This requires a bit of theme merging black magic, because TextInputLayout requires a Theme.AppCompat descendant, which the Settings theme isn't.

Fixes: 356398157
Fixes: 370654542
Fixes: 369942776
Test: atest ZenModeEditNamePreferenceControllerTest
Flag: android.app.modes_ui
Change-Id: I92d8ec044dabc6daed5d755e206120ec7abc143e
This commit is contained in:
Matías Hernández
2024-10-03 13:21:34 +02:00
parent fd84f1203e
commit b1e28233c1
5 changed files with 75 additions and 16 deletions

View File

@@ -9607,6 +9607,9 @@
<!-- Modes: Hint for the EditText for editing a mode's name [CHAR LIMIT=30] -->
<string name="zen_mode_edit_name_hint">Mode name</string>
<!-- Modes: Error message when editing a mode's name and the name is empty [CHAR LIMIT=40] -->
<string name="zen_mode_edit_name_empty_error">Mode name cannot be empty</string>
<!-- Modes: Text shown above the list of icons in the mode editor. [CHAR LIMIT=40] -->
<string name="zen_mode_edit_choose_icon_title">Choose an icon</string>

View File

@@ -73,6 +73,9 @@
<item name="notification_importance_button_background_color_selected">?androidprv:attr/materialColorSecondaryContainer</item>
<item name="notification_importance_button_border_color_selected">?androidprv:attr/materialColorOnSecondaryContainer</item>
<item name="notification_importance_button_foreground_color_selected">?androidprv:attr/materialColorOnSecondaryContainer</item>
<!-- For AppCompat widgets, e.g. TextInputLayout -->
<item name="colorAccent">?android:attr/colorAccent</item>
</style>
<!-- Variant of the settings theme with no action bar. -->