diff --git a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PlacementGuideView.kt b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PlacementGuideView.kt index 27995f6..fcbc43b 100644 --- a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PlacementGuideView.kt +++ b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PlacementGuideView.kt @@ -121,10 +121,12 @@ fun PlacementGuideView(appState: AppState) { var sweepLastDetected by remember { mutableIntStateOf(0) } var sweepEverSawAll by remember { mutableStateOf(false) } - // 화면 진입 시 전체 상태 리셋. clinical alignment session 이면 V2, 그 외 V1 자동 강제. + // 화면 진입 시 전체 상태 리셋. clinical alignment session (placementFromMonitoring=false + + // 활성 ALIGNMENT 세션) 이면 V2, 그 외 (PiezoMonitoring 에서 진입 / 위저드 진입 / 잔여 세션) 는 항상 V1. LaunchedEffect(Unit) { val sess = com.example.medilightv2android.services.ClinicalSessionStore.currentSession - val isClinicalAlign = sess != null && + val isClinicalAlign = !appState.placementFromMonitoring && + sess != null && sess.mode == com.example.medilightv2android.models.SessionMode.ALIGNMENT com.example.medilightv2android.managers.GreenZoneConstants.alignmentAlgo = if (isClinicalAlign) com.example.medilightv2android.managers.AlignmentAlgo.V2 @@ -232,34 +234,40 @@ fun PlacementGuideView(appState: AppState) { .padding(horizontal = 24.dp), horizontalAlignment = Alignment.CenterHorizontally ) { - // ─── (1) Hint 1 — 시작 전 안내 (칸 상시 유지, "pubic bone" 빨강 강조) ─── - val hint1Bg = Color(0xFFFFF3E0) - val hint1Text = remember(waitingForStart) { - if (waitingForStart) buildAnnotatedString { - val full = "Place VesiScan above the pubic bone, then press Start" - val key = "pubic bone" - val idx = full.indexOf(key, ignoreCase = true) - if (idx >= 0) { - append(full.substring(0, idx)) - withStyle(SpanStyle(color = Color.Red, fontWeight = FontWeight.ExtraBold)) { - append(full.substring(idx, idx + key.length)) - } - append(full.substring(idx + key.length)) - } else append(full) - } else AnnotatedString(" ") // 공백 — 칸 높이 유지 + // ─── (1) Hint 1 — waitingForStart 일 때만 렌더 (빈 칸 자체 숨김) ─── + if (waitingForStart) { + val hint1Bg = Color(0xFFFFF3E0) + val hint1Text = remember { + buildAnnotatedString { + val full = "Place VesiScan above the pubic bone, then press Start" + val key = "pubic bone" + val idx = full.indexOf(key, ignoreCase = true) + if (idx >= 0) { + append(full.substring(0, idx)) + withStyle(SpanStyle(color = Color.Red, fontWeight = FontWeight.ExtraBold)) { + append(full.substring(idx, idx + key.length)) + } + append(full.substring(idx + key.length)) + } else append(full) + } + } + Box( + modifier = Modifier + .fillMaxWidth() + .background(hint1Bg.copy(alpha = 0.7f), RoundedCornerShape(16.dp)) + .padding(horizontal = 20.dp, vertical = 14.dp), + contentAlignment = Alignment.Center // 상하 중앙 정렬 + ) { + Text( + text = hint1Text, + fontSize = 26.sp, + fontWeight = FontWeight.Bold, + color = Color.Black, + textAlign = TextAlign.Center, + ) + } + Spacer(modifier = Modifier.height(8.dp)) } - Text( - text = hint1Text, - fontSize = 26.sp, - fontWeight = FontWeight.Bold, - color = Color.Black, - textAlign = TextAlign.Center, - modifier = Modifier - .fillMaxWidth() - .background(hint1Bg.copy(alpha = 0.7f), RoundedCornerShape(16.dp)) - .padding(horizontal = 20.dp, vertical = 14.dp) - ) - Spacer(modifier = Modifier.height(8.dp)) // 타이틀은 top bar 로 이동 (← 옆 절대 가운데) — 본문 중복 제거. // ── 가이드 텍스트 (Step 아래, 몸 위) — "pubic bone" 인라인 빨강 ExtraBold 강조 ── @@ -524,20 +532,26 @@ fun PlacementGuideView(appState: AppState) { Spacer(modifier = Modifier.height(8.dp)) - // ─── (5) Hint 2 — 측정 중 방향 안내 (waitingForStart 시 공백, pubic bone 중복 X) ─── - Text( - text = if (waitingForStart) AnnotatedString(" ") else displayHint, - fontSize = 28.sp, - fontWeight = FontWeight.Bold, - color = Color.Black, - textAlign = TextAlign.Center, - modifier = Modifier - .fillMaxWidth() - .background(hintBg.copy(alpha = 0.7f), RoundedCornerShape(16.dp)) - .padding(horizontal = 20.dp, vertical = 14.dp) - ) - - Spacer(modifier = Modifier.height(8.dp)) + // ─── (5) Hint 2 — 측정 중 방향 안내 (waitingForStart 또는 빈 텍스트면 칸 자체 숨김) ─── + val hint2Visible = !waitingForStart && displayHint.text.isNotBlank() + if (hint2Visible) { + Box( + modifier = Modifier + .fillMaxWidth() + .background(hintBg.copy(alpha = 0.7f), RoundedCornerShape(16.dp)) + .padding(horizontal = 20.dp, vertical = 14.dp), + contentAlignment = Alignment.Center + ) { + Text( + text = displayHint, + fontSize = 28.sp, + fontWeight = FontWeight.Bold, + color = Color.Black, + textAlign = TextAlign.Center, + ) + } + Spacer(modifier = Modifier.height(8.dp)) + } // 채널 dot row (개발자 모드에서만 표시) if (appState.isDevMode) {