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

Play Button

parent 30dbb574
No related branches found
No related tags found
No related merge requests found
...@@ -5,15 +5,22 @@ import android.content.pm.PackageManager ...@@ -5,15 +5,22 @@ import android.content.pm.PackageManager
import android.os.Bundle import android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width 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.Button
import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
...@@ -35,6 +42,7 @@ import kotlinx.coroutines.Job ...@@ -35,6 +42,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
private lateinit var notificationHelper: NotificationHelper private lateinit var notificationHelper: NotificationHelper
...@@ -131,7 +139,7 @@ class MainActivity : ComponentActivity() { ...@@ -131,7 +139,7 @@ class MainActivity : ComponentActivity() {
TimerDisplay(time = timeFormatted) TimerDisplay(time = timeFormatted)
Spacer(modifier = Modifier.height(20.dp)) Spacer(modifier = Modifier.height(20.dp))
Row { Row {
Button( /* Button(
onClick = { onClick = {
startTimer() startTimer()
timeLeftForNotification = timeFormatted timeLeftForNotification = timeFormatted
...@@ -140,7 +148,38 @@ class MainActivity : ComponentActivity() { ...@@ -140,7 +148,38 @@ class MainActivity : ComponentActivity() {
enabled = !timerRunning enabled = !timerRunning
) { ) {
Text(text = "Start") 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)) Spacer(modifier = Modifier.width(8.dp))
Button( Button(
onClick = { stopTimer() }, onClick = { stopTimer() },
...@@ -158,48 +197,54 @@ class MainActivity : ComponentActivity() { ...@@ -158,48 +197,54 @@ class MainActivity : ComponentActivity() {
Spacer(modifier = Modifier.height(20.dp)) Spacer(modifier = Modifier.height(20.dp))
Row { 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( Button(
onClick = { setTimer(5) }, onClick = { setTimer(5) },
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF4CAF50), // Grün containerColor = Color(0xFF6650a4), // Grün
contentColor = Color.White // Weißer Text 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") Text(text = "5 min")
} }
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
// Dieser Button wird gelöscht ist nur für Testzwecke da
Button( Button(
onClick = { setTimer(15) }, onClick = { setTimer(15) },
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF4CAF50), // Grün containerColor = Color(0xFF6650a4), // Grün
contentColor = Color.White // Weißer Text 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") Text(text = "15 min")
} }
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
// Dieser Button wird gelöscht ist nur für Testzwecke da
Button( Button(
onClick = { setTimer(25) }, onClick = { setTimer(25) },
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = Color(0xFF4CAF50), // Grün containerColor = Color(0xFF6650a4), // Grün
contentColor = Color.White // Weißer Text 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") 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