|
1 | 1 | package app.grapheneos.camera.ui.composable.screen.ui |
2 | 2 |
|
| 3 | +import android.app.Activity |
3 | 4 | import android.widget.Toast |
4 | 5 | import androidx.compose.animation.AnimatedVisibility |
5 | 6 | import androidx.compose.animation.animateColorAsState |
@@ -37,11 +38,15 @@ import androidx.compose.ui.Modifier |
37 | 38 | import androidx.compose.ui.graphics.Color |
38 | 39 |
|
39 | 40 | import androidx.compose.ui.platform.LocalContext |
| 41 | +import androidx.compose.ui.platform.LocalView |
40 | 42 | import androidx.compose.ui.res.stringResource |
41 | 43 | import androidx.compose.ui.text.style.TextAlign |
42 | 44 | import androidx.compose.ui.unit.LayoutDirection |
43 | 45 | import androidx.compose.ui.unit.dp |
44 | 46 | import androidx.compose.ui.unit.sp |
| 47 | +import androidx.core.view.WindowCompat |
| 48 | +import androidx.core.view.WindowInsetsCompat |
| 49 | +import androidx.core.view.WindowInsetsControllerCompat |
45 | 50 |
|
46 | 51 | import androidx.lifecycle.viewmodel.compose.viewModel |
47 | 52 | import app.grapheneos.camera.CapturedItem |
@@ -74,6 +79,12 @@ fun GalleryScreen( |
74 | 79 | ) { |
75 | 80 | val context = LocalContext.current |
76 | 81 |
|
| 82 | + val window = (context as Activity).window |
| 83 | + |
| 84 | + val insetsController = WindowCompat.getInsetsController(window, LocalView.current).apply { |
| 85 | + systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_DEFAULT |
| 86 | + } |
| 87 | + |
77 | 88 | val zoomableState = rememberZoomableState() |
78 | 89 |
|
79 | 90 | val coroutineScope = rememberCoroutineScope() |
@@ -125,6 +136,14 @@ fun GalleryScreen( |
125 | 136 | } |
126 | 137 | } |
127 | 138 |
|
| 139 | + LaunchedEffect(viewModel.inFocusMode) { |
| 140 | + if (viewModel.inFocusMode) { |
| 141 | + insetsController.hide(WindowInsetsCompat.Type.systemBars()) |
| 142 | + } else { |
| 143 | + insetsController.show(WindowInsetsCompat.Type.systemBars()) |
| 144 | + } |
| 145 | + } |
| 146 | + |
128 | 147 | // Displays media info dialog when displayedMediaItem is not null |
129 | 148 | MediaInfoDialog( |
130 | 149 | mediaItemDetails = viewModel.displayedMediaItem, |
@@ -224,7 +243,7 @@ fun GalleryScreen( |
224 | 243 | // material guidelines) |
225 | 244 | 0.dp, |
226 | 245 | innerPadding.calculateEndPadding(LayoutDirection.Ltr), |
227 | | - innerPadding.calculateBottomPadding(), |
| 246 | + 0.dp, |
228 | 247 | ) |
229 | 248 | .fillMaxSize() |
230 | 249 | ) { page -> |
|
0 commit comments