feat(posture): dev 설정에 Lying Duration 슬라이더 추가 — 테스트 시간 단축
증상: 기상 알람 테스트하려면 LYING 으로 3분 (default 180s) 유지해야 팝업
뜸 — 매번 너무 길어 테스트 비효율.
수정: PiezoMonitoring dev settings 의 기상 알람 토글 바로 아래에 Lying
Duration 슬라이더 추가.
- 범위: 5초 ~ 600초 (10분)
- 표시: "5초" / "3분 0초" 형식 자동
- 변경 시:
1) WakeupAlarmPrefs.setLyingDurationSec(context, sec) — 저장
2) wakeupDetector.lyingDurationSec = sec — 즉시 적용
- 테스트: 슬라이더로 5초 정도로 줄임 → 평평히 5초 → 세움 → 즉시 팝업
상수가 GreenZoneConstants 대신 SharedPreferences 라서 앱 재시작 후에도
설정 유지. wakeupDetector 인스턴스에 동시 반영해 즉시 효과 확인 가능.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+30
@@ -1823,6 +1823,36 @@ fun PiezoMonitoringView(appState: AppState) {
|
||||
colors = SwitchDefaults.colors(checkedTrackColor = Color(0xFFD32F2F))
|
||||
)
|
||||
}
|
||||
|
||||
// Wakeup 알람 발동을 위한 LYING 유지 시간 (dev 조절 가능)
|
||||
var lyingDurVal by remember {
|
||||
mutableStateOf(
|
||||
com.example.medilightv2android.services.WakeupAlarmPrefs.lyingDurationSec(context).toFloat()
|
||||
)
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text("Lying Duration", fontSize = labelSize, fontWeight = FontWeight.SemiBold)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text(
|
||||
if (lyingDurVal < 60) "${lyingDurVal.toInt()}초"
|
||||
else "${(lyingDurVal / 60).toInt()}분 ${(lyingDurVal.toInt() % 60)}초",
|
||||
fontSize = 13.sp, fontWeight = FontWeight.Bold, color = MlPrimary
|
||||
)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Text("이상 lying 후 일어나면 알람", fontSize = 10.sp, color = MlSecondaryText)
|
||||
}
|
||||
Slider(
|
||||
value = lyingDurVal,
|
||||
onValueChange = {
|
||||
lyingDurVal = it
|
||||
val sec = it.toInt()
|
||||
com.example.medilightv2android.services.WakeupAlarmPrefs.setLyingDurationSec(context, sec)
|
||||
wakeupDetector.lyingDurationSec = sec
|
||||
},
|
||||
valueRange = 5f..600f, // 5초 ~ 10분
|
||||
steps = 0,
|
||||
colors = SliderDefaults.colors(thumbColor = MlPrimary, activeTrackColor = MlPrimary)
|
||||
)
|
||||
}
|
||||
|
||||
HorizontalDivider(modifier = Modifier.padding(vertical = dividerPadding))
|
||||
|
||||
Reference in New Issue
Block a user