Skip to content
Snippets Groups Projects
Commit 9b354a1a authored by Khaleeq's avatar Khaleeq
Browse files

Update

parent a5d8de18
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,9 @@
<entry key="MainActivity">
<State />
</entry>
<entry key="TimerScreenPreview">
<State />
</entry>
<entry key="app">
<State />
</entry>
......
......@@ -36,7 +36,7 @@ class MainActivity : ComponentActivity() {
@Composable
fun TimerScreen() {
var timeLeftInMillis by remember { mutableStateOf(25 * 60 * 1000L) } // 25 minutes
var timeLeftInMillis by remember { mutableLongStateOf(25 * 60 * 1000L) } // 25 minutes
var timerRunning by remember { mutableStateOf(false) }
val timeFormatted = remember(timeLeftInMillis) {
val minutes = (timeLeftInMillis / 1000) / 60
......@@ -71,6 +71,12 @@ fun TimerScreen() {
timerRunning = false
}
fun setTimer(minutes: Int) {
job?.cancel()
timeLeftInMillis = minutes * 60 * 1000L
timerRunning = false
}
val quotes = arrayOf(
"Don't watch the clock; do what it does. Keep going.",
"Success is not the key to happiness. Happiness is the key to success.",
......@@ -94,7 +100,9 @@ fun TimerScreen() {
Button(
onClick = { startTimer() },
enabled = !timerRunning
) {
)
{
Text(text = "Start")
}
Spacer(modifier = Modifier.width(8.dp))
......@@ -109,6 +117,21 @@ fun TimerScreen() {
Text(text = "Reset")
}
}
Spacer(modifier = Modifier.height(20.dp))
Row {
Button(onClick = { setTimer(5) }) {
Text(text = "5 min")
}
Spacer(modifier = Modifier.width(8.dp))
Button(onClick = { setTimer(15) }) {
Text(text = "15 min")
}
Spacer(modifier = Modifier.width(8.dp))
Button(onClick = { setTimer(25) }) {
Text(text = "25 min")
}
}
}
}
......
......@@ -16,7 +16,7 @@ val DarkBackground = Color(0xFF121212)
val DarkSurface = Color(0xFF121212)
val DarkOnPrimary = Color(0xFFFFFBFE)
val DarkOnSecondary = Color(0xFFFFFBFE)
val DarkOnTertiary = Color(0xFFFFFBFE)
val DarkOnTertiary = Color(0xFF0040FF)
val DarkOnBackground = Color.White
val DarkOnSurface = Color.White
......@@ -28,3 +28,5 @@ val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
val DarkBlue = Color(0xFF003366)
......@@ -21,8 +21,8 @@ import androidx.compose.ui.graphics.Color
private val LightColorScheme = lightColorScheme(
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
background = Color(0xFFFFFFFF),
surface = Color(0xFF0040FF),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment