diff --git a/README.md b/README.md
index fb31b0e..61d4480 100644
--- a/README.md
+++ b/README.md
@@ -9,8 +9,10 @@ Tomato is a minimalist Pomodoro timer for Android based on Material 3 Expressive
### Screenshots
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 34d6d08..087330c 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.serialization)
+ alias(libs.plugins.ksp)
}
android {
@@ -16,7 +17,7 @@ android {
minSdk = 26
targetSdk = 36
versionCode = 1
- versionName = "1.0"
+ versionName = "1.0.0-01-alpha"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -39,6 +40,9 @@ android {
jvmTarget.set(JvmTarget.JVM_17) // Use the enum for target JVM version
}
}
+ ksp {
+ arg("room.schemaLocation", "$projectDir/schemas")
+ }
buildFeatures {
compose = true
}
@@ -50,6 +54,7 @@ dependencies {
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.activity.compose)
+ implementation(libs.androidx.adaptive)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
@@ -59,6 +64,10 @@ dependencies {
implementation(libs.androidx.navigation3.runtime)
implementation(libs.androidx.navigation3.ui)
+ implementation(libs.androidx.room.runtime)
+ implementation(libs.androidx.room.ktx)
+ ksp(libs.androidx.room.compiler)
+
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5778b11..0e52b75 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,14 +3,16 @@
xmlns:tools="http://schemas.android.com/tools">
+ android:theme="@style/Theme.Tomato"
+ tools:targetApi="36">
(Screen.Timer)
Scaffold(
bottomBar = {
- ShortNavigationBar {
+ val wide = remember {
+ windowSizeClass.isWidthAtLeastBreakpoint(
+ WindowSizeClass.WIDTH_DP_MEDIUM_LOWER_BOUND
+ )
+ }
+ ShortNavigationBar(
+ arrangement =
+ if (wide) ShortNavigationBarArrangement.Centered
+ else ShortNavigationBarArrangement.EqualWeight
+ ) {
screens.forEach {
val selected = backStack.last() == it.route
ShortNavigationBarItem(
@@ -75,11 +102,14 @@ fun AppScreen(
{ if (backStack.size > 1) backStack.removeAt(1) }
},
icon = {
- Crossfade (selected) { selected ->
+ Crossfade(selected) { selected ->
if (selected) Icon(painterResource(it.selectedIcon), null)
else Icon(painterResource(it.unselectedIcon), null)
}
},
+ iconPosition =
+ if (wide) NavigationItemIconPosition.Start
+ else NavigationItemIconPosition.Top,
label = { Text(it.label) }
)
}
@@ -89,10 +119,29 @@ fun AppScreen(
NavDisplay(
backStack = backStack,
onBack = { backStack.removeLastOrNull() },
+ transitionSpec = {
+ ContentTransform(
+ fadeIn(motionScheme.defaultEffectsSpec()),
+ fadeOut(motionScheme.defaultEffectsSpec())
+ )
+ },
+ popTransitionSpec = {
+ ContentTransform(
+ fadeIn(motionScheme.defaultEffectsSpec()),
+ fadeOut(motionScheme.defaultEffectsSpec())
+ )
+ },
+ predictivePopTransitionSpec = {
+ ContentTransform(
+ fadeIn(motionScheme.defaultEffectsSpec()),
+ fadeOut(motionScheme.defaultEffectsSpec()) +
+ scaleOut(targetScale = 0.7f),
+ )
+ },
entryProvider = entryProvider {
entry {
TimerScreen(
- uiState = uiState,
+ timerState = uiState,
showBrandTitle = showBrandTitle,
progress = { progress },
resetTimer = viewModel::resetTimer,
@@ -107,7 +156,13 @@ fun AppScreen(
}
entry {
- SettingsScreen()
+ SettingsScreenRoot(
+ modifier = modifier.padding(
+ start = contentPadding.calculateStartPadding(layoutDirection),
+ end = contentPadding.calculateEndPadding(layoutDirection),
+ bottom = contentPadding.calculateBottomPadding()
+ )
+ )
}
entry {
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/MinuteInputField.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/MinuteInputField.kt
new file mode 100644
index 0000000..81a8c21
--- /dev/null
+++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/MinuteInputField.kt
@@ -0,0 +1,71 @@
+package org.nsh07.pomodoro.ui.settingsScreen
+
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.text.BasicTextField
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.foundation.text.input.TextFieldLineLimits
+import androidx.compose.foundation.text.input.TextFieldState
+import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
+import androidx.compose.material3.MaterialTheme.colorScheme
+import androidx.compose.material3.MaterialTheme.motionScheme
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Shape
+import androidx.compose.ui.graphics.SolidColor
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import org.nsh07.pomodoro.ui.theme.AppFonts.openRundeClock
+
+@OptIn(ExperimentalMaterial3ExpressiveApi::class)
+@Composable
+fun MinuteInputField(
+ state: TextFieldState,
+ shape: Shape,
+ modifier: Modifier = Modifier,
+ imeAction: ImeAction = ImeAction.Next
+) {
+ BasicTextField(
+ state = state,
+ lineLimits = TextFieldLineLimits.SingleLine,
+ inputTransformation = MinutesInputTransformation,
+ outputTransformation = MinutesOutputTransformation,
+ keyboardOptions = KeyboardOptions(
+ keyboardType = KeyboardType.NumberPassword,
+ imeAction = imeAction
+ ),
+ textStyle = TextStyle(
+ fontFamily = openRundeClock,
+ fontWeight = FontWeight.Bold,
+ fontSize = 57.sp,
+ letterSpacing = (-2).sp,
+ color = colorScheme.onSurfaceVariant,
+ textAlign = TextAlign.Center
+ ),
+ cursorBrush = SolidColor(colorScheme.onSurface),
+ decorator = { innerTextField ->
+ Box(
+ contentAlignment = Alignment.Center,
+ modifier = modifier
+ .size(112.dp, 100.dp)
+ .background(
+ animateColorAsState(
+ if (state.text.isNotEmpty())
+ colorScheme.surface
+ else colorScheme.errorContainer,
+ motionScheme.defaultEffectsSpec()
+ ).value,
+ shape
+ )
+ ) { innerTextField() }
+ }
+ )
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/MinutesTransformation.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/MinutesTransformation.kt
new file mode 100644
index 0000000..e68c680
--- /dev/null
+++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/MinutesTransformation.kt
@@ -0,0 +1,25 @@
+package org.nsh07.pomodoro.ui.settingsScreen
+
+import androidx.compose.foundation.text.input.InputTransformation
+import androidx.compose.foundation.text.input.OutputTransformation
+import androidx.compose.foundation.text.input.TextFieldBuffer
+import androidx.compose.foundation.text.input.insert
+import androidx.core.text.isDigitsOnly
+
+object MinutesInputTransformation : InputTransformation {
+ override fun TextFieldBuffer.transformInput() {
+ if (!this.asCharSequence().isDigitsOnly() || this.length > 2) {
+ revertAllChanges()
+ }
+ }
+}
+
+object MinutesOutputTransformation : OutputTransformation {
+ override fun TextFieldBuffer.transformOutput() {
+ if (this.length == 0) {
+ insert(0, "00")
+ } else if (this.toString().toInt() < 10) {
+ insert(0, "0")
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/SettingsScreen.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/SettingsScreen.kt
index 6dfd860..60d29b5 100644
--- a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/SettingsScreen.kt
+++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/SettingsScreen.kt
@@ -1,25 +1,106 @@
package org.nsh07.pomodoro.ui.settingsScreen
-import androidx.compose.foundation.layout.Box
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.foundation.background
+import androidx.compose.foundation.horizontalScroll
+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.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.input.TextFieldState
+import androidx.compose.foundation.text.input.rememberTextFieldState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
-import androidx.compose.material3.LoadingIndicator
+import androidx.compose.material3.FilledTonalIconToggleButton
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButtonDefaults
+import androidx.compose.material3.ListItem
import androidx.compose.material3.LocalTextStyle
+import androidx.compose.material3.MaterialTheme.colorScheme
+import androidx.compose.material3.MaterialTheme.shapes
import androidx.compose.material3.MaterialTheme.typography
+import androidx.compose.material3.Slider
+import androidx.compose.material3.SliderState
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
+import androidx.compose.material3.TopAppBarDefaults
+import androidx.compose.material3.rememberSliderState
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.input.nestedscroll.nestedScroll
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.input.ImeAction
+import androidx.compose.ui.tooling.preview.Devices
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
+import androidx.lifecycle.viewmodel.compose.viewModel
+import org.nsh07.pomodoro.R
+import org.nsh07.pomodoro.ui.settingsScreen.viewModel.SettingsViewModel
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTitle
+import org.nsh07.pomodoro.ui.theme.TomatoTheme
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun SettingsScreenRoot(
+ modifier: Modifier = Modifier,
+ viewModel: SettingsViewModel = viewModel(factory = SettingsViewModel.Factory)
+) {
+ val focusTimeInputFieldState = rememberSaveable(saver = TextFieldState.Saver) {
+ viewModel.focusTimeTextFieldState
+ }
+ val shortBreakTimeInputFieldState = rememberSaveable(saver = TextFieldState.Saver) {
+ viewModel.shortBreakTimeTextFieldState
+ }
+ val longBreakTimeInputFieldState = rememberSaveable(saver = TextFieldState.Saver) {
+ viewModel.longBreakTimeTextFieldState
+ }
+
+ val sessionsSliderState = rememberSaveable(
+ saver = SliderState.Saver(
+ viewModel.sessionsSliderState.onValueChangeFinished,
+ viewModel.sessionsSliderState.valueRange
+ )
+ ) {
+ viewModel.sessionsSliderState
+ }
+
+ SettingsScreen(
+ focusTimeInputFieldState = focusTimeInputFieldState,
+ shortBreakTimeInputFieldState = shortBreakTimeInputFieldState,
+ longBreakTimeInputFieldState = longBreakTimeInputFieldState,
+ sessionsSliderState = sessionsSliderState,
+ modifier = modifier
+ )
+}
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@Composable
-fun SettingsScreen(modifier: Modifier = Modifier) {
- Column(modifier) {
+private fun SettingsScreen(
+ focusTimeInputFieldState: TextFieldState,
+ shortBreakTimeInputFieldState: TextFieldState,
+ longBreakTimeInputFieldState: TextFieldState,
+ sessionsSliderState: SliderState,
+ modifier: Modifier = Modifier
+) {
+ val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
+
+ Column(modifier.nestedScroll(scrollBehavior.nestedScrollConnection)) {
TopAppBar(
title = {
Text(
@@ -32,13 +113,159 @@ fun SettingsScreen(modifier: Modifier = Modifier) {
)
},
subtitle = {},
- titleHorizontalAlignment = Alignment.CenterHorizontally
+ colors = TopAppBarDefaults.topAppBarColors(containerColor = colorScheme.surfaceContainer),
+ titleHorizontalAlignment = Alignment.CenterHorizontally,
+ scrollBehavior = scrollBehavior
)
- Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {
- Column(horizontalAlignment = Alignment.CenterHorizontally) {
- LoadingIndicator()
- Text("Coming Soon", style = typography.headlineSmall, fontFamily = robotoFlexTitle)
+
+ LazyColumn(
+ verticalArrangement = Arrangement.spacedBy(2.dp),
+ modifier = Modifier
+ .background(colorScheme.surfaceContainer)
+ .fillMaxSize()
+ .padding(horizontal = 16.dp)
+ ) {
+ item {
+ Spacer(Modifier.height(12.dp))
+ }
+ item {
+ Row(
+ horizontalArrangement = Arrangement.Center,
+ modifier = Modifier
+ .fillMaxWidth()
+ .horizontalScroll(rememberScrollState())
+ ) {
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.spacedBy(2.dp)
+ ) {
+ Text(
+ "Focus",
+ style = typography.titleSmallEmphasized
+ )
+ MinuteInputField(
+ state = focusTimeInputFieldState,
+ shape = RoundedCornerShape(
+ topStart = 16.dp,
+ bottomStart = 16.dp,
+ topEnd = 4.dp,
+ bottomEnd = 4.dp
+ ),
+ imeAction = ImeAction.Next
+ )
+ }
+ Spacer(Modifier.width(2.dp))
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.spacedBy(2.dp)
+ ) {
+ Text(
+ "Short break",
+ style = typography.titleSmallEmphasized
+ )
+ MinuteInputField(
+ state = shortBreakTimeInputFieldState,
+ shape = RoundedCornerShape(4.dp),
+ imeAction = ImeAction.Next
+ )
+ }
+ Spacer(Modifier.width(2.dp))
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.spacedBy(2.dp)
+ ) {
+ Text(
+ "Long break",
+ style = typography.titleSmallEmphasized
+ )
+ MinuteInputField(
+ state = longBreakTimeInputFieldState,
+ shape = RoundedCornerShape(
+ topStart = 4.dp,
+ bottomStart = 4.dp,
+ topEnd = 16.dp,
+ bottomEnd = 16.dp
+ ),
+ imeAction = ImeAction.Done
+ )
+ }
+ }
+ }
+ item {
+ Spacer(Modifier.height(12.dp))
+ }
+ item {
+ ListItem(
+ leadingContent = {
+ Icon(
+ painterResource(R.drawable.clocks),
+ null
+ )
+ },
+ headlineContent = {
+ Text("Session length")
+ },
+ supportingContent = {
+ Column {
+ Text("Focus intervals in one session: ${sessionsSliderState.value.toInt()}")
+ Slider(
+ state = sessionsSliderState,
+ modifier = Modifier.padding(vertical = 4.dp)
+ )
+ }
+ },
+ modifier = Modifier.clip(shapes.large)
+ )
+ }
+ item {
+ var expanded by remember { mutableStateOf(false) }
+ Column(
+ horizontalAlignment = Alignment.End,
+ modifier = Modifier
+ .padding(vertical = 6.dp)
+ .fillMaxWidth()
+ ) {
+ FilledTonalIconToggleButton(
+ checked = expanded,
+ onCheckedChange = { expanded = it },
+ shapes = IconButtonDefaults.toggleableShapes(),
+ modifier = Modifier.width(52.dp)
+ ) {
+ Icon(
+ painterResource(R.drawable.info),
+ null
+ )
+ }
+ AnimatedVisibility(expanded) {
+ Text(
+ "A \"session\" is a sequence of pomodoro intervals that contain focus" +
+ " intervals, short break intervals, and a long break interval. The " +
+ "last break of a session is always a long break.",
+ style = typography.bodyMedium,
+ color = colorScheme.onSurfaceVariant,
+ modifier = Modifier.padding(8.dp)
+ )
+ }
+ }
}
}
}
-}
\ No newline at end of file
+}
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Preview(
+ showSystemUi = true,
+ device = Devices.PIXEL_9_PRO
+)
+@Composable
+fun SettingsScreenPreview() {
+ TomatoTheme {
+ SettingsScreen(
+ focusTimeInputFieldState = rememberTextFieldState((25 * 60 * 1000).toString()),
+ shortBreakTimeInputFieldState = rememberTextFieldState((5 * 60 * 1000).toString()),
+ longBreakTimeInputFieldState = rememberTextFieldState((15 * 60 * 1000).toString()),
+ sessionsSliderState = rememberSliderState(value = 3f, steps = 3, valueRange = 1f..5f),
+ modifier = Modifier.fillMaxSize()
+ )
+ }
+}
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/viewModel/SettingsViewModel.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/viewModel/SettingsViewModel.kt
new file mode 100644
index 0000000..52c9407
--- /dev/null
+++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/viewModel/SettingsViewModel.kt
@@ -0,0 +1,102 @@
+package org.nsh07.pomodoro.ui.settingsScreen.viewModel
+
+import androidx.compose.foundation.text.input.TextFieldState
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.SliderState
+import androidx.compose.runtime.snapshotFlow
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.ViewModelProvider
+import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY
+import androidx.lifecycle.viewModelScope
+import androidx.lifecycle.viewmodel.initializer
+import androidx.lifecycle.viewmodel.viewModelFactory
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.FlowPreview
+import kotlinx.coroutines.flow.debounce
+import kotlinx.coroutines.launch
+import org.nsh07.pomodoro.TomatoApplication
+import org.nsh07.pomodoro.data.AppPreferenceRepository
+import org.nsh07.pomodoro.data.TimerRepository
+
+@OptIn(FlowPreview::class, ExperimentalMaterial3Api::class)
+class SettingsViewModel(
+ private val preferenceRepository: AppPreferenceRepository,
+ private val timerRepository: TimerRepository
+) : ViewModel() {
+ val focusTimeTextFieldState =
+ TextFieldState((timerRepository.focusTime / 60000).toString())
+ val shortBreakTimeTextFieldState =
+ TextFieldState((timerRepository.shortBreakTime / 60000).toString())
+ val longBreakTimeTextFieldState =
+ TextFieldState((timerRepository.longBreakTime / 60000).toString())
+
+ val sessionsSliderState = SliderState(
+ value = timerRepository.sessionLength.toFloat(),
+ steps = 4,
+ valueRange = 1f..6f,
+ onValueChangeFinished = ::updateSessionLength
+ )
+
+ init {
+ viewModelScope.launch(Dispatchers.IO) {
+ snapshotFlow { focusTimeTextFieldState.text }
+ .debounce(500)
+ .collect {
+ if (it.isNotEmpty()) {
+ timerRepository.focusTime = preferenceRepository.saveIntPreference(
+ "focus_time",
+ it.toString().toInt() * 60 * 1000
+ )
+ }
+ }
+ }
+ viewModelScope.launch(Dispatchers.IO) {
+ snapshotFlow { shortBreakTimeTextFieldState.text }
+ .debounce(500)
+ .collect {
+ if (it.isNotEmpty()) {
+ timerRepository.shortBreakTime = preferenceRepository.saveIntPreference(
+ "short_break_time",
+ it.toString().toInt() * 60 * 1000
+ )
+ }
+ }
+ }
+ viewModelScope.launch(Dispatchers.IO) {
+ snapshotFlow { longBreakTimeTextFieldState.text }
+ .debounce(500)
+ .collect {
+ if (it.isNotEmpty()) {
+ timerRepository.longBreakTime = preferenceRepository.saveIntPreference(
+ "long_break_time",
+ it.toString().toInt() * 60 * 1000
+ )
+ }
+ }
+ }
+ }
+
+ private fun updateSessionLength() {
+ viewModelScope.launch {
+ timerRepository.sessionLength = preferenceRepository.saveIntPreference(
+ "session_length",
+ sessionsSliderState.value.toInt()
+ )
+ }
+ }
+
+ companion object {
+ val Factory: ViewModelProvider.Factory = viewModelFactory {
+ initializer {
+ val application = (this[APPLICATION_KEY] as TomatoApplication)
+ val appPreferenceRepository = application.container.appPreferencesRepository
+ val appTimerRepository = application.container.appTimerRepository
+
+ SettingsViewModel(
+ preferenceRepository = appPreferenceRepository,
+ timerRepository = appTimerRepository
+ )
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/StatsScreen.kt b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/StatsScreen.kt
index 43cdb03..6720c33 100644
--- a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/StatsScreen.kt
+++ b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/StatsScreen.kt
@@ -1,5 +1,6 @@
package org.nsh07.pomodoro.ui.statsScreen
+import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
@@ -7,6 +8,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.LoadingIndicator
import androidx.compose.material3.LocalTextStyle
+import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
@@ -34,7 +36,7 @@ fun StatsScreen(modifier: Modifier = Modifier) {
subtitle = {},
titleHorizontalAlignment = Alignment.CenterHorizontally
)
- Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {
+ Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize().background(colorScheme.surface)) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
LoadingIndicator()
Text("Coming Soon", style = typography.headlineSmall, fontFamily = robotoFlexTitle)
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/TimerScreen.kt b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/TimerScreen.kt
index 66957db..0153c8c 100644
--- a/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/TimerScreen.kt
+++ b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/TimerScreen.kt
@@ -34,16 +34,13 @@ import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.drawscope.Stroke
-import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalDensity
-import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
@@ -56,13 +53,13 @@ import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.theme.AppFonts.openRundeClock
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTitle
import org.nsh07.pomodoro.ui.theme.TomatoTheme
-import org.nsh07.pomodoro.ui.viewModel.TimerMode
-import org.nsh07.pomodoro.ui.viewModel.UiState
+import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerMode
+import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerState
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun TimerScreen(
- uiState: UiState,
+ timerState: TimerState,
showBrandTitle: Boolean,
progress: () -> Float,
resetTimer: () -> Unit,
@@ -71,33 +68,28 @@ fun TimerScreen(
modifier: Modifier = Modifier
) {
val motionScheme = motionScheme
- val haptic = LocalHapticFeedback.current
val color by animateColorAsState(
- if (uiState.timerMode == TimerMode.FOCUS) colorScheme.primary
+ if (timerState.timerMode == TimerMode.FOCUS) colorScheme.primary
else colorScheme.tertiary,
animationSpec = motionScheme.slowEffectsSpec()
)
val onColor by animateColorAsState(
- if (uiState.timerMode == TimerMode.FOCUS) colorScheme.onPrimary
+ if (timerState.timerMode == TimerMode.FOCUS) colorScheme.onPrimary
else colorScheme.onTertiary,
animationSpec = motionScheme.slowEffectsSpec()
)
val colorContainer by animateColorAsState(
- if (uiState.timerMode == TimerMode.FOCUS) colorScheme.secondaryContainer
+ if (timerState.timerMode == TimerMode.FOCUS) colorScheme.secondaryContainer
else colorScheme.tertiaryContainer,
animationSpec = motionScheme.slowEffectsSpec()
)
- LaunchedEffect(uiState.timerMode) {
- haptic.performHapticFeedback(HapticFeedbackType.LongPress)
- }
-
Column(modifier = modifier) {
TopAppBar(
title = {
AnimatedContent(
- if (!showBrandTitle) uiState.timerMode else TimerMode.BRAND,
+ if (!showBrandTitle) timerState.timerMode else TimerMode.BRAND,
transitionSpec = {
slideInVertically(
animationSpec = motionScheme.slowSpatialSpec(),
@@ -174,7 +166,7 @@ fun TimerScreen(
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Box(contentAlignment = Alignment.Center) {
- if (uiState.timerMode == TimerMode.FOCUS) {
+ if (timerState.timerMode == TimerMode.FOCUS) {
CircularProgressIndicator(
progress = progress,
modifier = Modifier
@@ -212,7 +204,7 @@ fun TimerScreen(
)
}
Text(
- text = uiState.timeStr,
+ text = timerState.timeStr,
style = TextStyle(
fontFamily = openRundeClock,
fontWeight = FontWeight.Bold,
@@ -254,7 +246,7 @@ fun TimerScreen(
{
FilledIconToggleButton(
onCheckedChange = { toggleTimer() },
- checked = uiState.timerRunning,
+ checked = timerState.timerRunning,
colors = IconButtonDefaults.filledIconToggleButtonColors(
checkedContainerColor = color,
checkedContentColor = onColor
@@ -265,7 +257,7 @@ fun TimerScreen(
.size(width = 128.dp, height = 96.dp)
.animateWidth(interactionSources[0])
) {
- if (uiState.timerRunning) {
+ if (timerState.timerRunning) {
Icon(
painterResource(R.drawable.pause_large),
contentDescription = "Pause",
@@ -283,7 +275,7 @@ fun TimerScreen(
{ state ->
DropdownMenuItem(
leadingIcon = {
- if (uiState.timerRunning) {
+ if (timerState.timerRunning) {
Icon(
painterResource(R.drawable.pause),
contentDescription = "Pause"
@@ -295,7 +287,7 @@ fun TimerScreen(
)
}
},
- text = { Text(if (uiState.timerRunning) "Pause" else "Play") },
+ text = { Text(if (timerState.timerRunning) "Pause" else "Play") },
onClick = {
toggleTimer()
state.dismiss()
@@ -385,17 +377,17 @@ fun TimerScreen(
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Text("Up next", style = typography.titleSmall)
Text(
- uiState.nextTimeStr,
+ timerState.nextTimeStr,
style = TextStyle(
fontFamily = openRundeClock,
fontWeight = FontWeight.Bold,
fontSize = 22.sp,
lineHeight = 28.sp,
- color = if (uiState.nextTimerMode == TimerMode.FOCUS) colorScheme.primary else colorScheme.tertiary
+ color = if (timerState.nextTimerMode == TimerMode.FOCUS) colorScheme.primary else colorScheme.tertiary
)
)
Text(
- when (uiState.nextTimerMode) {
+ when (timerState.nextTimerMode) {
TimerMode.FOCUS -> "Focus"
TimerMode.SHORT_BREAK -> "Short Break"
else -> "Long Break"
@@ -413,12 +405,12 @@ fun TimerScreen(
)
@Composable
fun TimerScreenPreview() {
- val uiState = UiState(
+ val timerState = TimerState(
timeStr = "03:34", nextTimeStr = "5:00", timerMode = TimerMode.FOCUS, timerRunning = true
)
TomatoTheme {
TimerScreen(
- uiState,
+ timerState,
false,
{ 0.3f },
{},
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/viewModel/UiState.kt b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/viewModel/TimerState.kt
similarity index 81%
rename from app/src/main/java/org/nsh07/pomodoro/ui/viewModel/UiState.kt
rename to app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/viewModel/TimerState.kt
index f1a330f..e100237 100644
--- a/app/src/main/java/org/nsh07/pomodoro/ui/viewModel/UiState.kt
+++ b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/viewModel/TimerState.kt
@@ -1,6 +1,6 @@
-package org.nsh07.pomodoro.ui.viewModel
+package org.nsh07.pomodoro.ui.timerScreen.viewModel
-data class UiState(
+data class TimerState(
val timerMode: TimerMode = TimerMode.FOCUS,
val timeStr: String = "25:00",
val totalTime: Int = 25 * 60,
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/viewModel/TimerViewModel.kt b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/viewModel/TimerViewModel.kt
new file mode 100644
index 0000000..b266105
--- /dev/null
+++ b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/viewModel/TimerViewModel.kt
@@ -0,0 +1,181 @@
+package org.nsh07.pomodoro.ui.timerScreen.viewModel
+
+import android.os.SystemClock
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.ViewModelProvider
+import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY
+import androidx.lifecycle.viewModelScope
+import androidx.lifecycle.viewmodel.initializer
+import androidx.lifecycle.viewmodel.viewModelFactory
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.FlowPreview
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.flow.update
+import kotlinx.coroutines.launch
+import org.nsh07.pomodoro.TomatoApplication
+import org.nsh07.pomodoro.data.AppPreferenceRepository
+import org.nsh07.pomodoro.data.TimerRepository
+import org.nsh07.pomodoro.utils.millisecondsToStr
+
+@OptIn(FlowPreview::class)
+class TimerViewModel(
+ private val preferenceRepository: AppPreferenceRepository,
+ private val timerRepository: TimerRepository
+) : ViewModel() {
+ init {
+ viewModelScope.launch(Dispatchers.IO) {
+ timerRepository.focusTime = preferenceRepository.getIntPreference("focus_time")
+ ?: preferenceRepository.saveIntPreference("focus_time", timerRepository.focusTime)
+ timerRepository.shortBreakTime = preferenceRepository.getIntPreference("short_break_time")
+ ?: preferenceRepository.saveIntPreference("short_break_time", timerRepository.shortBreakTime)
+ timerRepository.longBreakTime = preferenceRepository.getIntPreference("long_break_time")
+ ?: preferenceRepository.saveIntPreference("long_break_time", timerRepository.longBreakTime)
+ timerRepository.sessionLength = preferenceRepository.getIntPreference("session_length")
+ ?: preferenceRepository.saveIntPreference("session_length", timerRepository.sessionLength)
+
+ resetTimer()
+ }
+ }
+
+ private val _timerState = MutableStateFlow(
+ TimerState(
+ totalTime = timerRepository.focusTime,
+ timeStr = millisecondsToStr(timerRepository.focusTime),
+ nextTimeStr = millisecondsToStr(timerRepository.shortBreakTime)
+ )
+ )
+ val timerState: StateFlow = _timerState.asStateFlow()
+ var timerJob: Job? = null
+
+ private val _time = MutableStateFlow(timerRepository.focusTime)
+ val time: StateFlow = _time.asStateFlow()
+
+ private var cycles = 0
+ private var startTime = 0L
+ private var pauseTime = 0L
+ private var pauseDuration = 0L
+
+ fun resetTimer() {
+ _time.update { timerRepository.focusTime }
+ cycles = 0
+ startTime = 0L
+ pauseTime = 0L
+ pauseDuration = 0L
+
+ _timerState.update { currentState ->
+ currentState.copy(
+ timerMode = TimerMode.FOCUS,
+ timeStr = millisecondsToStr(time.value),
+ totalTime = time.value,
+ nextTimerMode = TimerMode.SHORT_BREAK,
+ nextTimeStr = millisecondsToStr(timerRepository.shortBreakTime)
+ )
+ }
+ }
+
+ fun skipTimer() {
+ startTime = 0L
+ pauseTime = 0L
+ pauseDuration = 0L
+ cycles = (cycles + 1) % (timerRepository.sessionLength * 2)
+
+ if (cycles % 2 == 0) {
+ _time.update { timerRepository.focusTime }
+ _timerState.update { currentState ->
+ currentState.copy(
+ timerMode = TimerMode.FOCUS,
+ timeStr = millisecondsToStr(time.value),
+ totalTime = time.value,
+ nextTimerMode = if (cycles == 6) TimerMode.LONG_BREAK else TimerMode.SHORT_BREAK,
+ nextTimeStr = if (cycles == 6) millisecondsToStr(
+ timerRepository.longBreakTime
+ ) else millisecondsToStr(
+ timerRepository.shortBreakTime
+ )
+ )
+ }
+ } else {
+ val long = cycles == (timerRepository.sessionLength * 2) - 1
+ _time.update { if (long) timerRepository.longBreakTime else timerRepository.shortBreakTime }
+
+ _timerState.update { currentState ->
+ currentState.copy(
+ timerMode = if (long) TimerMode.LONG_BREAK else TimerMode.SHORT_BREAK,
+ timeStr = millisecondsToStr(time.value),
+ totalTime = time.value,
+ nextTimerMode = TimerMode.FOCUS,
+ nextTimeStr = millisecondsToStr(timerRepository.focusTime)
+ )
+ }
+ }
+ }
+
+ fun toggleTimer() {
+ if (timerState.value.timerRunning) {
+ _timerState.update { currentState ->
+ currentState.copy(timerRunning = false)
+ }
+ timerJob?.cancel()
+ pauseTime = SystemClock.elapsedRealtime()
+ } else {
+ _timerState.update { it.copy(timerRunning = true) }
+ if (pauseTime != 0L) pauseDuration += SystemClock.elapsedRealtime() - pauseTime
+
+ timerJob = viewModelScope.launch {
+ while (true) {
+ if (!timerState.value.timerRunning) break
+ if (startTime == 0L) startTime = SystemClock.elapsedRealtime()
+
+ _time.update {
+ when (timerState.value.timerMode) {
+ TimerMode.FOCUS ->
+ timerRepository.focusTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration).toInt()
+
+ TimerMode.SHORT_BREAK ->
+ timerRepository.shortBreakTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration).toInt()
+
+ else ->
+ timerRepository.longBreakTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration).toInt()
+ }
+ }
+
+ if (time.value < 0) {
+ skipTimer()
+
+ _timerState.update { currentState ->
+ currentState.copy(timerRunning = false)
+ }
+ timerJob?.cancel()
+ } else {
+ _timerState.update { currentState ->
+ currentState.copy(
+ timeStr = millisecondsToStr(time.value)
+ )
+ }
+ }
+
+ delay(100)
+ }
+ }
+ }
+ }
+
+ companion object {
+ val Factory: ViewModelProvider.Factory = viewModelFactory {
+ initializer {
+ val application = (this[APPLICATION_KEY] as TomatoApplication)
+ val appPreferenceRepository = application.container.appPreferencesRepository
+ val appTimerRepository = application.container.appTimerRepository
+
+ TimerViewModel(
+ preferenceRepository = appPreferenceRepository,
+ timerRepository = appTimerRepository
+ )
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/viewModel/UiViewModel.kt b/app/src/main/java/org/nsh07/pomodoro/ui/viewModel/UiViewModel.kt
deleted file mode 100644
index ef54923..0000000
--- a/app/src/main/java/org/nsh07/pomodoro/ui/viewModel/UiViewModel.kt
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.nsh07.pomodoro.ui.viewModel
-
-import android.os.SystemClock
-import androidx.lifecycle.ViewModel
-import androidx.lifecycle.viewModelScope
-import kotlinx.coroutines.Job
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.asStateFlow
-import kotlinx.coroutines.flow.update
-import kotlinx.coroutines.launch
-import java.util.Locale
-import kotlin.math.ceil
-
-class UiViewModel : ViewModel() {
- val focusTime = 25 * 60 * 1000
- val shortBreakTime = 5 * 60 * 1000
- val longBreakTime = 15 * 60 * 1000
-
- private val _uiState = MutableStateFlow(
- UiState(
- totalTime = focusTime,
- timeStr = millisecondsToStr(focusTime),
- nextTimeStr = millisecondsToStr(shortBreakTime)
- )
- )
- val uiState: StateFlow = _uiState.asStateFlow()
- var timerJob: Job? = null
-
- private val _time = MutableStateFlow(focusTime)
- val time: StateFlow = _time.asStateFlow()
-
- private var cycles = 0
- private var startTime = 0L
- private var pauseTime = 0L
- private var pauseDuration = 0L
-
- fun resetTimer() {
- _time.update { focusTime }
- cycles = 0
- startTime = 0L
- pauseTime = 0L
- pauseDuration = 0L
-
- _uiState.update { currentState ->
- currentState.copy(
- timerMode = TimerMode.FOCUS,
- timeStr = millisecondsToStr(time.value),
- totalTime = time.value,
- nextTimerMode = TimerMode.SHORT_BREAK,
- nextTimeStr = millisecondsToStr(shortBreakTime)
- )
- }
- }
-
- fun skipTimer() {
- startTime = 0L
- pauseTime = 0L
- pauseDuration = 0L
- cycles = (cycles + 1) % 8
-
- if (cycles % 2 == 0) {
- _time.update { focusTime }
- _uiState.update { currentState ->
- currentState.copy(
- timerMode = TimerMode.FOCUS,
- timeStr = millisecondsToStr(time.value),
- totalTime = time.value,
- nextTimerMode = if (cycles == 6) TimerMode.LONG_BREAK else TimerMode.SHORT_BREAK,
- nextTimeStr = if (cycles == 6) millisecondsToStr(
- longBreakTime
- ) else millisecondsToStr(
- shortBreakTime
- )
- )
- }
- } else {
- val long = cycles == 7
- _time.update { if (long) longBreakTime else shortBreakTime }
-
- _uiState.update { currentState ->
- currentState.copy(
- timerMode = if (long) TimerMode.LONG_BREAK else TimerMode.SHORT_BREAK,
- timeStr = millisecondsToStr(time.value),
- totalTime = time.value,
- nextTimerMode = TimerMode.FOCUS,
- nextTimeStr = millisecondsToStr(focusTime)
- )
- }
- }
- }
-
- fun toggleTimer() {
- if (uiState.value.timerRunning) {
- _uiState.update { currentState ->
- currentState.copy(timerRunning = false)
- }
- timerJob?.cancel()
- pauseTime = SystemClock.elapsedRealtime()
- } else {
- _uiState.update { it.copy(timerRunning = true) }
- if (pauseTime != 0L) pauseDuration += SystemClock.elapsedRealtime() - pauseTime
-
- timerJob = viewModelScope.launch {
- while (true) {
- if (!uiState.value.timerRunning) break
- if (startTime == 0L) startTime = SystemClock.elapsedRealtime()
-
- _time.update {
- when (uiState.value.timerMode) {
- TimerMode.FOCUS ->
- focusTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration).toInt()
- TimerMode.SHORT_BREAK ->
- shortBreakTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration).toInt()
- else ->
- longBreakTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration).toInt()
- }
- }
-
- if (time.value < 0) {
- startTime = 0L
- pauseTime = 0L
- pauseDuration = 0L
- cycles = (cycles + 1) % 8
-
- if (cycles % 2 == 0) {
- _time.update { focusTime }
- _uiState.update { currentState ->
- currentState.copy(
- timerMode = TimerMode.FOCUS,
- timeStr = millisecondsToStr(time.value),
- totalTime = time.value,
- nextTimerMode = if (cycles == 6) TimerMode.LONG_BREAK else TimerMode.SHORT_BREAK,
- nextTimeStr = if (cycles == 6) millisecondsToStr(
- longBreakTime
- ) else millisecondsToStr(
- shortBreakTime
- )
- )
- }
- } else {
- val long = cycles == 7
- _time.update { if (long) longBreakTime else shortBreakTime }
-
- _uiState.update { currentState ->
- currentState.copy(
- timerMode = if (long) TimerMode.LONG_BREAK else TimerMode.SHORT_BREAK,
- timeStr = millisecondsToStr(time.value),
- totalTime = time.value,
- nextTimerMode = TimerMode.FOCUS,
- nextTimeStr = millisecondsToStr(focusTime)
- )
- }
- }
- } else {
- _uiState.update { currentState ->
- currentState.copy(
- timeStr = millisecondsToStr(time.value)
- )
- }
- }
-
- delay(100)
- }
- }
- }
- }
-
- private fun millisecondsToStr(t: Int): String {
- val min = (ceil(t / 1000.0).toInt() / 60)
- val sec = (ceil(t / 1000.0).toInt() % 60)
- return String.format(locale = Locale.getDefault(), "%02d:%02d", min, sec)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/nsh07/pomodoro/utils/Utils.kt b/app/src/main/java/org/nsh07/pomodoro/utils/Utils.kt
new file mode 100644
index 0000000..1bb75c2
--- /dev/null
+++ b/app/src/main/java/org/nsh07/pomodoro/utils/Utils.kt
@@ -0,0 +1,10 @@
+package org.nsh07.pomodoro.utils
+
+import java.util.Locale
+import kotlin.math.ceil
+
+fun millisecondsToStr(t: Int): String {
+ val min = (ceil(t / 1000.0).toInt() / 60)
+ val sec = (ceil(t / 1000.0).toInt() % 60)
+ return String.format(locale = Locale.getDefault(), "%02d:%02d", min, sec)
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/clocks.xml b/app/src/main/res/drawable/clocks.xml
new file mode 100644
index 0000000..f5ddad5
--- /dev/null
+++ b/app/src/main/res/drawable/clocks.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index 07d5da9..0000000
--- a/app/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml
index 2b068d1..5b46f15 100644
--- a/app/src/main/res/drawable/ic_launcher_foreground.xml
+++ b/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -4,27 +4,56 @@
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+ android:pathData="m61.22,25.81c-9.66,0.52 -9.89,6.71 -9.22,10.6l3.48,0.08c1.13,-2.8 -0.16,-6.5 7.42,-6.91 0,-1.55 0.07,-3.18 -1.68,-3.77zM67.14,33.3c-3.56,-0.17 -7.58,0.44 -9.39,3.55l7.41,3.5c3.18,-0.94 5.77,-1.16 8.65,-5.93 0,0 -3.11,-0.95 -6.67,-1.12zM40.11,33.46c-3.43,0.14 -6.25,0.96 -6.25,0.96 2.41,2.89 5.24,5.15 9.54,5.21 1.65,-1.88 4.05,-2.62 6.64,-3.08 -2.46,-2.7 -6.5,-3.23 -9.93,-3.09zM53.93,38.98c-9.07,-0.33 -11.94,7.41 -11.94,7.41 4.64,-0.38 8.72,-2.26 11.94,-6.43 2.58,4.94 6.8,6.14 11.59,6.04 0,0 -2.52,-6.7 -11.59,-7.02z"
+ android:strokeLineJoin="round"
+ android:strokeWidth="3.32073"
+ android:fillColor="#00000000"
+ android:strokeColor="#ffffff"/>
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_monochrome.xml b/app/src/main/res/drawable/ic_launcher_monochrome.xml
new file mode 100644
index 0000000..86cd4d3
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_monochrome.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/info.xml b/app/src/main/res/drawable/info.xml
new file mode 100644
index 0000000..bd589bd
--- /dev/null
+++ b/app/src/main/res/drawable/info.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
similarity index 56%
rename from app/src/main/res/mipmap-anydpi/ic_launcher.xml
rename to app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 6f3b755..1084c24 100644
--- a/app/src/main/res/mipmap-anydpi/ic_launcher.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,6 +1,6 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
deleted file mode 100644
index 6f3b755..0000000
--- a/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
deleted file mode 100644
index c209e78..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
deleted file mode 100644
index b2dfe3d..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
deleted file mode 100644
index 4f0f1d6..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
deleted file mode 100644
index 62b611d..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
deleted file mode 100644
index 948a307..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
deleted file mode 100644
index 1b9a695..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
deleted file mode 100644
index 28d4b77..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9287f50..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
deleted file mode 100644
index aa7d642..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9126ae3..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml
new file mode 100644
index 0000000..c5d5899
--- /dev/null
+++ b/app/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #FFFFFF
+
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 5ba8ae0..f370cb1 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,4 +4,5 @@ plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.kotlin.serialization) apply false
+ alias(libs.plugins.ksp) apply false
}
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png
index e14c311..fe1e1ac 100644
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png
index bbca7c3..e960980 100644
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png
index 154b6d2..34f0f93 100644
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png
index dde346b..a31175b 100644
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png
new file mode 100644
index 0000000..45b2bdf
Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png
new file mode 100644
index 0000000..780260b
Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png differ
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index d7e6a71..2696859 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,37 +1,45 @@
[versions]
+activityCompose = "1.10.1"
+adaptive = "1.1.0"
agp = "8.11.0"
-kotlin = "2.2.0"
+composeBom = "2025.06.02"
coreKtx = "1.16.0"
+espressoCore = "3.6.1"
junit = "4.13.2"
junitVersion = "1.2.1"
-espressoCore = "3.6.1"
+kotlin = "2.2.0"
+ksp = "2.2.0-2.0.2"
lifecycleRuntimeKtx = "2.9.1"
-activityCompose = "1.10.1"
-composeBom = "2025.06.02"
navigation3Runtime = "1.0.0-alpha05"
+room = "2.7.2"
[libraries]
+androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
+androidx-adaptive = { group = "androidx.compose.material3.adaptive", name = "adaptive", version.ref = "adaptive" }
+androidx-compose-bom = { group = "androidx.compose", name = "compose-bom-alpha", version.ref = "composeBom" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
+androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
+androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleRuntimeKtx" }
+androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-navigation3-runtime = { module = "androidx.navigation3:navigation3-runtime", version.ref = "navigation3Runtime" }
androidx-navigation3-ui = { module = "androidx.navigation3:navigation3-ui", version.ref = "navigation3Runtime" }
-junit = { group = "junit", name = "junit", version.ref = "junit" }
-androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
-androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
-androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
-androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
-androidx-compose-bom = { group = "androidx.compose", name = "compose-bom-alpha", version.ref = "composeBom" }
+androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
+androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
+androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
+androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
+androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
-androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
-androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
-androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
+junit = { group = "junit", name = "junit", version.ref = "junit" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin"}
+ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index e708b1c..1b33c55 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 5b9b2f5..ff23a68 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
-#Sat Jun 28 10:20:36 IST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 4f906e0..23d15a9 100755
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
-#!/usr/bin/env sh
+#!/bin/sh
#
-# Copyright 2015 the original author or authors.
+# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,81 +15,115 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
# Attempt to set APP_HOME
+
# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
warn () {
echo "$*"
-}
+} >&2
die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,88 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=`expr $i + 1`
- done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 107acd3..5eed7ee 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,89 +1,94 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega