Merge branch 'dev'
10
README.md
@@ -9,8 +9,10 @@ Tomato is a minimalist Pomodoro timer for Android based on Material 3 Expressive
|
|||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
<p align="center" width="100%">
|
<p align="center" width="100%">
|
||||||
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" width="24%">
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" width="30%">
|
||||||
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" width="24%">
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" width="30%">
|
||||||
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" width="24%">
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" width="30%">
|
||||||
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" width="24%">
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" width="30%">
|
||||||
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/5.png" width="30%">
|
||||||
|
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/6.png" width="30%">
|
||||||
</p>
|
</p>
|
||||||
@@ -5,6 +5,7 @@ plugins {
|
|||||||
alias(libs.plugins.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
alias(libs.plugins.kotlin.compose)
|
alias(libs.plugins.kotlin.compose)
|
||||||
alias(libs.plugins.kotlin.serialization)
|
alias(libs.plugins.kotlin.serialization)
|
||||||
|
alias(libs.plugins.ksp)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -16,7 +17,7 @@ android {
|
|||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "1.0"
|
versionName = "1.0.0-01-alpha"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -39,6 +40,9 @@ android {
|
|||||||
jvmTarget.set(JvmTarget.JVM_17) // Use the enum for target JVM version
|
jvmTarget.set(JvmTarget.JVM_17) // Use the enum for target JVM version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ksp {
|
||||||
|
arg("room.schemaLocation", "$projectDir/schemas")
|
||||||
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
compose = true
|
compose = true
|
||||||
}
|
}
|
||||||
@@ -50,6 +54,7 @@ dependencies {
|
|||||||
implementation(libs.androidx.lifecycle.viewmodel)
|
implementation(libs.androidx.lifecycle.viewmodel)
|
||||||
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
||||||
implementation(libs.androidx.activity.compose)
|
implementation(libs.androidx.activity.compose)
|
||||||
|
implementation(libs.androidx.adaptive)
|
||||||
implementation(platform(libs.androidx.compose.bom))
|
implementation(platform(libs.androidx.compose.bom))
|
||||||
implementation(libs.androidx.ui)
|
implementation(libs.androidx.ui)
|
||||||
implementation(libs.androidx.ui.graphics)
|
implementation(libs.androidx.ui.graphics)
|
||||||
@@ -59,6 +64,10 @@ dependencies {
|
|||||||
implementation(libs.androidx.navigation3.runtime)
|
implementation(libs.androidx.navigation3.runtime)
|
||||||
implementation(libs.androidx.navigation3.ui)
|
implementation(libs.androidx.navigation3.ui)
|
||||||
|
|
||||||
|
implementation(libs.androidx.room.runtime)
|
||||||
|
implementation(libs.androidx.room.ktx)
|
||||||
|
ksp(libs.androidx.room.compiler)
|
||||||
|
|
||||||
testImplementation(libs.junit)
|
testImplementation(libs.junit)
|
||||||
|
|
||||||
androidTestImplementation(libs.androidx.junit)
|
androidTestImplementation(libs.androidx.junit)
|
||||||
|
|||||||
@@ -3,14 +3,16 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
android:name=".TomatoApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Tomato">
|
android:theme="@style/Theme.Tomato"
|
||||||
|
tools:targetApi="36">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|||||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
@@ -4,18 +4,23 @@ import android.os.Bundle
|
|||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
|
import androidx.activity.viewModels
|
||||||
import org.nsh07.pomodoro.ui.AppScreen
|
import org.nsh07.pomodoro.ui.AppScreen
|
||||||
import org.nsh07.pomodoro.ui.NavItem
|
import org.nsh07.pomodoro.ui.NavItem
|
||||||
import org.nsh07.pomodoro.ui.Screen
|
import org.nsh07.pomodoro.ui.Screen
|
||||||
import org.nsh07.pomodoro.ui.theme.TomatoTheme
|
import org.nsh07.pomodoro.ui.theme.TomatoTheme
|
||||||
|
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerViewModel
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
|
private val viewModel: TimerViewModel by viewModels(factoryProducer = { TimerViewModel.Factory })
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
setContent {
|
setContent {
|
||||||
TomatoTheme {
|
TomatoTheme {
|
||||||
AppScreen()
|
AppScreen(viewModel = viewModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
app/src/main/java/org/nsh07/pomodoro/TomatoApplication.kt
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package org.nsh07.pomodoro
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import org.nsh07.pomodoro.data.AppContainer
|
||||||
|
import org.nsh07.pomodoro.data.DefaultAppContainer
|
||||||
|
|
||||||
|
class TomatoApplication : Application() {
|
||||||
|
lateinit var container: AppContainer
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
container = DefaultAppContainer(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
22
app/src/main/java/org/nsh07/pomodoro/data/AppContainer.kt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package org.nsh07.pomodoro.data
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
interface AppContainer {
|
||||||
|
val appPreferencesRepository: AppPreferenceRepository
|
||||||
|
val appTimerRepository: AppTimerRepository
|
||||||
|
}
|
||||||
|
|
||||||
|
class DefaultAppContainer(context: Context) : AppContainer {
|
||||||
|
|
||||||
|
override val appPreferencesRepository: AppPreferenceRepository by lazy {
|
||||||
|
AppPreferenceRepository(
|
||||||
|
AppDatabase.getDatabase(context).preferenceDao()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override val appTimerRepository: AppTimerRepository by lazy {
|
||||||
|
AppTimerRepository()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
29
app/src/main/java/org/nsh07/pomodoro/data/AppDatabase.kt
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package org.nsh07.pomodoro.data
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.room.Database
|
||||||
|
import androidx.room.Room
|
||||||
|
import androidx.room.RoomDatabase
|
||||||
|
|
||||||
|
@Database(
|
||||||
|
entities = [IntPreference::class],
|
||||||
|
version = 1
|
||||||
|
)
|
||||||
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
|
|
||||||
|
abstract fun preferenceDao(): PreferenceDao
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
@Volatile
|
||||||
|
private var Instance: AppDatabase? = null
|
||||||
|
|
||||||
|
fun getDatabase(context: Context): AppDatabase {
|
||||||
|
return Instance ?: synchronized(this) {
|
||||||
|
Room.databaseBuilder(context, AppDatabase::class.java, "app_database")
|
||||||
|
.build()
|
||||||
|
.also { Instance = it }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/src/main/java/org/nsh07/pomodoro/data/Preference.kt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package org.nsh07.pomodoro.data
|
||||||
|
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
|
@Entity(tableName = "int_preference")
|
||||||
|
data class IntPreference(
|
||||||
|
@PrimaryKey
|
||||||
|
val key: String,
|
||||||
|
val value: Int
|
||||||
|
)
|
||||||
18
app/src/main/java/org/nsh07/pomodoro/data/PreferenceDao.kt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package org.nsh07.pomodoro.data
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface PreferenceDao {
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
suspend fun insertIntPreference(preference: IntPreference)
|
||||||
|
|
||||||
|
@Query("DELETE FROM int_preference")
|
||||||
|
suspend fun resetIntPreferences()
|
||||||
|
|
||||||
|
@Query("SELECT value FROM int_preference WHERE `key` = :key")
|
||||||
|
suspend fun getIntPreference(key: String): Int?
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package org.nsh07.pomodoro.data
|
||||||
|
|
||||||
|
import kotlinx.coroutines.CoroutineDispatcher
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
interface PreferencesRepository {
|
||||||
|
suspend fun saveIntPreference(key: String, value: Int): Int
|
||||||
|
|
||||||
|
suspend fun getIntPreference(key: String): Int?
|
||||||
|
|
||||||
|
suspend fun resetSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
class AppPreferenceRepository(
|
||||||
|
private val preferenceDao: PreferenceDao,
|
||||||
|
private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
|
||||||
|
) : PreferencesRepository {
|
||||||
|
override suspend fun saveIntPreference(key: String, value: Int): Int =
|
||||||
|
withContext(ioDispatcher) {
|
||||||
|
preferenceDao.insertIntPreference(IntPreference(key, value))
|
||||||
|
value
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun getIntPreference(key: String): Int? = withContext(ioDispatcher) {
|
||||||
|
preferenceDao.getIntPreference(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun resetSettings() = withContext(ioDispatcher) {
|
||||||
|
preferenceDao.resetIntPreferences()
|
||||||
|
}
|
||||||
|
}
|
||||||
15
app/src/main/java/org/nsh07/pomodoro/data/TimerRepository.kt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package org.nsh07.pomodoro.data
|
||||||
|
|
||||||
|
interface TimerRepository {
|
||||||
|
var focusTime: Int
|
||||||
|
var shortBreakTime: Int
|
||||||
|
var longBreakTime: Int
|
||||||
|
var sessionLength: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
class AppTimerRepository : TimerRepository {
|
||||||
|
override var focusTime = 25 * 60 * 1000
|
||||||
|
override var shortBreakTime = 5 * 60 * 1000
|
||||||
|
override var longBreakTime = 15 * 60 * 1000
|
||||||
|
override var sessionLength = 4
|
||||||
|
}
|
||||||
@@ -1,16 +1,24 @@
|
|||||||
package org.nsh07.pomodoro.ui
|
package org.nsh07.pomodoro.ui
|
||||||
|
|
||||||
|
import androidx.compose.animation.ContentTransform
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
|
import androidx.compose.animation.fadeIn
|
||||||
|
import androidx.compose.animation.fadeOut
|
||||||
|
import androidx.compose.animation.scaleOut
|
||||||
import androidx.compose.foundation.layout.calculateEndPadding
|
import androidx.compose.foundation.layout.calculateEndPadding
|
||||||
import androidx.compose.foundation.layout.calculateStartPadding
|
import androidx.compose.foundation.layout.calculateStartPadding
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme.motionScheme
|
||||||
|
import androidx.compose.material3.NavigationItemIconPosition
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.ShortNavigationBar
|
import androidx.compose.material3.ShortNavigationBar
|
||||||
|
import androidx.compose.material3.ShortNavigationBarArrangement
|
||||||
import androidx.compose.material3.ShortNavigationBarItem
|
import androidx.compose.material3.ShortNavigationBarItem
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -19,6 +27,8 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.rememberUpdatedState
|
import androidx.compose.runtime.rememberUpdatedState
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||||
|
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
@@ -27,27 +37,33 @@ import androidx.navigation3.runtime.entry
|
|||||||
import androidx.navigation3.runtime.entryProvider
|
import androidx.navigation3.runtime.entryProvider
|
||||||
import androidx.navigation3.runtime.rememberNavBackStack
|
import androidx.navigation3.runtime.rememberNavBackStack
|
||||||
import androidx.navigation3.ui.NavDisplay
|
import androidx.navigation3.ui.NavDisplay
|
||||||
|
import androidx.window.core.layout.WindowSizeClass
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.nsh07.pomodoro.MainActivity.Companion.screens
|
import org.nsh07.pomodoro.MainActivity.Companion.screens
|
||||||
import org.nsh07.pomodoro.ui.settingsScreen.SettingsScreen
|
import org.nsh07.pomodoro.ui.settingsScreen.SettingsScreenRoot
|
||||||
import org.nsh07.pomodoro.ui.statsScreen.StatsScreen
|
import org.nsh07.pomodoro.ui.statsScreen.StatsScreen
|
||||||
import org.nsh07.pomodoro.ui.timerScreen.TimerScreen
|
import org.nsh07.pomodoro.ui.timerScreen.TimerScreen
|
||||||
import org.nsh07.pomodoro.ui.viewModel.UiViewModel
|
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerViewModel
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun AppScreen(
|
fun AppScreen(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
viewModel: UiViewModel = viewModel()
|
viewModel: TimerViewModel = viewModel(factory = TimerViewModel.Factory)
|
||||||
) {
|
) {
|
||||||
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
val uiState by viewModel.timerState.collectAsStateWithLifecycle()
|
||||||
val remainingTime by viewModel.time.collectAsStateWithLifecycle()
|
val remainingTime by viewModel.time.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
val progress by rememberUpdatedState((uiState.totalTime.toFloat() - remainingTime) / uiState.totalTime)
|
val progress by rememberUpdatedState((uiState.totalTime.toFloat() - remainingTime) / uiState.totalTime)
|
||||||
var showBrandTitle by remember { mutableStateOf(true) }
|
var showBrandTitle by remember { mutableStateOf(true) }
|
||||||
|
|
||||||
|
val layoutDirection = LocalLayoutDirection.current
|
||||||
|
val haptic = LocalHapticFeedback.current
|
||||||
|
val motionScheme = motionScheme
|
||||||
|
val windowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
delay(1500)
|
delay(1500)
|
||||||
@@ -55,13 +71,24 @@ fun AppScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val layoutDirection = LocalLayoutDirection.current
|
LaunchedEffect(uiState.timerMode) {
|
||||||
|
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||||
|
}
|
||||||
|
|
||||||
val backStack = rememberNavBackStack<Screen>(Screen.Timer)
|
val backStack = rememberNavBackStack<Screen>(Screen.Timer)
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
bottomBar = {
|
bottomBar = {
|
||||||
ShortNavigationBar {
|
val wide = remember {
|
||||||
|
windowSizeClass.isWidthAtLeastBreakpoint(
|
||||||
|
WindowSizeClass.WIDTH_DP_MEDIUM_LOWER_BOUND
|
||||||
|
)
|
||||||
|
}
|
||||||
|
ShortNavigationBar(
|
||||||
|
arrangement =
|
||||||
|
if (wide) ShortNavigationBarArrangement.Centered
|
||||||
|
else ShortNavigationBarArrangement.EqualWeight
|
||||||
|
) {
|
||||||
screens.forEach {
|
screens.forEach {
|
||||||
val selected = backStack.last() == it.route
|
val selected = backStack.last() == it.route
|
||||||
ShortNavigationBarItem(
|
ShortNavigationBarItem(
|
||||||
@@ -75,11 +102,14 @@ fun AppScreen(
|
|||||||
{ if (backStack.size > 1) backStack.removeAt(1) }
|
{ if (backStack.size > 1) backStack.removeAt(1) }
|
||||||
},
|
},
|
||||||
icon = {
|
icon = {
|
||||||
Crossfade (selected) { selected ->
|
Crossfade(selected) { selected ->
|
||||||
if (selected) Icon(painterResource(it.selectedIcon), null)
|
if (selected) Icon(painterResource(it.selectedIcon), null)
|
||||||
else Icon(painterResource(it.unselectedIcon), null)
|
else Icon(painterResource(it.unselectedIcon), null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
iconPosition =
|
||||||
|
if (wide) NavigationItemIconPosition.Start
|
||||||
|
else NavigationItemIconPosition.Top,
|
||||||
label = { Text(it.label) }
|
label = { Text(it.label) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -89,10 +119,29 @@ fun AppScreen(
|
|||||||
NavDisplay(
|
NavDisplay(
|
||||||
backStack = backStack,
|
backStack = backStack,
|
||||||
onBack = { backStack.removeLastOrNull() },
|
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 {
|
entryProvider = entryProvider {
|
||||||
entry<Screen.Timer> {
|
entry<Screen.Timer> {
|
||||||
TimerScreen(
|
TimerScreen(
|
||||||
uiState = uiState,
|
timerState = uiState,
|
||||||
showBrandTitle = showBrandTitle,
|
showBrandTitle = showBrandTitle,
|
||||||
progress = { progress },
|
progress = { progress },
|
||||||
resetTimer = viewModel::resetTimer,
|
resetTimer = viewModel::resetTimer,
|
||||||
@@ -107,7 +156,13 @@ fun AppScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
entry<Screen.Settings> {
|
entry<Screen.Settings> {
|
||||||
SettingsScreen()
|
SettingsScreenRoot(
|
||||||
|
modifier = modifier.padding(
|
||||||
|
start = contentPadding.calculateStartPadding(layoutDirection),
|
||||||
|
end = contentPadding.calculateEndPadding(layoutDirection),
|
||||||
|
bottom = contentPadding.calculateBottomPadding()
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
entry<Screen.Stats> {
|
entry<Screen.Stats> {
|
||||||
|
|||||||
@@ -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() }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +1,106 @@
|
|||||||
package org.nsh07.pomodoro.ui.settingsScreen
|
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.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
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.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
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.LocalTextStyle
|
||||||
|
import androidx.compose.material3.MaterialTheme.colorScheme
|
||||||
|
import androidx.compose.material3.MaterialTheme.shapes
|
||||||
import androidx.compose.material3.MaterialTheme.typography
|
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.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.material3.rememberSliderState
|
||||||
import androidx.compose.runtime.Composable
|
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.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
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.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.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)
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsScreen(modifier: Modifier = Modifier) {
|
private fun SettingsScreen(
|
||||||
Column(modifier) {
|
focusTimeInputFieldState: TextFieldState,
|
||||||
|
shortBreakTimeInputFieldState: TextFieldState,
|
||||||
|
longBreakTimeInputFieldState: TextFieldState,
|
||||||
|
sessionsSliderState: SliderState,
|
||||||
|
modifier: Modifier = Modifier
|
||||||
|
) {
|
||||||
|
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
|
||||||
|
|
||||||
|
Column(modifier.nestedScroll(scrollBehavior.nestedScrollConnection)) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
@@ -32,13 +113,159 @@ fun SettingsScreen(modifier: Modifier = Modifier) {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
subtitle = {},
|
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) {
|
LazyColumn(
|
||||||
LoadingIndicator()
|
verticalArrangement = Arrangement.spacedBy(2.dp),
|
||||||
Text("Coming Soon", style = typography.headlineSmall, fontFamily = robotoFlexTitle)
|
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)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nsh07.pomodoro.ui.statsScreen
|
package org.nsh07.pomodoro.ui.statsScreen
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
@@ -7,6 +8,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
|||||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||||
import androidx.compose.material3.LoadingIndicator
|
import androidx.compose.material3.LoadingIndicator
|
||||||
import androidx.compose.material3.LocalTextStyle
|
import androidx.compose.material3.LocalTextStyle
|
||||||
|
import androidx.compose.material3.MaterialTheme.colorScheme
|
||||||
import androidx.compose.material3.MaterialTheme.typography
|
import androidx.compose.material3.MaterialTheme.typography
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
@@ -34,7 +36,7 @@ fun StatsScreen(modifier: Modifier = Modifier) {
|
|||||||
subtitle = {},
|
subtitle = {},
|
||||||
titleHorizontalAlignment = Alignment.CenterHorizontally
|
titleHorizontalAlignment = Alignment.CenterHorizontally
|
||||||
)
|
)
|
||||||
Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {
|
Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize().background(colorScheme.surface)) {
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
LoadingIndicator()
|
LoadingIndicator()
|
||||||
Text("Coming Soon", style = typography.headlineSmall, fontFamily = robotoFlexTitle)
|
Text("Coming Soon", style = typography.headlineSmall, fontFamily = robotoFlexTitle)
|
||||||
|
|||||||
@@ -34,16 +34,13 @@ import androidx.compose.material3.MaterialTheme.typography
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.StrokeCap
|
import androidx.compose.ui.graphics.StrokeCap
|
||||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||||
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
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.openRundeClock
|
||||||
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTitle
|
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTitle
|
||||||
import org.nsh07.pomodoro.ui.theme.TomatoTheme
|
import org.nsh07.pomodoro.ui.theme.TomatoTheme
|
||||||
import org.nsh07.pomodoro.ui.viewModel.TimerMode
|
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerMode
|
||||||
import org.nsh07.pomodoro.ui.viewModel.UiState
|
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerState
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun TimerScreen(
|
fun TimerScreen(
|
||||||
uiState: UiState,
|
timerState: TimerState,
|
||||||
showBrandTitle: Boolean,
|
showBrandTitle: Boolean,
|
||||||
progress: () -> Float,
|
progress: () -> Float,
|
||||||
resetTimer: () -> Unit,
|
resetTimer: () -> Unit,
|
||||||
@@ -71,33 +68,28 @@ fun TimerScreen(
|
|||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val motionScheme = motionScheme
|
val motionScheme = motionScheme
|
||||||
val haptic = LocalHapticFeedback.current
|
|
||||||
|
|
||||||
val color by animateColorAsState(
|
val color by animateColorAsState(
|
||||||
if (uiState.timerMode == TimerMode.FOCUS) colorScheme.primary
|
if (timerState.timerMode == TimerMode.FOCUS) colorScheme.primary
|
||||||
else colorScheme.tertiary,
|
else colorScheme.tertiary,
|
||||||
animationSpec = motionScheme.slowEffectsSpec()
|
animationSpec = motionScheme.slowEffectsSpec()
|
||||||
)
|
)
|
||||||
val onColor by animateColorAsState(
|
val onColor by animateColorAsState(
|
||||||
if (uiState.timerMode == TimerMode.FOCUS) colorScheme.onPrimary
|
if (timerState.timerMode == TimerMode.FOCUS) colorScheme.onPrimary
|
||||||
else colorScheme.onTertiary,
|
else colorScheme.onTertiary,
|
||||||
animationSpec = motionScheme.slowEffectsSpec()
|
animationSpec = motionScheme.slowEffectsSpec()
|
||||||
)
|
)
|
||||||
val colorContainer by animateColorAsState(
|
val colorContainer by animateColorAsState(
|
||||||
if (uiState.timerMode == TimerMode.FOCUS) colorScheme.secondaryContainer
|
if (timerState.timerMode == TimerMode.FOCUS) colorScheme.secondaryContainer
|
||||||
else colorScheme.tertiaryContainer,
|
else colorScheme.tertiaryContainer,
|
||||||
animationSpec = motionScheme.slowEffectsSpec()
|
animationSpec = motionScheme.slowEffectsSpec()
|
||||||
)
|
)
|
||||||
|
|
||||||
LaunchedEffect(uiState.timerMode) {
|
|
||||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
|
||||||
}
|
|
||||||
|
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
if (!showBrandTitle) uiState.timerMode else TimerMode.BRAND,
|
if (!showBrandTitle) timerState.timerMode else TimerMode.BRAND,
|
||||||
transitionSpec = {
|
transitionSpec = {
|
||||||
slideInVertically(
|
slideInVertically(
|
||||||
animationSpec = motionScheme.slowSpatialSpec(),
|
animationSpec = motionScheme.slowSpatialSpec(),
|
||||||
@@ -174,7 +166,7 @@ fun TimerScreen(
|
|||||||
) {
|
) {
|
||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
Box(contentAlignment = Alignment.Center) {
|
Box(contentAlignment = Alignment.Center) {
|
||||||
if (uiState.timerMode == TimerMode.FOCUS) {
|
if (timerState.timerMode == TimerMode.FOCUS) {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
progress = progress,
|
progress = progress,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -212,7 +204,7 @@ fun TimerScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
text = uiState.timeStr,
|
text = timerState.timeStr,
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
fontFamily = openRundeClock,
|
fontFamily = openRundeClock,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
@@ -254,7 +246,7 @@ fun TimerScreen(
|
|||||||
{
|
{
|
||||||
FilledIconToggleButton(
|
FilledIconToggleButton(
|
||||||
onCheckedChange = { toggleTimer() },
|
onCheckedChange = { toggleTimer() },
|
||||||
checked = uiState.timerRunning,
|
checked = timerState.timerRunning,
|
||||||
colors = IconButtonDefaults.filledIconToggleButtonColors(
|
colors = IconButtonDefaults.filledIconToggleButtonColors(
|
||||||
checkedContainerColor = color,
|
checkedContainerColor = color,
|
||||||
checkedContentColor = onColor
|
checkedContentColor = onColor
|
||||||
@@ -265,7 +257,7 @@ fun TimerScreen(
|
|||||||
.size(width = 128.dp, height = 96.dp)
|
.size(width = 128.dp, height = 96.dp)
|
||||||
.animateWidth(interactionSources[0])
|
.animateWidth(interactionSources[0])
|
||||||
) {
|
) {
|
||||||
if (uiState.timerRunning) {
|
if (timerState.timerRunning) {
|
||||||
Icon(
|
Icon(
|
||||||
painterResource(R.drawable.pause_large),
|
painterResource(R.drawable.pause_large),
|
||||||
contentDescription = "Pause",
|
contentDescription = "Pause",
|
||||||
@@ -283,7 +275,7 @@ fun TimerScreen(
|
|||||||
{ state ->
|
{ state ->
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
if (uiState.timerRunning) {
|
if (timerState.timerRunning) {
|
||||||
Icon(
|
Icon(
|
||||||
painterResource(R.drawable.pause),
|
painterResource(R.drawable.pause),
|
||||||
contentDescription = "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 = {
|
onClick = {
|
||||||
toggleTimer()
|
toggleTimer()
|
||||||
state.dismiss()
|
state.dismiss()
|
||||||
@@ -385,17 +377,17 @@ fun TimerScreen(
|
|||||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
Text("Up next", style = typography.titleSmall)
|
Text("Up next", style = typography.titleSmall)
|
||||||
Text(
|
Text(
|
||||||
uiState.nextTimeStr,
|
timerState.nextTimeStr,
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
fontFamily = openRundeClock,
|
fontFamily = openRundeClock,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
fontSize = 22.sp,
|
fontSize = 22.sp,
|
||||||
lineHeight = 28.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(
|
Text(
|
||||||
when (uiState.nextTimerMode) {
|
when (timerState.nextTimerMode) {
|
||||||
TimerMode.FOCUS -> "Focus"
|
TimerMode.FOCUS -> "Focus"
|
||||||
TimerMode.SHORT_BREAK -> "Short Break"
|
TimerMode.SHORT_BREAK -> "Short Break"
|
||||||
else -> "Long Break"
|
else -> "Long Break"
|
||||||
@@ -413,12 +405,12 @@ fun TimerScreen(
|
|||||||
)
|
)
|
||||||
@Composable
|
@Composable
|
||||||
fun TimerScreenPreview() {
|
fun TimerScreenPreview() {
|
||||||
val uiState = UiState(
|
val timerState = TimerState(
|
||||||
timeStr = "03:34", nextTimeStr = "5:00", timerMode = TimerMode.FOCUS, timerRunning = true
|
timeStr = "03:34", nextTimeStr = "5:00", timerMode = TimerMode.FOCUS, timerRunning = true
|
||||||
)
|
)
|
||||||
TomatoTheme {
|
TomatoTheme {
|
||||||
TimerScreen(
|
TimerScreen(
|
||||||
uiState,
|
timerState,
|
||||||
false,
|
false,
|
||||||
{ 0.3f },
|
{ 0.3f },
|
||||||
{},
|
{},
|
||||||
|
|||||||
@@ -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 timerMode: TimerMode = TimerMode.FOCUS,
|
||||||
val timeStr: String = "25:00",
|
val timeStr: String = "25:00",
|
||||||
val totalTime: Int = 25 * 60,
|
val totalTime: Int = 25 * 60,
|
||||||
@@ -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> = _timerState.asStateFlow()
|
||||||
|
var timerJob: Job? = null
|
||||||
|
|
||||||
|
private val _time = MutableStateFlow(timerRepository.focusTime)
|
||||||
|
val time: StateFlow<Int> = _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
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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> = _uiState.asStateFlow()
|
|
||||||
var timerJob: Job? = null
|
|
||||||
|
|
||||||
private val _time = MutableStateFlow(focusTime)
|
|
||||||
val time: StateFlow<Int> = _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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
10
app/src/main/java/org/nsh07/pomodoro/utils/Utils.kt
Normal file
@@ -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)
|
||||||
|
}
|
||||||
13
app/src/main/res/drawable/clocks.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:autoMirrored="true"
|
||||||
|
android:tint="#000000"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M400,464v-144q0,-17 -11.5,-28.5T360,280q-17,0 -28.5,11.5T320,320v159q0,8 3,15.5t9,13.5l112,112q11,11 28,11t28,-11q11,-11 11,-28t-11,-28L400,464ZM880,480q0,-72 -33.5,-133.5T754,247q-14,-9 -19,-25t2,-31q8,-16 24,-21t30,4q78,49 123.5,130T960,480q0,95 -45.5,176T791,786q-14,9 -30,4t-24,-21q-7,-15 -2,-31t19,-25q59,-38 92.5,-99.5T880,480ZM360,840q-75,0 -140.5,-28.5t-114,-77q-48.5,-48.5 -77,-114T0,480q0,-75 28.5,-140.5t77,-114q48.5,-48.5 114,-77T360,120q75,0 140.5,28.5t114,77q48.5,48.5 77,114T720,480q0,75 -28.5,140.5t-77,114q-48.5,48.5 -114,77T360,840Z" />
|
||||||
|
|
||||||
|
</vector>
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
<path
|
|
||||||
android:fillColor="#3DDC84"
|
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M9,0L9,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,0L19,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,0L29,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,0L39,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,0L49,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,0L59,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,0L69,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,0L79,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M89,0L89,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M99,0L99,108"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,9L108,9"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,19L108,19"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,29L108,29"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,39L108,39"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,49L108,49"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,59L108,59"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,69L108,69"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,79L108,79"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,89L108,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,99L108,99"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,29L89,29"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,39L89,39"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,49L89,49"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,59L89,59"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,69L89,69"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,79L89,79"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,19L29,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,19L39,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,19L49,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,19L59,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,19L69,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,19L79,89"
|
|
||||||
android:strokeWidth="0.8"
|
|
||||||
android:strokeColor="#33FFFFFF" />
|
|
||||||
</vector>
|
|
||||||
@@ -4,27 +4,56 @@
|
|||||||
android:height="108dp"
|
android:height="108dp"
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
android:viewportHeight="108">
|
android:viewportHeight="108">
|
||||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
<group android:scaleX="0.87"
|
||||||
<aapt:attr name="android:fillColor">
|
android:scaleY="0.87"
|
||||||
<gradient
|
android:translateX="7.02"
|
||||||
android:endX="85.84757"
|
android:translateY="7.02">
|
||||||
android:endY="92.4963"
|
<path
|
||||||
android:startX="42.9492"
|
android:pathData="M81.01,59.18A27.01,24.67 0,0 1,54 83.85,27.01 24.67,0 0,1 26.99,59.18 27.01,24.67 0,0 1,54 34.51,27.01 24.67,0 0,1 81.01,59.18Z"
|
||||||
android:startY="49.59793"
|
android:strokeLineJoin="round"
|
||||||
android:type="linear">
|
android:strokeWidth="3.32220472"
|
||||||
<item
|
android:fillColor="#00000000"
|
||||||
android:color="#44000000"
|
android:strokeColor="#ffffff"/>
|
||||||
android:offset="0.0" />
|
<path
|
||||||
<item
|
android:pathData="M81.01,59.18A27.01,24.67 0,0 1,54 83.85,27.01 24.67,0 0,1 26.99,59.18 27.01,24.67 0,0 1,54 34.51,27.01 24.67,0 0,1 81.01,59.18Z"
|
||||||
android:color="#00000000"
|
android:strokeLineJoin="round"
|
||||||
android:offset="1.0" />
|
android:strokeWidth="3.32220472"
|
||||||
</gradient>
|
android:strokeColor="#00000000">
|
||||||
</aapt:attr>
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:startX="34.9"
|
||||||
|
android:startY="41.74"
|
||||||
|
android:endX="73.1"
|
||||||
|
android:endY="76.63"
|
||||||
|
android:type="linear">
|
||||||
|
<item android:offset="0" android:color="#FFEC2D01"/>
|
||||||
|
<item android:offset="1" android:color="#FFC82300"/>
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
</path>
|
</path>
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFF"
|
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:fillType="nonZero"
|
android:strokeLineJoin="round"
|
||||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
android:strokeWidth="3.32073"
|
||||||
android:strokeWidth="1"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#00000000" />
|
android:strokeColor="#ffffff"/>
|
||||||
</vector>
|
<path
|
||||||
|
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="#087830"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m32.04,51.14c-0.98,2.23 -1.54,4.59 -1.67,6.99 -0.03,0.58 -0.03,1.53 -0,2.11 0.02,0.33 0.04,0.66 0.08,0.99 0.06,0.58 0.61,1.04 1.19,1.04h1.55c0.58,0 0.96,-0.46 0.89,-1.04 -0.04,-0.33 -0.07,-0.66 -0.09,-0.99 -0.04,-0.58 -0.04,-1.53 0,-2.11 0.15,-2.44 0.84,-4.84 2.03,-7.03 0.28,-0.51 0.06,-0.91 -0.53,-0.91h-1.94c-0.58,0 -1.27,0.42 -1.5,0.95zM31.14,64.78c0.14,0.46 0.29,0.92 0.46,1.37 0.2,0.55 0.86,0.98 1.45,0.98h1.83c0.58,0 0.83,-0.42 0.59,-0.95 -0.21,-0.47 -0.4,-0.94 -0.57,-1.42 -0.19,-0.55 -0.79,-1 -1.37,-1l-1.6,0c-0.58,0 -0.95,0.46 -0.78,1.02z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ffffff"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m32.04,51.14c-0.98,2.23 -1.54,4.59 -1.67,6.99 -0.03,0.58 -0.03,1.53 -0,2.11 0.02,0.33 0.04,0.66 0.08,0.99 0.06,0.58 0.61,1.04 1.19,1.04h1.55c0.58,0 0.96,-0.46 0.89,-1.04 -0.04,-0.33 -0.07,-0.66 -0.09,-0.99 -0.04,-0.58 -0.04,-1.53 0,-2.11 0.15,-2.44 0.84,-4.84 2.03,-7.03 0.28,-0.51 0.06,-0.91 -0.53,-0.91h-1.94c-0.58,0 -1.27,0.42 -1.5,0.95zM31.14,64.78c0.14,0.46 0.29,0.92 0.46,1.37 0.2,0.55 0.86,0.98 1.45,0.98h1.83c0.58,0 0.83,-0.42 0.59,-0.95 -0.21,-0.47 -0.4,-0.94 -0.57,-1.42 -0.19,-0.55 -0.79,-1 -1.37,-1l-1.6,0c-0.58,0 -0.95,0.46 -0.78,1.02z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#ffffff"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
|
|||||||
36
app/src/main/res/drawable/ic_launcher_monochrome.xml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<group
|
||||||
|
android:scaleX="0.87"
|
||||||
|
android:scaleY="0.87"
|
||||||
|
android:translateX="7.02"
|
||||||
|
android:translateY="7.02">
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M51.21,37.43A1.66,1.66 0,0 1,51.09 37.54C51.16,37.53 51.25,37.53 51.32,37.52A1.66,1.66 0,0 1,51.21 37.43zM56.35,37.55A1.66,1.66 0,0 1,56.25 37.61C56.31,37.62 56.37,37.63 56.42,37.63A1.66,1.66 0,0 1,56.35 37.55zM37.44,39.69A27.01,24.67 0,0 0,26.99 59.18A27.01,24.67 0,0 0,54 83.85A27.01,24.67 0,0 0,81.01 59.18A27.01,24.67 0,0 0,70.87 39.92C69.07,41.04 67.28,41.45 65.63,41.94A1.66,1.66 0,0 1,64.62 41.86C66.29,43.66 67.07,45.42 67.07,45.42A1.66,1.66 0,0 1,65.54 47.66C63.01,47.71 60.5,47.43 58.2,46.38C56.5,45.6 55.05,44.21 53.77,42.51C50.49,45.91 46.47,47.69 42.12,48.04A1.66,1.66 0,0 1,40.43 45.81C40.43,45.81 41.27,43.55 43.37,41.4C43.44,41.33 43.55,41.26 43.62,41.19A1.66,1.66 0,0 1,43.38 41.29C41.09,41.26 39.14,40.65 37.44,39.69z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineJoin="round" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:pathData="M51.21,37.43A1.66,1.66 0,0 1,51.09 37.54C51.16,37.53 51.25,37.53 51.32,37.52A1.66,1.66 0,0 1,51.21 37.43zM56.35,37.55A1.66,1.66 0,0 1,56.25 37.61C56.31,37.62 56.37,37.63 56.42,37.63A1.66,1.66 0,0 1,56.35 37.55zM37.44,39.69A27.01,24.67 0,0 0,26.99 59.18A27.01,24.67 0,0 0,54 83.85A27.01,24.67 0,0 0,81.01 59.18A27.01,24.67 0,0 0,70.87 39.92C69.07,41.04 67.28,41.45 65.63,41.94A1.66,1.66 0,0 1,64.62 41.86C66.29,43.66 67.07,45.42 67.07,45.42A1.66,1.66 0,0 1,65.54 47.66C63.01,47.71 60.5,47.43 58.2,46.38C56.5,45.6 55.05,44.21 53.77,42.51C50.49,45.91 46.47,47.69 42.12,48.04A1.66,1.66 0,0 1,40.43 45.81C40.43,45.81 41.27,43.55 43.37,41.4C43.44,41.33 43.55,41.26 43.62,41.19A1.66,1.66 0,0 1,43.38 41.29C41.09,41.26 39.14,40.65 37.44,39.69z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:strokeLineJoin="round" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
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:strokeWidth="0"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:strokeLineJoin="round" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#000000"
|
||||||
|
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:strokeWidth="0"
|
||||||
|
android:strokeColor="#00000000"
|
||||||
|
android:strokeLineJoin="round" />
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
10
app/src/main/res/drawable/info.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="#000000"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M480,680q17,0 28.5,-11.5T520,640v-160q0,-17 -11.5,-28.5T480,440q-17,0 -28.5,11.5T440,480v160q0,17 11.5,28.5T480,680ZM480,360q17,0 28.5,-11.5T520,320q0,-17 -11.5,-28.5T480,280q-17,0 -28.5,11.5T440,320q0,17 11.5,28.5T480,360ZM480,880q-83,0 -156,-31.5T197,763q-54,-54 -85.5,-127T80,480q0,-83 31.5,-156T197,197q54,-54 127,-85.5T480,80q83,0 156,31.5T763,197q54,54 85.5,127T880,480q0,83 -31.5,156T763,763q-54,54 -127,85.5T480,880Z" />
|
||||||
|
</vector>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
<monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 982 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#FFFFFF</color>
|
||||||
|
</resources>
|
||||||
@@ -4,4 +4,5 @@ plugins {
|
|||||||
alias(libs.plugins.kotlin.android) apply false
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
alias(libs.plugins.kotlin.compose) apply false
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
alias(libs.plugins.kotlin.serialization) apply false
|
alias(libs.plugins.kotlin.serialization) apply false
|
||||||
|
alias(libs.plugins.ksp) apply false
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 328 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 301 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 314 KiB |
BIN
fastlane/metadata/android/en-US/images/phoneScreenshots/5.png
Normal file
|
After Width: | Height: | Size: 317 KiB |
BIN
fastlane/metadata/android/en-US/images/phoneScreenshots/6.png
Normal file
|
After Width: | Height: | Size: 314 KiB |
@@ -1,37 +1,45 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
activityCompose = "1.10.1"
|
||||||
|
adaptive = "1.1.0"
|
||||||
agp = "8.11.0"
|
agp = "8.11.0"
|
||||||
kotlin = "2.2.0"
|
composeBom = "2025.06.02"
|
||||||
coreKtx = "1.16.0"
|
coreKtx = "1.16.0"
|
||||||
|
espressoCore = "3.6.1"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
junitVersion = "1.2.1"
|
junitVersion = "1.2.1"
|
||||||
espressoCore = "3.6.1"
|
kotlin = "2.2.0"
|
||||||
|
ksp = "2.2.0-2.0.2"
|
||||||
lifecycleRuntimeKtx = "2.9.1"
|
lifecycleRuntimeKtx = "2.9.1"
|
||||||
activityCompose = "1.10.1"
|
|
||||||
composeBom = "2025.06.02"
|
|
||||||
navigation3Runtime = "1.0.0-alpha05"
|
navigation3Runtime = "1.0.0-alpha05"
|
||||||
|
room = "2.7.2"
|
||||||
|
|
||||||
[libraries]
|
[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-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 = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "lifecycleRuntimeKtx" }
|
||||||
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", 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-runtime = { module = "androidx.navigation3:navigation3-runtime", version.ref = "navigation3Runtime" }
|
||||||
androidx-navigation3-ui = { module = "androidx.navigation3:navigation3-ui", version.ref = "navigation3Runtime" }
|
androidx-navigation3-ui = { module = "androidx.navigation3:navigation3-ui", version.ref = "navigation3Runtime" }
|
||||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
|
||||||
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
|
||||||
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
|
||||||
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-ui = { group = "androidx.compose.ui", name = "ui" }
|
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
|
||||||
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
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 = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||||
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||||
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
|
||||||
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", 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"}
|
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin"}
|
||||||
|
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,7 @@
|
|||||||
#Sat Jun 28 10:20:36 IST 2025
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
298
gradlew
vendored
@@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with 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
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
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.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH="\\\"\\\""
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
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."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
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.
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# 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" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --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
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
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" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|||||||
183
gradlew.bat
vendored
@@ -1,89 +1,94 @@
|
|||||||
@rem
|
@rem
|
||||||
@rem Copyright 2015 the original author or authors.
|
@rem Copyright 2015 the original author or authors.
|
||||||
@rem
|
@rem
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
@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 not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@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 distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
@if "%DEBUG%" == "" @echo off
|
@rem
|
||||||
@rem ##########################################################################
|
|
||||||
@rem
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem Gradle startup script for Windows
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem ##########################################################################
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
set DIRNAME=%~dp0
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
set DIRNAME=%~dp0
|
||||||
set APP_HOME=%DIRNAME%
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
set APP_BASE_NAME=%~n0
|
||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
@rem Find java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
echo.
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo. 1>&2
|
||||||
echo location of your Java installation.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
goto fail
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
goto fail
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
if exist "%JAVA_EXE%" goto execute
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
if exist "%JAVA_EXE%" goto execute
|
||||||
echo.
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo. 1>&2
|
||||||
echo location of your Java installation.
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
goto fail
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
goto fail
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
@rem Execute Gradle
|
set CLASSPATH=
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
||||||
|
|
||||||
:end
|
@rem Execute Gradle
|
||||||
@rem End local scope for the variables with windows NT shell
|
"%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" %*
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
||||||
|
:end
|
||||||
:fail
|
@rem End local scope for the variables with windows NT shell
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
:fail
|
||||||
exit /b 1
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
:mainEnd
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
:omega
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
|
|||||||