From 84d4914d8aeb93150672c945e0d1d0f62398f5e1 Mon Sep 17 00:00:00 2001
From: beyond
Date: Sun, 6 Sep 2026 18:57:56 +0800
Subject: [PATCH] =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=99=A8UI=E4=BC=98=E5=8C=96?=
=?UTF-8?q?:=20=E4=B8=8A=E7=A7=BB=E9=A1=B6=E9=83=A8=E3=80=81=E7=BC=A9?=
=?UTF-8?q?=E5=B0=8F=E8=83=B6=E5=9B=8A=E3=80=81=E4=BF=AE=E5=A4=8D=E8=BF=9B?=
=?UTF-8?q?=E5=BA=A6=E6=9D=A1=E6=8A=96=E5=8A=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 顶部padding从LumaSpacing.md(16dp)减到LumaSpacing.xs(8dp)
- 胶囊框padding从16dp/2dp减到12dp/0dp,字体12sp→11sp
- 进度条抖动修复:seek完成后延迟300ms重置isSeeking
防止轮询循环在player追上之前覆盖currentPositionMs
- 新增seekCompletedVersion计数器触发延迟重置
Co-Authored-By: Claude Opus 5 (1M context)
---
.../screens/VideoPlayerScreen.kt | 24 ++++++++++++++-----
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/app/src/main/kotlin/com/example/myapplication/screens/VideoPlayerScreen.kt b/app/src/main/kotlin/com/example/myapplication/screens/VideoPlayerScreen.kt
index 47538f3..507d603 100644
--- a/app/src/main/kotlin/com/example/myapplication/screens/VideoPlayerScreen.kt
+++ b/app/src/main/kotlin/com/example/myapplication/screens/VideoPlayerScreen.kt
@@ -904,7 +904,7 @@ fun VideoPlayerScreen(
}
}
- Column(Modifier.fillMaxWidth().statusBarsPadding().padding(top = LumaSpacing.md)) {
+ Column(Modifier.fillMaxWidth().statusBarsPadding().padding(top = LumaSpacing.xs)) {
// 第一排:时间(左)| 网速+电量(右)
Row(
Modifier.fillMaxWidth().padding(horizontal = capsuleInset),
@@ -1030,7 +1030,7 @@ fun VideoPlayerScreen(
borderColor = Color.White.copy(alpha = 0.22f),
shadowElevation = 4.dp,
)
- .padding(horizontal = 16.dp, vertical = 2.dp),
+ .padding(horizontal = 12.dp, vertical = 0.dp),
) {
var totalDurationMs by remember(player) {
mutableLongStateOf(player.duration.coerceAtLeast(0L))
@@ -1041,6 +1041,15 @@ fun VideoPlayerScreen(
var isSeeking by remember { mutableStateOf(false) }
var seekPosition by remember { mutableFloatStateOf(0f) }
var bufferProgress by remember { mutableFloatStateOf(0f) }
+ var seekCompletedVersion by remember { mutableIntStateOf(0) }
+
+ // Reset isSeeking after seek completes to prevent jitter
+ LaunchedEffect(seekCompletedVersion) {
+ if (seekCompletedVersion > 0) {
+ delay(300)
+ isSeeking = false
+ }
+ }
LaunchedEffect(player) {
while (true) {
@@ -1056,9 +1065,9 @@ fun VideoPlayerScreen(
}
}
- Row(verticalAlignment = Alignment.CenterVertically) {
+ Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(vertical = 2.dp)) {
val swipePositionMs = seekPreviewPositionMs
- Text(formatMs(swipePositionMs ?: currentPositionMs), color = Color.White, fontSize = 12.sp)
+ Text(formatMs(swipePositionMs ?: currentPositionMs), color = Color.White, fontSize = 11.sp)
LumaSeekBar(
value = when {
isSeeking -> seekPosition
@@ -1076,10 +1085,13 @@ fun VideoPlayerScreen(
player.seekTo(targetPosition)
progress = finalValue
currentPositionMs = targetPosition
- isSeeking = false
controlsInteractionLocked = false
latestOnPlaybackProgress(targetPosition, !player.isPlaying, "TimeUpdate", true)
+ // Keep isSeeking true briefly to prevent polling loop from
+ // overwriting currentPositionMs before player catches up
+ seekCompletedVersion++
},
+ modifier = Modifier.weight(1f).padding(horizontal = 12.dp),
progressContentDescription = stringResource(Res.string.player_progress),
modifier = Modifier.weight(1f).padding(horizontal = 12.dp),
activeColor = Color.White,
@@ -1088,7 +1100,7 @@ fun VideoPlayerScreen(
bufferedValue = bufferProgress,
thumbColor = Color.White,
)
- Text(formatMs(totalDurationMs), color = Color.White, fontSize = 12.sp)
+ Text(formatMs(totalDurationMs), color = Color.White, fontSize = 11.sp)
}
}
}