File tree Expand file tree Collapse file tree 1 file changed +32
-2
lines changed
app/src/main/java/com/subpilot/ui Expand file tree Collapse file tree 1 file changed +32
-2
lines changed Original file line number Diff line number Diff line change 1- package com.subpilot.ui
1+ package com.geekneuron. subpilot.ui
22
3- @Composable fun TimelineEditor (...) { .. . }
3+ import androidx.compose.foundation.layout.*
4+ import androidx.compose.material3.*
5+ import androidx.compose.runtime.Composable
6+ import androidx.compose.runtime.MutableState
7+ import androidx.compose.ui.Modifier
8+ import androidx.compose.ui.unit.dp
9+
10+ @Composable
11+ fun TimelineEditor (
12+ label : String ,
13+ timeMs : MutableState <Long >,
14+ onTimeChanged : (Long ) -> Unit
15+ ) {
16+ Column (modifier = Modifier .padding(8 .dp)) {
17+ Text (text = label, style = MaterialTheme .typography.labelMedium)
18+ Slider (
19+ value = timeMs.value.toFloat(),
20+ onValueChange = { onTimeChanged(it.toLong()) },
21+ valueRange = 0f .. 600000f , // 0 to 10 minutes
22+ modifier = Modifier .fillMaxWidth()
23+ )
24+ Text (text = formatTime(timeMs.value), style = MaterialTheme .typography.bodySmall)
25+ }
26+ }
27+
28+ private fun formatTime (ms : Long ): String {
29+ val totalSec = ms / 1000
30+ val min = totalSec / 60
31+ val sec = totalSec % 60
32+ return String .format(" %02d:%02d" , min, sec)
33+ }
You can’t perform that action at this time.
0 commit comments