Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pomodoro_Team_7
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
moxdlab
moco2024
Pomodoro_Team_7
Commits
c5222016
Commit
c5222016
authored
10 months ago
by
Hasret Yilmaztürk
Browse files
Options
Downloads
Patches
Plain Diff
Floating Button erstellt
parent
746239ce
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/com/pomo/myapplication/MainActivity.kt
+115
-110
115 additions, 110 deletions
app/src/main/java/com/pomo/myapplication/MainActivity.kt
with
115 additions
and
110 deletions
app/src/main/java/com/pomo/myapplication/MainActivity.kt
+
115
−
110
View file @
c5222016
...
...
@@ -7,6 +7,8 @@ import androidx.activity.ComponentActivity
import
androidx.activity.compose.setContent
import
androidx.compose.foundation.layout.*
import
androidx.compose.foundation.text.KeyboardOptions
import
androidx.compose.material.icons.Icons
import
androidx.compose.material.icons.filled.List
import
androidx.compose.material3.*
import
androidx.compose.runtime.*
import
androidx.compose.ui.Alignment
...
...
@@ -26,13 +28,11 @@ import kotlinx.coroutines.launch
class
MainActivity
:
ComponentActivity
()
{
private
val
postNotificationsPermission
=
POST_NOTIFICATIONS
private
lateinit
var
notificationHelper
:
NotificationHelper
private
var
timeLeftForNotification
:
String
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
notificationHelper
=
NotificationHelper
(
this
)
setContent
{
...
...
@@ -82,9 +82,9 @@ class MainActivity : ComponentActivity() {
@Composable
fun
TimerScreen
(
onToDoListClick
:
()
->
Unit
)
{
var
timeLeftInMillis
by
remember
{
mutable
Long
StateOf
(
25
*
60
*
1000L
)
}
var
timeLeftInMillis
by
remember
{
mutableStateOf
(
25
*
60
*
1000L
)
}
var
timerRunning
by
remember
{
mutableStateOf
(
false
)
}
var
customMinutes
by
remember
{
mutable
Int
StateOf
(
0
)
}
var
customMinutes
by
remember
{
mutableStateOf
(
0
)
}
val
timeFormatted
=
remember
(
timeLeftInMillis
)
{
val
minutes
=
(
timeLeftInMillis
/
1000
)
/
60
val
seconds
=
(
timeLeftInMillis
/
1000
)
%
60
...
...
@@ -147,17 +147,19 @@ class MainActivity : ComponentActivity() {
showDialog
=
false
}
}
// Holen des Motivationsspruchs aus der neuen Datei
val
motivationalQuote
=
remember
{
MotivationalQuotes
.
getRandomQuote
()
}
val
motivationalQuote
=
remember
{
MotivationalQuotes
.
getRandomQuote
()
}
Box
(
modifier
=
Modifier
.
fillMaxSize
()
)
{
Column
(
modifier
=
Modifier
.
fillMaxSize
(),
modifier
=
Modifier
.
fillMaxSize
()
.
padding
(
bottom
=
80
.
dp
),
// Padding für den Floating Action Button
horizontalAlignment
=
Alignment
.
CenterHorizontally
,
verticalArrangement
=
Arrangement
.
Center
)
{
// Motivational Quote
Text
(
text
=
motivationalQuote
,
style
=
MaterialTheme
.
typography
.
titleLarge
,
...
...
@@ -165,7 +167,6 @@ class MainActivity : ComponentActivity() {
modifier
=
Modifier
.
padding
(
16
.
dp
)
)
TimerDisplay
(
time
=
timeFormatted
)
Spacer
(
modifier
=
Modifier
.
height
(
20
.
dp
))
Row
{
...
...
@@ -250,8 +251,8 @@ class MainActivity : ComponentActivity() {
Spacer
(
modifier
=
Modifier
.
height
(
8
.
dp
))
Button
(
onClick
=
{
showDialog
=
true
},
colors
=
ButtonDefaults
.
buttonColors
(
containerColor
=
Color
.
Blue
,
// Hintergrundfarbe des Buttons
contentColor
=
Color
.
White
// Textfarbe des Buttons
containerColor
=
Color
.
Magenta
,
contentColor
=
Color
.
White
)
)
{
Text
(
text
=
"Set Custom Timer"
)
...
...
@@ -265,15 +266,18 @@ class MainActivity : ComponentActivity() {
onDismiss
=
{
showDialog
=
false
}
)
}
}
Spacer
(
modifier
=
Modifier
.
height
(
20
.
dp
))
Button
(
onClick
=
onToDoListClick
,
colors
=
ButtonDefaults
.
buttonColors
(
containerColor
=
Color
.
Green
,
// Hintergrundfar
contentColor
=
Color
.
Black
// Textfarbe
)
FloatingActionButton
(
onClick
=
onToDoListClick
,
modifier
=
Modifier
.
align
(
Alignment
.
BottomEnd
)
.
padding
(
16
.
dp
)
)
{
Text
(
text
=
"Go to To-Do List"
)
Icon
(
imageVector
=
Icons
.
Filled
.
List
,
contentDescription
=
"To-Do List"
)
}
}
}
...
...
@@ -322,3 +326,4 @@ class MainActivity : ComponentActivity() {
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment