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
a6f1418c
Commit
a6f1418c
authored
11 months ago
by
Khaleeq
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master'
# Conflicts: # app/src/main/java/com/pomo/myapplication/MainActivity.kt
parents
9eda44ac
c5222016
Branches
main
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
+116
-102
116 additions, 102 deletions
app/src/main/java/com/pomo/myapplication/MainActivity.kt
with
116 additions
and
102 deletions
app/src/main/java/com/pomo/myapplication/MainActivity.kt
+
116
−
102
View file @
a6f1418c
...
@@ -7,6 +7,8 @@ import androidx.activity.ComponentActivity
...
@@ -7,6 +7,8 @@ import androidx.activity.ComponentActivity
import
androidx.activity.compose.setContent
import
androidx.activity.compose.setContent
import
androidx.compose.foundation.layout.*
import
androidx.compose.foundation.layout.*
import
androidx.compose.foundation.text.KeyboardOptions
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.material3.*
import
androidx.compose.runtime.*
import
androidx.compose.runtime.*
import
androidx.compose.ui.Alignment
import
androidx.compose.ui.Alignment
...
@@ -17,7 +19,6 @@ import androidx.compose.ui.unit.dp
...
@@ -17,7 +19,6 @@ import androidx.compose.ui.unit.dp
import
androidx.core.app.ActivityCompat
import
androidx.core.app.ActivityCompat
import
com.pomo.myapplication.ui.theme.MotivationalQuotes
import
com.pomo.myapplication.ui.theme.MotivationalQuotes
import
com.pomo.myapplication.ui.theme.MyApplicationTheme
import
com.pomo.myapplication.ui.theme.MyApplicationTheme
import
com.pomo.myapplication.ui.theme.ToDoListScreen
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.Job
...
@@ -27,13 +28,11 @@ import kotlinx.coroutines.launch
...
@@ -27,13 +28,11 @@ import kotlinx.coroutines.launch
class
MainActivity
:
ComponentActivity
()
{
class
MainActivity
:
ComponentActivity
()
{
private
val
postNotificationsPermission
=
POST_NOTIFICATIONS
private
val
postNotificationsPermission
=
POST_NOTIFICATIONS
private
lateinit
var
notificationHelper
:
NotificationHelper
private
lateinit
var
notificationHelper
:
NotificationHelper
private
var
timeLeftForNotification
:
String
?
=
null
private
var
timeLeftForNotification
:
String
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
notificationHelper
=
NotificationHelper
(
this
)
notificationHelper
=
NotificationHelper
(
this
)
setContent
{
setContent
{
...
@@ -83,9 +82,9 @@ class MainActivity : ComponentActivity() {
...
@@ -83,9 +82,9 @@ class MainActivity : ComponentActivity() {
@Composable
@Composable
fun
TimerScreen
(
onToDoListClick
:
()
->
Unit
)
{
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
timerRunning
by
remember
{
mutableStateOf
(
false
)
}
var
customMinutes
by
remember
{
mutable
Int
StateOf
(
0
)
}
var
customMinutes
by
remember
{
mutableStateOf
(
0
)
}
val
timeFormatted
=
remember
(
timeLeftInMillis
)
{
val
timeFormatted
=
remember
(
timeLeftInMillis
)
{
val
minutes
=
(
timeLeftInMillis
/
1000
)
/
60
val
minutes
=
(
timeLeftInMillis
/
1000
)
/
60
val
seconds
=
(
timeLeftInMillis
/
1000
)
%
60
val
seconds
=
(
timeLeftInMillis
/
1000
)
%
60
...
@@ -148,25 +147,26 @@ class MainActivity : ComponentActivity() {
...
@@ -148,25 +147,26 @@ class MainActivity : ComponentActivity() {
showDialog
=
false
showDialog
=
false
}
}
}
}
// Holen des Motivationsspruchs aus der neuen Datei
val
motivationalQuote
=
remember
{
MotivationalQuotes
.
getRandomQuote
()
}
val
motivationalQuote
=
remember
{
MotivationalQuotes
.
getRandomQuote
()
}
Box
(
modifier
=
Modifier
.
fillMaxSize
()
)
{
Column
(
Column
(
modifier
=
Modifier
.
fillMaxSize
(),
modifier
=
Modifier
.
fillMaxSize
()
.
padding
(
bottom
=
80
.
dp
),
// Padding für den Floating Action Button
horizontalAlignment
=
Alignment
.
CenterHorizontally
,
horizontalAlignment
=
Alignment
.
CenterHorizontally
,
verticalArrangement
=
Arrangement
.
Center
verticalArrangement
=
Arrangement
.
Center
)
{
)
{
// Motivational Quote
Text
(
Text
(
text
=
motivationalQuote
,
text
=
motivationalQuote
,
style
=
MaterialTheme
.
typography
.
titleLarge
,
style
=
MaterialTheme
.
typography
.
titleLarge
,
color
=
Color
.
Dark
Gray
,
color
=
Color
.
Gray
,
modifier
=
Modifier
.
padding
(
1
0
.
dp
)
modifier
=
Modifier
.
padding
(
1
6
.
dp
)
)
)
TimerDisplay
(
time
=
timeFormatted
)
TimerDisplay
(
time
=
timeFormatted
)
Spacer
(
modifier
=
Modifier
.
height
(
20
.
dp
))
Spacer
(
modifier
=
Modifier
.
height
(
20
.
dp
))
Row
{
Row
{
...
@@ -249,7 +249,12 @@ class MainActivity : ComponentActivity() {
...
@@ -249,7 +249,12 @@ class MainActivity : ComponentActivity() {
Spacer
(
modifier
=
Modifier
.
height
(
20
.
dp
))
Spacer
(
modifier
=
Modifier
.
height
(
20
.
dp
))
Spacer
(
modifier
=
Modifier
.
height
(
8
.
dp
))
Spacer
(
modifier
=
Modifier
.
height
(
8
.
dp
))
Button
(
onClick
=
{
showDialog
=
true
})
{
Button
(
onClick
=
{
showDialog
=
true
},
colors
=
ButtonDefaults
.
buttonColors
(
containerColor
=
Color
.
Magenta
,
contentColor
=
Color
.
White
)
)
{
Text
(
text
=
"Set Custom Timer"
)
Text
(
text
=
"Set Custom Timer"
)
}
}
...
@@ -261,10 +266,18 @@ class MainActivity : ComponentActivity() {
...
@@ -261,10 +266,18 @@ class MainActivity : ComponentActivity() {
onDismiss
=
{
showDialog
=
false
}
onDismiss
=
{
showDialog
=
false
}
)
)
}
}
}
Spacer
(
modifier
=
Modifier
.
height
(
20
.
dp
))
FloatingActionButton
(
Button
(
onClick
=
onToDoListClick
)
{
onClick
=
onToDoListClick
,
Text
(
text
=
"Go to To-Do List"
)
modifier
=
Modifier
.
align
(
Alignment
.
BottomEnd
)
.
padding
(
16
.
dp
)
)
{
Icon
(
imageVector
=
Icons
.
Filled
.
List
,
contentDescription
=
"To-Do List"
)
}
}
}
}
}
}
...
@@ -313,3 +326,4 @@ class MainActivity : ComponentActivity() {
...
@@ -313,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