* 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
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
* 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
(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
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
* 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
* 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