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
Binary file not shown.
@@ -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),
)
}
Binary file not shown.
+4 -1
View File
@@ -122,7 +122,10 @@ res/drawable/*.xml 自绘矢量图标(双弧圆等可靠几何图形
标签,`safeDrawing` 顶部inset 适配挖孔屏。
- 底部(仅实时页)导航栏上方为**相机快门区**:相册快捷入口 / 大快门拍照 /
录像-停止;快门区高度并入 `vm.uiBottomPx`= 导航高+快门区高)。
- 顶栏高度经 `onSizeChanged`→`vm.uiTopPx`;底导航高度经 `UiInsets.navPx`→`vm.uiBottomPx`,渲染器据此留白。
- 顶栏高度经 `onSizeChanged`→`vm.uiTopPx`**必须挂在 safeDrawing inset 之前**
即包含挖孔安全区高度,否则真机热像顶端会插进顶栏背后);底导航高度经
`UiInsets.navPx`、快门区高度经其 `onSizeChanged`→`vm.uiBottomPx`= 导航+快门区),
渲染器据此留白。
- 演示模式:无设备时用真实管线+DDT渲染合成帧(热块场景),demo温度用局部线性显示映射
(真机温度走管线数学;绝对温度标定待真机)。
+11
View File
@@ -179,6 +179,17 @@
- [x] 模拟器实测:0°/90° 姿态布局、旋转补偿、图像区域均正确
preview_ui_v8.png / preview_ui90_v8.png);单元测试全过;APK 已更新。
## 用户反馈修复 第九轮(2026-09-07,真机热像顶端被顶栏遮挡)
- [x] **用户反馈**:真机上快门区把热像显示区顶满后,热像最顶端被顶栏盖住看不见。
- [x] **根因**:顶栏 `onSizeChanged` 挂在 `safeDrawing` 挖孔 inset 内侧,`uiTopPx`
不含挖孔安全区高度;模拟器无挖孔看不出来。快门区加入后剩余高度变小、热像
进入"高度受限"铺满视口状态,顶端误差直接表现为热像顶端插入顶栏背后。
- [x] **修复**`onSizeChanged` 移到 `windowInsetsPadding` 之前(`uiTopPx` = 挖孔
安全区 + 顶栏全高,渲染器视口完整跳过顶栏);同时按要求缩小快门区
(相册/录像 42dp、快门 60dp、纵向 padding 6dp、间距 44dp)。
- [x] 模拟器复测布局正常,单元测试全过;APK 已更新。
## 待办
- 真机USB实测(温度绝对值标定、FFC/录像/MDT保存端到端)