@@ -1088,7 +1088,7 @@ fun QuickAccessSheet(
10881088 quickInputMode = " time"
10891089 val now = java.time.LocalTime .now()
10901090 val tmpl = " ${now.hour.toString().padStart(2 , ' 0' )} :${now.minute.toString().padStart(2 , ' 0' )} "
1091- newTextInput = TextFieldValue (tmpl, selection = TextRange (tmpl.length))
1091+ newTextInput = TextFieldValue (tmpl, selection = TextRange (0 , tmpl.length))
10921092 focusRequester.requestFocus()
10931093 }
10941094 },
@@ -1111,7 +1111,20 @@ fun QuickAccessSheet(
11111111 OutlinedTextField (
11121112 value = newTextInput,
11131113 onValueChange = { newVal ->
1114- if (quickInputMode == " coord" ) {
1114+ if (quickInputMode == " time" ) {
1115+ // Allow only digits and colon for time input
1116+ val filtered = newVal.text.filter { it.isDigit() || it == ' :' }
1117+ // Format as HH:MM
1118+ val digits = filtered.filter { it.isDigit() }
1119+ val formatted = when {
1120+ digits.isEmpty() -> " "
1121+ digits.length == 1 -> digits
1122+ digits.length == 2 -> digits
1123+ digits.length == 3 -> " ${digits.take(2 )} :${digits.drop(2 )} "
1124+ else -> " ${digits.take(2 )} :${digits.drop(2 ).take(2 )} "
1125+ }
1126+ newTextInput = TextFieldValue (formatted, selection = TextRange (formatted.length))
1127+ } else if (quickInputMode == " coord" ) {
11151128 // Extract all digits from the new input
11161129 val allDigits = newVal.text.filter { it.isDigit() }
11171130
0 commit comments