android: include safe-drawing top inset in uiTopPx (image top clipped on punch-hole phones) + smaller shutter row

This commit is contained in:
ZXCLI
2026-09-07 20:16:39 +08:00
parent 7437ce5e85
commit add3d06713
5 changed files with 34 additions and 13 deletions
@@ -115,11 +115,15 @@ fun LiveScreen(vm: LiveViewModel = viewModel(), onOpenGallery: () -> Unit = {})
modifier = Modifier
.align(Alignment.TopCenter)
.fillMaxWidth()
// onSizeChanged BEFORE the safe-drawing padding: the reported
// height must INCLUDE the cutout/status-bar inset, otherwise
// the renderer viewport starts inside the cutout strip and
// the image top hides behind the bar on punch-hole phones
.onSizeChanged { vm.uiTopPx = it.height }
.windowInsetsPadding(
WindowInsets.safeDrawing
.only(WindowInsetsSides.Top),
)
.onSizeChanged { vm.uiTopPx = it.height },
),
) {
Row(
modifier = Modifier
@@ -204,8 +208,8 @@ fun LiveScreen(vm: LiveViewModel = viewModel(), onOpenGallery: () -> Unit = {})
vm.uiBottomPx = navPx + shutterPx
}
.fillMaxWidth()
.padding(vertical = 10.dp),
horizontalArrangement = Arrangement.spacedBy(52.dp, Alignment.CenterHorizontally),
.padding(vertical = 6.dp),
horizontalArrangement = Arrangement.spacedBy(44.dp, Alignment.CenterHorizontally),
verticalAlignment = Alignment.CenterVertically,
) {
Column(
@@ -214,7 +218,7 @@ fun LiveScreen(vm: LiveViewModel = viewModel(), onOpenGallery: () -> Unit = {})
) {
Box(
modifier = Modifier
.size(52.dp)
.size(42.dp)
.background(Color(0x59FFFFFF), CircleShape)
.clickable { onOpenGallery() },
contentAlignment = Alignment.Center,
@@ -232,9 +236,9 @@ fun LiveScreen(vm: LiveViewModel = viewModel(), onOpenGallery: () -> Unit = {})
) {
Box(
modifier = Modifier
.size(74.dp)
.size(60.dp)
.border(4.dp, Color.White, CircleShape)
.padding(6.dp)
.padding(5.dp)
.background(Color.White, CircleShape)
.clickable { vm.capturePhoto(context) },
)
@@ -249,7 +253,7 @@ fun LiveScreen(vm: LiveViewModel = viewModel(), onOpenGallery: () -> Unit = {})
) {
Box(
modifier = Modifier
.size(52.dp)
.size(42.dp)
.border(3.dp, Color(0xFFFF5252), CircleShape)
.clickable { vm.toggleRecording(context) },
contentAlignment = Alignment.Center,
@@ -257,13 +261,13 @@ fun LiveScreen(vm: LiveViewModel = viewModel(), onOpenGallery: () -> Unit = {})
if (recording) {
Box(
modifier = Modifier
.size(20.dp)
.background(Color(0xFFFF5252), RoundedCornerShape(4.dp)),
.size(16.dp)
.background(Color(0xFFFF5252), RoundedCornerShape(3.dp)),
)
} else {
Box(
modifier = Modifier
.size(24.dp)
.size(19.dp)
.background(Color(0xFFFF5252), CircleShape),
)
}