I am in the following situation:
• My app uses the camera
• When the app is backgrounded, it goes into PiP
• It’s possible the user has a bottom sheet open when they go to background
• I am using compose navigation with
bottomSheet
destinations
How can I hide the bottom sheet when I go into PiP? I don’t really want to dismiss the bottom sheet, since I want to resume at full screen with the same back stack. Any ideas?
Chris Fillmore
01/27/2023, 4:46 PM
Currently my camera preview is coupled with my start destination, sorta like:
Copy code
@Composable
fun MyApp() {
ModalBottomSheetLayout {
NavHost {
composable("MAIN") {
// CAMERA PREVIEW LIVES HERE
}
bottomSheet("MY_SHEET") {
...
}
}
}
}
Chris Fillmore
01/27/2023, 4:52 PM
The obvious solution is to pull the camera preview out of the “MAIN” composable. But I do actually want it scoped to the lifecycle of that back stack entry. I suppose I would have to add some signalling through a new layer, that would mediate closing the camera and such, and disposing of the SurfaceView, etc.
Or is there another solution I’m missing?