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

Update

parent 75246438
No related branches found
No related tags found
No related merge requests found
......@@ -5,22 +5,15 @@ import android.content.pm.PackageManager
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
......@@ -42,7 +35,6 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
class MainActivity : ComponentActivity() {
private lateinit var notificationHelper: NotificationHelper
......@@ -131,6 +123,7 @@ class MainActivity : ComponentActivity() {
timerRunning = false
}
Column(
modifier = Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
......@@ -139,7 +132,7 @@ class MainActivity : ComponentActivity() {
TimerDisplay(time = timeFormatted)
Spacer(modifier = Modifier.height(20.dp))
Row {
/* Button(
Button(
onClick = {
startTimer()
timeLeftForNotification = timeFormatted
......@@ -148,38 +141,7 @@ class MainActivity : ComponentActivity() {
enabled = !timerRunning
) {
Text(text = "Start")
}*/
IconButton(
onClick = {
startTimer()
timeLeftForNotification = timeFormatted
notificationHelper.showNotification(timeFormatted)
},
modifier = Modifier
.padding(8.dp) // Optional: Abstand um den IconButton herum
.background(Color(0xFF4CAF50), RoundedCornerShape(16.dp)) // Optional: Hintergrundfarbe und Form
) {
Icon(
imageVector = Icons.Filled.PlayArrow,
contentDescription = "Play",
tint = Color.White
)
}
Spacer(modifier = Modifier.width(8.dp))
Button(
onClick = { stopTimer() },
......@@ -197,54 +159,48 @@ class MainActivity : ComponentActivity() {
Spacer(modifier = Modifier.height(20.dp))
Row {
// Dieser Button wird gelöscht ist nur für Testzwecke da
Button(
onClick = { setTimer(1) },
colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF4CAF50), // Grün
contentColor = Color.White // Weißer Text
)
) {
Text(text = "1 min")
}
// Dieser Button wird gelöscht ist nur für Testzwecke da
Button(
onClick = { setTimer(5) },
colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF6650a4), // Grün
containerColor = Color(0xFF4CAF50), // Grün
contentColor = Color.White // Weißer Text
),
shape = RoundedCornerShape(10.dp), // Abgerundete Ecken
modifier = Modifier
.padding(8.dp) // Abstand um den Button herum
.width(100.dp) // Breite des Buttons
.height(50.dp) // Höhe des Buttons
)
) {
Text(text = "5 min")
}
Spacer(modifier = Modifier.width(8.dp))
// Dieser Button wird gelöscht ist nur für Testzwecke da
Button(
onClick = { setTimer(15) },
colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF6650a4), // Grün
containerColor = Color(0xFF4CAF50), // Grün
contentColor = Color.White // Weißer Text
),
shape = RoundedCornerShape(10.dp), // Abgerundete Ecken
modifier = Modifier
.padding(8.dp) // Abstand um den Button herum
.width(100.dp) // Breite des Buttons
.height(50.dp) // Höhe des Buttons
)
) {
Text(text = "15 min")
}
Spacer(modifier = Modifier.width(8.dp))
// Dieser Button wird gelöscht ist nur für Testzwecke da
Button(
onClick = { setTimer(25) },
colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF6650a4), // Grün
containerColor = Color(0xFF4CAF50), // Grün
contentColor = Color.White // Weißer Text
),
shape = RoundedCornerShape(10.dp), // Abgerundete Ecken
modifier = Modifier
.padding(8.dp) // Abstand um den Button herum
.width(100.dp) // Breite des Buttons
.height(50.dp) // Höhe des Buttons
)
) {
Text(text = "25 min")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment