Commit Graph

10 Commits

Author SHA1 Message Date
Matías Hernández
b676ca3a62 Fix several issues related to CircularIconsPreference
* Sometimes would cause an unending stream of accessibility events (particularly if starting off-screen). This would break TalkBack and anything that depends on UiAutomator (although the system itself took it like a champ).
* Sometimes would not load images (because the ViewTreeObserver would never fire onGlobalLayout after being added because measured width was 0, even though a new width was calculated later).
* Would not recalculate the number of icons that fit if the width changes after the first layout.

Combining ViewHolders with waiting for measuring and/or ViewTreeObservers was always a wonky approach, even though it should've worked in theory. This should be more robust.

Also fixes the unwanted animation on mode screen load related to the absence of the header name being applied a tad too late.

Fixes: 359948417
Fixes: 360072876
Fixes: 360328804
Test: atest SettingsRoboTests + manual + adb shell uiautomator events
Flag: android.app.modes_ui
Change-Id: I7e5dfbdab220d1ebc1c68e5e87ce544ee86b6a65
2024-08-16 16:20:38 +02:00
Matías Hernández
115d29e851 Animate the color transition (active<->inactive) in the mode header icon
Also, don't apply the layout params, etc on each call to updateState - once per displayPreference is enough.

Fixes: 356399449
Bug: 357861830
Test: manual
Flag: android.app.modes_ui
Change-Id: I6967ea1745377d0f514ca0f68101043f017a8fd7
2024-08-13 19:23:17 +02:00
Matías Hernández
f1cd68ebd3 Reduce the size of individual icons in the icon picker
Bug: 359171199
Test: manual
Flag: android.app.modes_ui
Change-Id: Iba5c09948437887f12b946aa39f7c811437f20dc
2024-08-12 18:04:43 +02:00
Matías Hernández
246960de0c Update top of modes page
* Show blurb based on mode type.
* Make the icon bigger and highlight it when mode is active.
* Increase spacing between elements.

Also eliminate some code duplication between header of mode page and header of icon picker.

Fixes: 355415875
Test: manual
Flag: android.app.modes_ui
Change-Id: I7e788b9b5920cedb791d1571b19b37e65ece6d0b
2024-07-25 21:28:27 +02:00
Matías Hernández
d8b9fe8f01 Show icons for allowed contacts
Test: atest com.android.settings.notification.modes
Bug: 346551087
Flag: android.app.modes_ui
Change-Id: If2b6b06b4a9c16bdefb03850ad1615e96c601fbd
2024-07-22 14:20:25 +02:00
Matías Hernández
352100397f Show icons for allowed sounds
(Some icons are temporary, until we get the final assets)

Also some fixes/improvements to CircularIconsPreference:
* Show the correct placeholder and +N icons.
* Fix the displayIcons-before-measure case (global layout listener was incorrect).
* Properly cancel pending image load futures (field didn't point to the actual future).
* Don't reload icons if it's the same set (depends on equals() for the items, so unfortunately doesn't work for AppEntry yet).

Test: atest com.android.settings.notification.modes
Bug: 346551087
Flag: android.app.modes_ui
Change-Id: I9d029a5fdd785ada4e2ba4d8a90eba72b5fb9085
2024-07-19 15:30:45 +00:00
Matías Hernández
45f1e819d3 Icon picker: Styling improvements
Instead of a the plain appearance of a EntityHeaderController, make the top icon bigger and use the same circled style as the choices in the list. Also highlight the current icon in the list as selected, even if it is the default for the mode type.

Also cleaned up controllers that don't need a ZenModesBackend to not receive it.

(Both of these changes also line up with the "new mode" fragment that is incoming).

Bug: 333901673
Bug: 326442408
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: I0c9f3e34019a1a6c48658933dde545ad8d7399ae
2024-07-02 12:12:02 +02:00
Matías Hernández
c2d2de085d Changes to icon picker for reusability in "add mode" flow
* Don't finish the fragment from the controller (ugh!) instead just report the selected icon via a listener.
* Highlight the selected icon in the list.
* Cache the icon drawables (since we're using selectors for the colors, we don't need to swap them, one per icon resource id is enough).
* Improved the tests a bit too.

Bug: 333901673
Bug: 326442408
Test: ates
Flag: android.app.modes_ui
Change-Id: Ib2ec7a7e3ed99b13f9264aa6f7c209ee3f6967a0
2024-06-26 11:38:56 +02:00
Matías Hernández
bcc608fbb2 Style priority modes items in aggregator
* Different color if active.
* Trigger description / "ON" / "Paused" / "Tap to set up" depending on enabled and active status (strings may be revised later).

This CL also adds a helper class to create ZenModes, reducing boilerplate in unit tests.

Bug: 346575288
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: Ia0e16b8be5284d13bed4366cbee0f92748bf2f85
2024-06-24 11:56:11 +02:00
Matías Hernández
8d397f038f Add icon picker for zen modes
Bug: 333901673
Test: atest ZenModeIconPickerListPreferenceControllerTest
Flag: android.app.modes_ui
Change-Id: Ib6faaac7c93b25423d18dbdcd0a2310de15fa86f
2024-06-10 19:37:49 +02:00