Commit Graph

14 Commits

Author SHA1 Message Date
TreeHugger Robot
2ea0a495a6 Merge "Fix NPE in DialogLaunchAnimator" into tm-qpr-dev am: 120867a3c9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20608947

Change-Id: I34450518262a6509999b1a2e73e87bd4bb716b26
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-02 11:17:24 +00:00
Jordan Demeulenaere
31da217d06 Fix NPE in DialogLaunchAnimator
This CL fixes a NPE happening in DialogLaunchAnimator if it tried to
synchronize the 2 view roots at the start/end of the animation and that
the view that triggered the animation was detached from the hierarchy.
This regression was caused by the refactoring in http://ag/20139844.

Bug: 256194999
Test: Manual
Change-Id: Id264ddfa6365bfdc952d512c2c182b6cbf4906e4
2022-12-01 18:08:36 +01:00
TreeHugger Robot
66c008ff36 Merge "Use Expandable instead of View in FooterActionsViewModel (1/2)" into tm-qpr-dev am: 4017df44ea
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20222588

Change-Id: I9e28591660c573ed1fae4a9bd2783b59ac4f13a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-20 20:36:04 +00:00
Jordan Demeulenaere
e61069746b Use Expandable instead of View in FooterActionsViewModel (1/2)
This CL replaces the reference to View by Expandable in
FooterActionsViewModel. That way, this view model can now be used by
Compose code as well.

Bug: 242040009
Test: atest FooterActionsViewModelTest
Change-Id: I6674d9a39d5daf699d67f1bb8e8ae317c85e9240
2022-10-20 10:45:49 +02:00
Jordan Demeulenaere
bde9b5f28f Extract ExpandableControllerImpl out of Expandable
This CL extracts ExpandableControllerImpl and introduces an
Expandable(ExpandableController) overload so that people can create a
controller before the Expandable that it will control. This allows to
trigger the animation from outside the Expandable. See [1] for an
example.

Outside of that new Expandable overload and
rememberExpandableController(), this is a pure refactoring.

[1] https://drive.google.com/file/d/1ghz2Zh9Syf4k2nHXddSrZxcl8Es6pA9m/view?usp=sharing

Bug: 230830644
Test: Manual
Change-Id: Iaa39a2c75e8a49770eaf5d8ce66d5ac562d9320c
Merged-In: Iaa39a2c75e8a49770eaf5d8ce66d5ac562d9320c
2022-10-12 13:32:04 +00:00
Jordan Demeulenaere
9c0637ba1a Add support for dialogs in Expandable (1/2)
This CL adds support for dialog animation in Expandable. It does so by
refactoring DialogLaunchAnimator so that its implementation doesn't
assume it is expanding a View anymore. For consistency with
ActivityLaunchAnimator.Controller, I introduced a
DialogLaunchAnimator.Controller to abstract the source of a dialog
animation.

This CL also slightly changes the behavior when a chain of dialogs is
dismissed (using DialogLaunchAnimator.dismissStack()): the top-level
dialog is not animated into the first source of the chain anymore.
The current behavior actually led to sub-optimal animations where it is
used (user switcher), so the new behavior from this CL is subjectively
better.

See b/230830644#comment11 for videos and ag/20139983 for an example.

Bug: 230830644
Test: Manual
Change-Id: I59cfc5e19d4de8e5d1fec962028d043cbd2c417b
Merged-In: I59cfc5e19d4de8e5d1fec962028d043cbd2c417b
2022-10-12 13:31:47 +00:00
Jordan Demeulenaere
7ad32c8746 Introduce Expandable to launch activities from Composables (1/2)
This CL introduces an Expandable {} composable that can be used to
easily animate an expandable element into an Activity. This Expandable
will be extended in ag/20139844 to also support dialog launches.

See b/230830644#comment11 for videos and ag/20139924 for an example.

Bug: 230830644
Test: Manual
Change-Id: I1ab9ee7052c36418b1c22155bd2281a84454ec16
Merged-In: I1ab9ee7052c36418b1c22155bd2281a84454ec16
2022-10-12 13:29:49 +00:00
Jordan Demeulenaere
227e6c78e9 Extract ExpandableControllerImpl out of Expandable
This CL extracts ExpandableControllerImpl and introduces an
Expandable(ExpandableController) overload so that people can create a
controller before the Expandable that it will control. This allows to
trigger the animation from outside the Expandable. See [1] for an
example.

Outside of that new Expandable overload and
rememberExpandableController(), this is a pure refactoring.

[1] https://drive.google.com/file/d/1ghz2Zh9Syf4k2nHXddSrZxcl8Es6pA9m/view?usp=sharing

Bug: 230830644
Test: Manual
Change-Id: Iaa39a2c75e8a49770eaf5d8ce66d5ac562d9320c
Merged-In: Iaa39a2c75e8a49770eaf5d8ce66d5ac562d9320c
2022-10-12 11:58:25 +02:00
Jordan Demeulenaere
6848267f36 Add support for dialogs in Expandable (1/2)
This CL adds support for dialog animation in Expandable. It does so by
refactoring DialogLaunchAnimator so that its implementation doesn't
assume it is expanding a View anymore. For consistency with
ActivityLaunchAnimator.Controller, I introduced a
DialogLaunchAnimator.Controller to abstract the source of a dialog
animation.

This CL also slightly changes the behavior when a chain of dialogs is
dismissed (using DialogLaunchAnimator.dismissStack()): the top-level
dialog is not animated into the first source of the chain anymore.
The current behavior actually led to sub-optimal animations where it is
used (user switcher), so the new behavior from this CL is subjectively
better.

See b/230830644#comment11 for videos and ag/20139983 for an example.

Bug: 230830644
Test: Manual
Change-Id: I59cfc5e19d4de8e5d1fec962028d043cbd2c417b
Merged-In: I59cfc5e19d4de8e5d1fec962028d043cbd2c417b
2022-10-12 11:58:01 +02:00
Jordan Demeulenaere
90b0d33609 Introduce Expandable to launch activities from Composables (1/2)
This CL introduces an Expandable {} composable that can be used to
easily animate an expandable element into an Activity. This Expandable
will be extended in ag/20139844 to also support dialog launches.

See b/230830644#comment11 for videos and ag/20139924 for an example.

Bug: 230830644
Test: Manual
Change-Id: I1ab9ee7052c36418b1c22155bd2281a84454ec16
Merged-In: I1ab9ee7052c36418b1c22155bd2281a84454ec16
2022-10-12 11:57:41 +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
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
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