Skip to content
Snippets Groups Projects
Commit 738c96d0 authored by Hasret Yilmaztürk's avatar Hasret Yilmaztürk
Browse files

Erstellen der Motivationssprüche

parent 7039ada2
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.core.app.ActivityCompat
import com.pomo.myapplication.ui.theme.MotivationalQuotes
import com.pomo.myapplication.ui.theme.MyApplicationTheme
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
......@@ -146,12 +147,25 @@ class MainActivity : ComponentActivity() {
showDialog = false
}
}
// Holen des Motivationsspruchs aus der neuen Datei
val motivationalQuote = remember { MotivationalQuotes.getRandomQuote() }
Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
// Motivational Quote
Text(
text = motivationalQuote,
style = MaterialTheme.typography.titleLarge,
color = Color.Gray,
modifier = Modifier.padding(16.dp)
)
TimerDisplay(time = timeFormatted)
Spacer(modifier = Modifier.height(20.dp))
Row {
......
package com.pomo.myapplication.ui.theme
import kotlin.random.Random
object MotivationalQuotes {
private val quotes = listOf(
"Believe in yourself!",
"Keep pushing forward!",
"You can do it!",
"Stay positive and work hard!",
"Success is not final, failure is not fatal: It is the courage to continue that counts."
)
fun getRandomQuote(): String {
return quotes[Random.nextInt(quotes.size)]
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment