Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 35276450 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Introduce SystemUIDialogFactory to create (Compose) SystemUIDialogs

This CL introduces SystemUIDialogFactory and ComponentSystemUIDialog to
easily create a SystemUIDialog whose content can then be set and whose
lifecycle can be observed. This way, people don't have to extend
SystemUIDialog all the time and we can very easily create dialogs with
custom content. The lifecycle and implementation of
SavedStateRegistryOwner is also required to set a Compose content on the
dialog. The implementation of ComponentSystemUIDialog was forked
directly from AndroidX ComponentDialog (http://shortn/_Fn58HvXtUt), with
the notable exception of onStop() that is slightly different than the
original (see the TODO there and b/296180426).

I then added an extension function on SystemUIDialogFactory to create a
SystemUIDialog with a Compose content. Note that the background of the
dialog is still drawn on the DecorView (like all SystemUIDialogs), but
the content itself is all drawn by Compose. That way, Compose dialogs
automatically play nicely with (Activity|Dialog)LaunchAnimator. I also
provide an AlertDialogContent to be used together with this extension
function to create simple dialogs with title, icon (optional), content
and buttons (optional).

This CL also updates the colors of the PlatformButtons to match the new
colors in the View system that were recently updated in
http://ag/23711768.

See b/283817398#comment6 for a video and screenshots.

Bug: 283817398
Test: atest ComposeDialogScreenshotTest
Change-Id: I537f77a2be639d6d97b247ae8d8d9ca5ec0214c3
parent f353aecc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment