Commit Graph

13 Commits

Author SHA1 Message Date
Jordan Demeulenaere
0d5de04586 Move the Compose Gallery to our vendor repository (2/2)
Bug: 247473910
Test: Builds
Change-Id: I665f351cda86dc6588946b8449fbb1c13fcba503
2022-09-21 13:47:57 +02:00
Jordan Demeulenaere
13590497c4 Introduce lambda-based modifiers
This CL introduces some lambda-based modifiers to change the alpha,
paddings or size of a Composable without triggering recomposition when
those values change. This is especially useful when animating these
values, which happens a lot in the SystemUI shade given that a lot of
components size/alpha is driven by touch gestures.

Test: Manual
Bug: 247473910
Change-Id: If63d302dcad5ad753b4ebf90ed239e598baa55c1
2022-09-21 13:47:55 +02:00
Jordan Demeulenaere
3d389de356 Fork Pager from Accompanist
This CL forks the Pager API from Accompanist. Note that I took the
version 0.20.0 of Accompanist [1], which is the version right before the
Pager API starts depending on dev.chrisbanes.snapper [1], which I'm not
sure is ok to fork in the platform.

[1] https://github.com/google/accompanist/releases/tag/v0.20.0
[2] 498301e4d4

Bug: 247473910
Test: Manual
Change-Id: I57947a196be84af9c34365377588e50b8f249af0
2022-09-20 12:06:02 +02:00
Alejandro Nijamkin
60aff8eef5 Adds UserSwitcher screen to Compose Gallery app
Bug: 246002091
Test: This is a test for the parent CL
Change-Id: Ia1e4c360a072c79d8f57bfdb473d55463b27a3e4
2022-09-16 04:30:01 -07:00
Alejandro Nijamkin
4066809d02 UserSwitcher in Compose.
Adds a screen to the gallery app to test it. Did not end up using the UI
screenshot diff test because the buttons are not the same in Compose as
they are in this bespoke UI. The UI is simple enough that I was able to
get close enough.

Fix: 246002091
Test: In the next CL, a screen is added to the gallery app to test it.
Change-Id: I90d871bb819ecd7bd75a3f55746a94f7a37f68c2
2022-09-13 10:17:10 -07:00
Alejandro Nijamkin
a08bca15cf Adds Compose buttons.
Includes logic to add them to the Compose Gallery app.

There's probably a lot of work that still needs to go into Buttons.kt
but this is a start.

Bug: 246002087
Test: Compose gallery app screen for buttons
Change-Id: If284f43c205b04009b63d5eab2cc53f3b334e515
2022-09-12 17:41:22 -07:00
Ale Nijamkin
2c912c9e68 Merge "UI screenshot diff test for user switcher." into tm-qpr-dev 2022-09-09 22:36:45 +00:00
Alejandro Nijamkin
6c8603d9a1 UI screenshot diff test for user switcher.
Using the new, modern architecture user switcher UI, we implement a UI
screenshot diff test for it. This is a prerequisite for the next step,
where we replace the XML file and view-binder code with a Jetpack
Compose implementation.

Bug: 243843440
Test: N/A this CL is a test
Change-Id: I2831129f44702007be64133a3edcd418e30bd4c1
2022-09-08 13:20:45 -07:00
Caitlin Shkuratov
f1f573f9b2 [View binding] Add ContentDescription as part of the Icon viewmodel.
This mimics how Compose treats icons, and reminds future users of `Icon`
to add content descriptions (or choicefully not have one).

Bug: 238425913
Test: tests in systemui.qs.footer
Test: tests in systemui.statusbar.pipeline
Test: Turn on flag 507 and ensure QS footer actions still have content
descriptions

Change-Id: Ia86e50f43c36325ef7523b86dc4a8ca9b269325e
2022-09-07 14:43:32 +00:00
Jordan Demeulenaere
00773ec038 Add screenshot test for the footer actions (2/2)
Bug: 243636422
Test: atest FooterActionsScreenshotTest
Change-Id: I3339dbaa2c3684f5020e2956aaa27a2b3896fdb6
2022-08-25 16:24:05 +02:00
Jordan Demeulenaere
6fb22d4b16 Implementation of the FooterActions following the MAD (1/3)
This CL provides most of the implementation of the QS FooterActions
following the modern Android architecture. In particular, this CL
includes:
 - repositories in the data layer.
 - an interactor in the domain layer.
 - a view model in the ui layer.

The ViewBinder is added in ag/19674347, given that it comes together
with changes to the existing XML files.

Note that after this CL, the new implementation will still not be used
as it won't be wired yet. This is done in ag/19674347.

The highest value of the tests is in FooterActionsViewModelTest, which
focuses on testing the *state* (view model) of the footer actions using
the *real implementation* of the repositories, interactor and viewModel
all together. To do so, I implemented a FooterActionsUtils class that
allows to *easily* create real implementations of those repositories,
interactor and view model, without requiring the caller to provide any
parameter. I believe that this is even better than introducing new
fakes, and it should hopefully lead us towards using more and more of
the real implementations in our tests, and less and less of fakes/mocks,
making the tests much more useful. Of course, I still had to use fake &
mocks for the classes I'm calling to and for which instantiating the
actual object is too painful. As you can see, there are no test files
for the repositories: given that we already use the real implementations
in the ViewModel tests, they are defacto already tested.

I still added some tests on *interactions* (not *state*) in
FooterActionsInteractorTest. Even though I believe those tests don't
provide much value (they are merely a copy/paste of the implementation),
I preferred keeping the same coverage as the current tests (some of
which are going to be removed in ag/19674347).

Note that the business logic contained in this CL was mostly copy/pasted
from the current implementation, as I wanted to make sure that this is
going to be a pure refactoring that does not change the logic of this
feature. Still, I left some TODOs in the code for potential
improvements.

Bug: 242040009
Test: atest FooterActionsViewModelTest
Test: atest FooterActionsInteractorTest
Change-Id: Ia0bdf9824e098ad6604709f5db87576437b0a904
2022-08-25 16:24:00 +02:00
Jordan Demeulenaere
66d123f87c Implement the People UI in Compose (1/2)
This CL implements the People UI using Jetpack Compose. Note that this
implementation won't be used by SystemUI yet, and can only be viewed
using the SystemUIGallery app at the moment.

Once ag/19500380 is submitted (blocked by b/236146570), the screenshot
tests will use the Compose implementation. You can see the visual
difference between the implementations in ag/19498514. As explained in
b/238993727#comment10 the result is slightly different (and improved
over the current View implementation).

Note that the fake values of this screen have been moved from the
current PeopleSpaceScreenshotTest, and are now reused there as well (see
ag/19568794).

Bug: 238993727
Test: atest SystemUIGoogleScreenshotTests
Change-Id: I4d2f241ccf768ef3fccc01ce196418ce7fc26492
2022-08-17 11:28:38 +02:00
Jordan Demeulenaere
359df6fe7a Move the compose code to tm-qpr-dev (1/2)
This CL moves all the current Compose code from master to tm-qpr-dev,
which is possible now that all Compose dependencies have been cherry
picked to tm-qpr-dev.

Note that I used the SHA of ag/19398175 for this CL Change-Id and
Merged-In tags, which is the last CL in master that changed code in the
compose/ folder. That way, we make sure that we don't try to merge this
code back into master.

Bug: 231131244
Test: m SystemUIComposeGallery
Change-Id: Ic3efb42d371c6aac8c2a6297a0cb192a780903cd
Merged-In: Ic3efb42d371c6aac8c2a6297a0cb192a780903cd
2022-08-08 12:26:57 +02:00