https://kotlinlang.org logo
s

svenjacobs

01/05/2023, 10:15 AM
Hello everybody and a Happy New Year! Let’s say I have a multi-module / multi-feature Android application in Compose. In one of the features I want to place a composable above all other composables (full screen), but of course this composable is not the top most composable in the hierarchy. I could put this composable at the very beginning in my
main
module, but then I would have a tight coupling of main and the feature. Is this even possible, a composable some layers down in the hierarchy rendering above all other composables?
a

agrosner

01/05/2023, 12:43 PM
Nothing is stopping you from injecting via di an interface that provides a composable method. Then you can inject it using di and have the implementation accept a child content slot composable
s

svenjacobs

01/05/2023, 12:46 PM
I don’t understand how this helps in my case. Do you have some (pseudo) code please?
Nevermind, I found a solution. I created a
Fullscreen
composable which adds a new
ComposeView
to Android’s root content view. Here’s the source code if you’re interested.
z

Zach Klippenstein (he/him) [MOD]

01/06/2023, 9:36 PM
Sounds like you maybe just want a popup/dialog?
s

svenjacobs

01/24/2023, 2:34 PM
@Zach Klippenstein (he/him) [MOD] But the content should not look like a popup/dialog. It’s just an arbitrary composable that should be displayed on top of all other composables regardless of the position in the hierarchy.
z

Zach Klippenstein (he/him) [MOD]

02/03/2023, 1:45 AM
What does “look like a popup” mean?
s

svenjacobs

02/04/2023, 1:19 PM
Doesn’t have a popup/dialog a frame around it?
z

Zach Klippenstein (he/him) [MOD]

02/04/2023, 6:48 PM
Compose popups don’t have any chrome or decoration. Cursor and selection handles are popups, for example. Dropdown menus use popups.
s

svenjacobs

02/05/2023, 11:13 AM
Thanks, I will have a look at this 👍🏼
3 Views