https://kotlinlang.org logo
Title
a

Abdul Basit

04/01/2023, 12:06 PM
Hi, i am trying to use decompose. I have 2 screens 1. Dashboard 2. Details In details Screen, I have a button, once clicked it will show a player view at the bottom and it should be visibile on both Screen (Dashbaord and Details). Any idea how i can achieve that ?
s

s3rius

04/01/2023, 12:22 PM
Sounds like the parent component which holds Dashboard/Details should handle the player and show the player UI alongside the active child. When the parent creates any of the child components, it passes a callback that allows the child to show the player. You can see a similar thing in this example where the main component passes
onArticleSelected
to the list component. Similarly, you probably want a
onShowPlayer
.
a

Arkadii Ivanov

04/01/2023, 12:43 PM
Also, if the player has some logic, then it might be reasonable to extract it to a separate component. Then you can use Child Overlay in the parent to show/hide the player.
a

Abdul Basit

04/01/2023, 5:10 PM
@Arkadii Ivanov i think the overlay works like a dialog in android. I want the whole screen to be enabled. The play will be at the bottom and use can interact with Dashboard and Details Screens.
a

Arkadii Ivanov

04/01/2023, 5:15 PM
No, Overlay is just a child component that can be activated/deactivated.
It doesn't stop the hosting component.
Perhaps, a better name would be Child Container?
s

s3rius

04/01/2023, 6:24 PM
I've had the same misconception about Child Overlay at first. Doesn't help that the documentation's example is creating a dialog with it. So when you're scanning the docs to get an overview of the library and its tools, you think that's what it's for.
a

Abdul Basit

04/09/2023, 7:55 AM
@Arkadii Ivanov @s3rius I have attached a dialog like
dialogNavigation.activate(DialogConfig(output.playlist))
and it is working fine. Now i have a usecase to send data to the dialog once it is active. Like i have activated it, now if there is any out from others screens, i want to update it.
a

Arkadii Ivanov

04/09/2023, 8:09 AM
There are two ways. 1. You should be able to get the instance of the dialog from the state Value returned by the childOverlay/childSlot function. Then just call a method on that instance. 2. You can create PublishSubject/SharedFlow in the parent component, and pass it as an Observable/Flow to the dialog component. Then just send data in there.
a

Abdul Basit

04/09/2023, 8:10 AM
Best, thanks