Merge branch 'dev'

This commit is contained in:
Nishant Mishra
2025-12-04 13:33:36 +05:30
84 changed files with 3021 additions and 1443 deletions

View File

@@ -131,6 +131,7 @@ or [my BuyMeACoffee page](https://coff.ee/nsh07):
- Shun Min Chang ([@jack24254029](https://github.com/jack24254029) on GitHub)
- Chinedu Oji (on BuyMeACoffee)
- Zach Alden (on BuyMeACoffee)
## Special Thanks

View File

@@ -43,8 +43,8 @@ android {
applicationId = "org.nsh07.pomodoro"
minSdk = 27
targetSdk = 36
versionCode = 21
versionName = "1.6.6"
versionCode = 22
versionName = "1.7.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -17,18 +17,12 @@
package org.nsh07.pomodoro.ui.settingsScreen.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
@@ -38,56 +32,44 @@ import org.nsh07.pomodoro.R
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun TopButton(
buttonColors: ButtonColors,
modifier: Modifier = Modifier
) {
fun TopButton(modifier: Modifier = Modifier) {
val uriHandler = LocalUriHandler.current
Button(
colors = buttonColors,
onClick = { uriHandler.openUri("https://coff.ee/nsh07") },
shapes = ButtonDefaults.shapes(),
modifier = modifier
) {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
ClickableListItem(
leadingContent = {
Icon(
painterResource(R.drawable.bmc),
tint = colorScheme.primary,
contentDescription = null,
modifier = Modifier.height(24.dp)
modifier = Modifier.size(24.dp)
)
Text(text = stringResource(R.string.bmc))
}
}
},
headlineContent = { Text(stringResource(R.string.bmc)) },
supportingContent = { Text(stringResource(R.string.bmc_desc)) },
trailingContent = { Icon(painterResource(R.drawable.open_in_browser), null) },
items = 2,
index = 0,
modifier = modifier
) { uriHandler.openUri("https://coff.ee/nsh07") }
}
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun BottomButton(
buttonColors: ButtonColors,
modifier: Modifier = Modifier
) {
fun BottomButton(modifier: Modifier = Modifier) {
val uriHandler = LocalUriHandler.current
Button(
colors = buttonColors,
onClick = { uriHandler.openUri("https://hosted.weblate.org/engage/tomato/") },
shapes = ButtonDefaults.shapes(),
modifier = modifier
) {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
ClickableListItem(
leadingContent = {
Icon(
painterResource(R.drawable.weblate),
tint = colorScheme.secondary,
contentDescription = null,
modifier = Modifier.size(20.dp)
modifier = Modifier.size(24.dp)
)
Text(text = stringResource(R.string.help_with_translation))
}
}
},
headlineContent = { Text(stringResource(R.string.help_with_translation)) },
supportingContent = { Text(stringResource(R.string.help_with_translation_desc)) },
trailingContent = { Icon(painterResource(R.drawable.open_in_browser), null) },
items = 2,
index = 1,
modifier = modifier
) { uriHandler.openUri("https://hosted.weblate.org/engage/tomato/") }
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -69,14 +69,14 @@ class MainActivity : ComponentActivity() {
) {
val colorScheme = colorScheme
LaunchedEffect(colorScheme) {
appContainer.appTimerRepository.colorScheme = colorScheme
appContainer.stateRepository.colorScheme = colorScheme
}
AppScreen(
isPlus = isPlus,
isAODEnabled = settingsState.aodEnabled,
setTimerFrequency = {
appContainer.appTimerRepository.timerFrequency = it
appContainer.stateRepository.timerFrequency = it
}
)
}
@@ -86,13 +86,13 @@ class MainActivity : ComponentActivity() {
override fun onStop() {
super.onStop()
// Reduce the timer loop frequency when not visible to save battery power
appContainer.appTimerRepository.timerFrequency = 1f
// Reduce the timer loop frequency when not visible to save battery
appContainer.stateRepository.timerFrequency = 1f
}
override fun onStart() {
super.onStart()
// Increase the timer loop frequency again when visible to make the progress smoother
appContainer.appTimerRepository.timerFrequency = 60f
appContainer.stateRepository.timerFrequency = 60f
}
}

View File

@@ -31,19 +31,16 @@ import org.nsh07.pomodoro.billing.BillingManager
import org.nsh07.pomodoro.billing.BillingManagerProvider
import org.nsh07.pomodoro.service.ServiceHelper
import org.nsh07.pomodoro.service.addTimerActions
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerState
import org.nsh07.pomodoro.utils.millisecondsToStr
interface AppContainer {
val appPreferenceRepository: AppPreferenceRepository
val appStatRepository: AppStatRepository
val appTimerRepository: AppTimerRepository
val stateRepository: StateRepository
val billingManager: BillingManager
val notificationManager: NotificationManagerCompat
val notificationManagerService: NotificationManager
val notificationBuilder: NotificationCompat.Builder
val serviceHelper: ServiceHelper
val timerState: MutableStateFlow<TimerState>
val time: MutableStateFlow<Long>
var activityTurnScreenOn: (Boolean) -> Unit
}
@@ -58,7 +55,9 @@ class DefaultAppContainer(context: Context) : AppContainer {
AppStatRepository(AppDatabase.getDatabase(context).statDao())
}
override val appTimerRepository: AppTimerRepository by lazy { AppTimerRepository() }
override val stateRepository: StateRepository by lazy {
StateRepository()
}
override val billingManager: BillingManager by lazy { BillingManagerProvider.manager }
@@ -93,20 +92,9 @@ class DefaultAppContainer(context: Context) : AppContainer {
ServiceHelper(context)
}
override val timerState: MutableStateFlow<TimerState> by lazy {
MutableStateFlow(
TimerState(
totalTime = appTimerRepository.focusTime,
timeStr = millisecondsToStr(appTimerRepository.focusTime),
nextTimeStr = millisecondsToStr(appTimerRepository.shortBreakTime)
)
)
}
override val time: MutableStateFlow<Long> by lazy {
MutableStateFlow(appTimerRepository.focusTime)
MutableStateFlow(stateRepository.settingsState.value.focusTime)
}
override var activityTurnScreenOn: (Boolean) -> Unit = {}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.data
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.lightColorScheme
import kotlinx.coroutines.flow.MutableStateFlow
import org.nsh07.pomodoro.ui.settingsScreen.viewModel.SettingsState
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerState
class StateRepository {
val timerState = MutableStateFlow(TimerState())
val settingsState = MutableStateFlow(SettingsState())
var timerFrequency: Float = 60f
var colorScheme: ColorScheme = lightColorScheme()
}

View File

@@ -1,66 +0,0 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.data
import android.net.Uri
import android.provider.Settings
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.lightColorScheme
import kotlinx.coroutines.flow.MutableStateFlow
/**
* Interface that holds the timer durations for each timer type. This repository maintains a single
* source of truth for the timer durations for the various ViewModels in the app.
*/
interface TimerRepository {
var focusTime: Long
var shortBreakTime: Long
var longBreakTime: Long
var sessionLength: Int
var timerFrequency: Float
var alarmEnabled: Boolean
var vibrateEnabled: Boolean
var dndEnabled: Boolean
var colorScheme: ColorScheme
var alarmSoundUri: Uri?
var serviceRunning: MutableStateFlow<Boolean>
}
/**
* See [TimerRepository] for more details
*/
class AppTimerRepository : TimerRepository {
override var focusTime = 25 * 60 * 1000L
override var shortBreakTime = 5 * 60 * 1000L
override var longBreakTime = 15 * 60 * 1000L
override var sessionLength = 4
override var timerFrequency: Float = 60f
override var alarmEnabled = true
override var vibrateEnabled = true
override var dndEnabled: Boolean = false
override var colorScheme = lightColorScheme()
override var alarmSoundUri: Uri? =
Settings.System.DEFAULT_ALARM_ALERT_URI ?: Settings.System.DEFAULT_RINGTONE_URI
override var serviceRunning = MutableStateFlow(false)
}

View File

@@ -36,10 +36,11 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.TomatoApplication
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerMode
@@ -51,27 +52,30 @@ class TimerService : Service() {
(application as TomatoApplication).container
}
private val timerRepository by lazy { appContainer.appTimerRepository }
private val stateRepository by lazy { appContainer.stateRepository }
private val statRepository by lazy { appContainer.appStatRepository }
private val notificationManager by lazy { appContainer.notificationManager }
private val notificationManagerService by lazy { appContainer.notificationManagerService }
private val notificationBuilder by lazy { appContainer.notificationBuilder }
private val _timerState by lazy { appContainer.timerState }
private val _timerState by lazy { stateRepository.timerState }
private val _settingsState by lazy { stateRepository.settingsState }
private val _time by lazy { appContainer.time }
private val timeStateFlow by lazy { _time.asStateFlow() }
/**
* Remaining time
*/
private var time: Long
get() = timeStateFlow.value
get() = _time.value
set(value) = _time.update { value }
private val timerState by lazy { _timerState.asStateFlow() }
private var cycles = 0
private var startTime = 0L
private var pauseTime = 0L
private var pauseDuration = 0L
private var lastSavedDuration = 0L
private val saveLock = Mutex()
private var job = SupervisorJob()
private val timerScope = CoroutineScope(Dispatchers.IO + job)
private val skipScope = CoroutineScope(Dispatchers.IO + job)
@@ -88,7 +92,7 @@ class TimerService : Service() {
}
}
private val cs by lazy { timerRepository.colorScheme }
private val cs by lazy { stateRepository.colorScheme }
private lateinit var notificationStyle: NotificationCompat.ProgressStyle
@@ -98,15 +102,16 @@ class TimerService : Service() {
override fun onCreate() {
super.onCreate()
timerRepository.serviceRunning.update { true }
stateRepository.timerState.update { it.copy(serviceRunning = true) }
alarm = initializeMediaPlayer()
}
override fun onDestroy() {
timerRepository.serviceRunning.update { false }
stateRepository.timerState.update { it.copy(serviceRunning = false) }
runBlocking {
job.cancel()
saveTimeToDb()
lastSavedDuration = 0
setDoNotDisturb(false)
notificationManager.cancel(1)
alarm?.release()
@@ -122,7 +127,7 @@ class TimerService : Service() {
}
Actions.RESET.toString() -> {
if (timerState.value.timerRunning) toggleTimer()
if (_timerState.value.timerRunning) toggleTimer()
skipScope.launch {
resetTimer()
stopForegroundService()
@@ -141,7 +146,7 @@ class TimerService : Service() {
private fun toggleTimer() {
updateProgressSegments()
if (timerState.value.timerRunning) {
if (_timerState.value.timerRunning) {
setDoNotDisturb(false)
notificationBuilder.clearActions().addTimerActions(
this, R.drawable.play, getString(R.string.start)
@@ -152,7 +157,7 @@ class TimerService : Service() {
}
pauseTime = SystemClock.elapsedRealtime()
} else {
if (timerState.value.timerMode == TimerMode.FOCUS) setDoNotDisturb(true)
if (_timerState.value.timerMode == TimerMode.FOCUS) setDoNotDisturb(true)
else setDoNotDisturb(false)
notificationBuilder.clearActions().addTimerActions(
this, R.drawable.pause, getString(R.string.stop)
@@ -164,19 +169,20 @@ class TimerService : Service() {
timerScope.launch {
while (true) {
if (!timerState.value.timerRunning) break
if (!_timerState.value.timerRunning) break
if (startTime == 0L) startTime = SystemClock.elapsedRealtime()
time = when (timerState.value.timerMode) {
TimerMode.FOCUS -> timerRepository.focusTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration)
val settingsState = _settingsState.value
time = when (_timerState.value.timerMode) {
TimerMode.FOCUS -> settingsState.focusTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration)
TimerMode.SHORT_BREAK -> timerRepository.shortBreakTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration)
TimerMode.SHORT_BREAK -> settingsState.shortBreakTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration)
else -> timerRepository.longBreakTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration)
else -> settingsState.longBreakTime - (SystemClock.elapsedRealtime() - startTime - pauseDuration)
}
iterations =
(iterations + 1) % timerRepository.timerFrequency.toInt().coerceAtLeast(1)
(iterations + 1) % stateRepository.timerFrequency.toInt().coerceAtLeast(1)
if (iterations == 0) showTimerNotification(time.toInt())
@@ -192,9 +198,16 @@ class TimerService : Service() {
timeStr = millisecondsToStr(time)
)
}
val totalTime = _timerState.value.totalTime
if (totalTime - time < lastSavedDuration)
lastSavedDuration =
0 // Sanity check, prevents bugs if service is force closed
if (totalTime - time - lastSavedDuration > 60000)
saveTimeToDb()
}
delay((1000f / timerRepository.timerFrequency).toLong())
delay((1000f / stateRepository.timerFrequency).toLong())
}
}
}
@@ -207,21 +220,23 @@ class TimerService : Service() {
fun showTimerNotification(
remainingTime: Int, paused: Boolean = false, complete: Boolean = false
) {
val settingsState = _settingsState.value
if (complete) notificationBuilder.clearActions().addStopAlarmAction(this)
val totalTime = when (timerState.value.timerMode) {
TimerMode.FOCUS -> timerRepository.focusTime.toInt()
TimerMode.SHORT_BREAK -> timerRepository.shortBreakTime.toInt()
else -> timerRepository.longBreakTime.toInt()
val totalTime = when (_timerState.value.timerMode) {
TimerMode.FOCUS -> settingsState.focusTime.toInt()
TimerMode.SHORT_BREAK -> settingsState.shortBreakTime.toInt()
else -> settingsState.longBreakTime.toInt()
}
val currentTimer = when (timerState.value.timerMode) {
val currentTimer = when (_timerState.value.timerMode) {
TimerMode.FOCUS -> getString(R.string.focus)
TimerMode.SHORT_BREAK -> getString(R.string.short_break)
else -> getString(R.string.long_break)
}
val nextTimer = when (timerState.value.nextTimerMode) {
val nextTimer = when (_timerState.value.nextTimerMode) {
TimerMode.FOCUS -> getString(R.string.focus)
TimerMode.SHORT_BREAK -> getString(R.string.short_break)
else -> getString(R.string.long_break)
@@ -244,14 +259,14 @@ class TimerService : Service() {
getString(
R.string.up_next_notification,
nextTimer,
timerState.value.nextTimeStr
_timerState.value.nextTimeStr
)
)
.setStyle(
notificationStyle
.setProgress( // Set the current progress by filling the previous intervals and part of the current interval
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
(totalTime - remainingTime) + ((cycles + 1) / 2) * timerRepository.focusTime.toInt() + (cycles / 2) * timerRepository.shortBreakTime.toInt()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA && !settingsState.singleProgressBar) {
(totalTime - remainingTime) + ((cycles + 1) / 2) * settingsState.focusTime.toInt() + (cycles / 2) * settingsState.shortBreakTime.toInt()
} else (totalTime - remainingTime)
)
)
@@ -269,37 +284,38 @@ class TimerService : Service() {
}
private fun updateProgressSegments() {
val settingsState = _settingsState.value
notificationStyle = NotificationCompat.ProgressStyle()
.also {
// Add all the Focus, Short break and long break intervals in order
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA && !settingsState.singleProgressBar) {
// Android 16 and later supports live updates
// Set progress bar sections if on Baklava or later
for (i in 0..<timerRepository.sessionLength * 2) {
for (i in 0..<settingsState.sessionLength * 2) {
if (i % 2 == 0) it.addProgressSegment(
NotificationCompat.ProgressStyle.Segment(
timerRepository.focusTime.toInt()
settingsState.focusTime.toInt()
)
.setColor(cs.primary.toArgb())
)
else if (i != (timerRepository.sessionLength * 2 - 1)) it.addProgressSegment(
else if (i != (settingsState.sessionLength * 2 - 1)) it.addProgressSegment(
NotificationCompat.ProgressStyle.Segment(
timerRepository.shortBreakTime.toInt()
settingsState.shortBreakTime.toInt()
).setColor(cs.tertiary.toArgb())
)
else it.addProgressSegment(
NotificationCompat.ProgressStyle.Segment(
timerRepository.longBreakTime.toInt()
settingsState.longBreakTime.toInt()
).setColor(cs.tertiary.toArgb())
)
}
} else {
it.addProgressSegment(
NotificationCompat.ProgressStyle.Segment(
when (timerState.value.timerMode) {
TimerMode.FOCUS -> timerRepository.focusTime.toInt()
TimerMode.SHORT_BREAK -> timerRepository.shortBreakTime.toInt()
else -> timerRepository.longBreakTime.toInt()
when (_timerState.value.timerMode) {
TimerMode.FOCUS -> settingsState.focusTime.toInt()
TimerMode.SHORT_BREAK -> settingsState.shortBreakTime.toInt()
else -> settingsState.longBreakTime.toInt()
}
)
)
@@ -308,9 +324,11 @@ class TimerService : Service() {
}
private suspend fun resetTimer() {
updateProgressSegments()
val settingsState = _settingsState.value
saveTimeToDb()
time = timerRepository.focusTime
lastSavedDuration = 0
time = settingsState.focusTime
cycles = 0
startTime = 0L
pauseTime = 0L
@@ -321,47 +339,50 @@ class TimerService : Service() {
timerMode = TimerMode.FOCUS,
timeStr = millisecondsToStr(time),
totalTime = time,
nextTimerMode = if (timerRepository.sessionLength > 1) TimerMode.SHORT_BREAK else TimerMode.LONG_BREAK,
nextTimeStr = millisecondsToStr(if (timerRepository.sessionLength > 1) timerRepository.shortBreakTime else timerRepository.longBreakTime),
nextTimerMode = if (settingsState.sessionLength > 1) TimerMode.SHORT_BREAK else TimerMode.LONG_BREAK,
nextTimeStr = millisecondsToStr(if (settingsState.sessionLength > 1) settingsState.shortBreakTime else settingsState.longBreakTime),
currentFocusCount = 1,
totalFocusCount = timerRepository.sessionLength
totalFocusCount = settingsState.sessionLength
)
}
updateProgressSegments()
}
private suspend fun skipTimer(fromButton: Boolean = false) {
updateProgressSegments()
val settingsState = _settingsState.value
saveTimeToDb()
updateProgressSegments()
showTimerNotification(0, paused = true, complete = !fromButton)
lastSavedDuration = 0
startTime = 0L
pauseTime = 0L
pauseDuration = 0L
cycles = (cycles + 1) % (timerRepository.sessionLength * 2)
cycles = (cycles + 1) % (settingsState.sessionLength * 2)
if (cycles % 2 == 0) {
if (timerState.value.timerRunning) setDoNotDisturb(true)
time = timerRepository.focusTime
if (_timerState.value.timerRunning) setDoNotDisturb(true)
time = settingsState.focusTime
_timerState.update { currentState ->
currentState.copy(
timerMode = TimerMode.FOCUS,
timeStr = millisecondsToStr(time),
totalTime = time,
nextTimerMode = if (cycles == (timerRepository.sessionLength - 1) * 2) TimerMode.LONG_BREAK else TimerMode.SHORT_BREAK,
nextTimeStr = if (cycles == (timerRepository.sessionLength - 1) * 2) millisecondsToStr(
timerRepository.longBreakTime
nextTimerMode = if (cycles == (settingsState.sessionLength - 1) * 2) TimerMode.LONG_BREAK else TimerMode.SHORT_BREAK,
nextTimeStr = if (cycles == (settingsState.sessionLength - 1) * 2) millisecondsToStr(
settingsState.longBreakTime
) else millisecondsToStr(
timerRepository.shortBreakTime
settingsState.shortBreakTime
),
currentFocusCount = cycles / 2 + 1,
totalFocusCount = timerRepository.sessionLength
totalFocusCount = settingsState.sessionLength
)
}
} else {
if (timerState.value.timerRunning) setDoNotDisturb(false)
val long = cycles == (timerRepository.sessionLength * 2) - 1
time = if (long) timerRepository.longBreakTime else timerRepository.shortBreakTime
if (_timerState.value.timerRunning) setDoNotDisturb(false)
val long = cycles == (settingsState.sessionLength * 2) - 1
time = if (long) settingsState.longBreakTime else settingsState.shortBreakTime
_timerState.update { currentState ->
currentState.copy(
@@ -369,14 +390,17 @@ class TimerService : Service() {
timeStr = millisecondsToStr(time),
totalTime = time,
nextTimerMode = TimerMode.FOCUS,
nextTimeStr = millisecondsToStr(timerRepository.focusTime)
nextTimeStr = millisecondsToStr(settingsState.focusTime)
)
}
}
updateProgressSegments()
}
fun startAlarm() {
if (timerRepository.alarmEnabled) alarm?.start()
val settingsState = _settingsState.value
if (settingsState.alarmEnabled) alarm?.start()
appContainer.activityTurnScreenOn(true)
@@ -385,7 +409,7 @@ class TimerService : Service() {
stopAlarm()
}
if (timerRepository.vibrateEnabled) {
if (settingsState.vibrateEnabled) {
if (!vibrator.hasVibrator()) {
return
}
@@ -397,14 +421,15 @@ class TimerService : Service() {
}
fun stopAlarm() {
val settingsState = _settingsState.value
autoAlarmStopScope?.cancel()
if (timerRepository.alarmEnabled) {
if (settingsState.alarmEnabled) {
alarm?.pause()
alarm?.seekTo(0)
}
if (timerRepository.vibrateEnabled) {
if (settingsState.vibrateEnabled) {
vibrator.cancel()
}
@@ -418,24 +443,28 @@ class TimerService : Service() {
getString(R.string.start_next)
)
showTimerNotification(
when (timerState.value.timerMode) {
TimerMode.FOCUS -> timerRepository.focusTime.toInt()
TimerMode.SHORT_BREAK -> timerRepository.shortBreakTime.toInt()
else -> timerRepository.longBreakTime.toInt()
when (_timerState.value.timerMode) {
TimerMode.FOCUS -> settingsState.focusTime.toInt()
TimerMode.SHORT_BREAK -> settingsState.shortBreakTime.toInt()
else -> settingsState.longBreakTime.toInt()
}, paused = true, complete = false
)
}
private fun initializeMediaPlayer(): MediaPlayer? {
val settingsState = _settingsState.value
return try {
MediaPlayer().apply {
setAudioAttributes(
AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
.setUsage(AudioAttributes.USAGE_ALARM)
.setUsage(
if (settingsState.mediaVolumeForAlarm) AudioAttributes.USAGE_MEDIA
else AudioAttributes.USAGE_ALARM
)
.build()
)
timerRepository.alarmSoundUri?.let {
settingsState.alarmSoundUri?.let {
setDataSource(applicationContext, it)
prepare()
}
@@ -447,7 +476,7 @@ class TimerService : Service() {
}
private fun setDoNotDisturb(doNotDisturb: Boolean) {
if (timerRepository.dndEnabled && notificationManagerService.isNotificationPolicyAccessGranted()) {
if (_settingsState.value.dndEnabled && notificationManagerService.isNotificationPolicyAccessGranted()) {
if (doNotDisturb) {
notificationManagerService.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALARMS)
} else notificationManagerService.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL)
@@ -460,14 +489,18 @@ class TimerService : Service() {
}
suspend fun saveTimeToDb() {
when (timerState.value.timerMode) {
TimerMode.FOCUS -> statRepository.addFocusTime(
(timerState.value.totalTime - time).coerceAtLeast(
0L
saveLock.withLock {
val elapsedTime = _timerState.value.totalTime - time
when (_timerState.value.timerMode) {
TimerMode.FOCUS -> statRepository.addFocusTime(
(elapsedTime - lastSavedDuration).coerceAtLeast(0L)
)
)
else -> statRepository.addBreakTime((timerState.value.totalTime - time).coerceAtLeast(0L))
else -> statRepository.addBreakTime(
(elapsedTime - lastSavedDuration).coerceAtLeast(0L)
)
}
lastSavedDuration = elapsedTime
}
}

View File

@@ -23,7 +23,6 @@ import androidx.activity.compose.LocalActivity
import androidx.compose.animation.SharedTransitionLayout
import androidx.compose.animation.SharedTransitionScope
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateIntAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
@@ -64,7 +63,7 @@ import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.navigation3.ui.LocalNavAnimatedContentScope
import kotlinx.coroutines.delay
import org.nsh07.pomodoro.ui.theme.AppFonts.interClock
import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex600
import org.nsh07.pomodoro.ui.theme.TomatoTheme
import org.nsh07.pomodoro.ui.timerScreen.TimerScreen
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerMode
@@ -159,7 +158,7 @@ fun SharedTransitionScope.AlwaysOnDisplay(
animationSpec = motionScheme.slowEffectsSpec()
)
var randomX by remember {
var x by remember {
mutableIntStateOf(
Random.nextInt(
16.dp.toIntPx(density),
@@ -167,7 +166,7 @@ fun SharedTransitionScope.AlwaysOnDisplay(
)
)
}
var randomY by remember {
var y by remember {
mutableIntStateOf(
Random.nextInt(
16.dp.toIntPx(density),
@@ -176,22 +175,21 @@ fun SharedTransitionScope.AlwaysOnDisplay(
)
}
LaunchedEffect(timerState.timeStr[1]) { // Randomize position every minute
var xIncrement by remember { mutableIntStateOf(1) }
var yIncrement by remember { mutableIntStateOf(1) }
LaunchedEffect(timerState.timeStr) { // Randomize position every minute
if (sharedElementTransitionComplete) {
randomX = Random.nextInt(
16.dp.toIntPx(density),
windowInfo.containerSize.width - 266.dp.toIntPx(density)
)
randomY = Random.nextInt(
16.dp.toIntPx(density),
windowInfo.containerSize.height - 266.dp.toIntPx(density)
)
val elementSize = 266.dp.toIntPx(density)
if (windowInfo.containerSize.width - elementSize < x + xIncrement || x + xIncrement < 16)
xIncrement = -xIncrement
if (windowInfo.containerSize.height - elementSize < y + yIncrement || y + yIncrement < 16)
yIncrement = -yIncrement
x += xIncrement
y += yIncrement
}
}
val x by animateIntAsState(randomX, motionScheme.slowSpatialSpec())
val y by animateIntAsState(randomY, motionScheme.slowSpatialSpec())
Box(
modifier = modifier
.fillMaxSize()
@@ -248,7 +246,7 @@ fun SharedTransitionScope.AlwaysOnDisplay(
Text(
text = timerState.timeStr,
style = TextStyle(
fontFamily = interClock,
fontFamily = googleFlex600,
fontSize = 56.sp,
letterSpacing = (-2).sp,
fontFeatureSettings = "tnum"

View File

@@ -21,36 +21,64 @@ import android.content.Intent
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.Crossfade
import androidx.compose.animation.SharedTransitionLayout
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.expandHorizontally
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkHorizontally
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.foundation.layout.calculateStartPadding
import androidx.compose.foundation.layout.displayCutout
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.FloatingToolbarDefaults
import androidx.compose.material3.FloatingToolbarDefaults.ScreenOffset
import androidx.compose.material3.FloatingToolbarExitDirection
import androidx.compose.material3.HorizontalFloatingToolbar
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.motionScheme
import androidx.compose.material3.NavigationItemIconPosition
import androidx.compose.material3.PlainTooltip
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ShortNavigationBar
import androidx.compose.material3.ShortNavigationBarArrangement
import androidx.compose.material3.ShortNavigationBarItem
import androidx.compose.material3.Text
import androidx.compose.material3.ToggleButton
import androidx.compose.material3.ToggleButtonDefaults
import androidx.compose.material3.TooltipAnchorPosition
import androidx.compose.material3.TooltipBox
import androidx.compose.material3.TooltipDefaults
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
import androidx.compose.material3.rememberTooltipState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.util.fastForEach
import androidx.compose.ui.zIndex
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation3.runtime.entryProvider
@@ -63,6 +91,7 @@ import org.nsh07.pomodoro.ui.settingsScreen.SettingsScreenRoot
import org.nsh07.pomodoro.ui.statsScreen.StatsScreenRoot
import org.nsh07.pomodoro.ui.timerScreen.AlarmDialog
import org.nsh07.pomodoro.ui.timerScreen.TimerScreen
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerMode
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerViewModel
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@@ -82,8 +111,13 @@ fun AppScreen(
val layoutDirection = LocalLayoutDirection.current
val motionScheme = motionScheme
val windowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
val systemBarsInsets = WindowInsets.systemBars.asPaddingValues()
val cutoutInsets = WindowInsets.displayCutout.asPaddingValues()
val backStack = rememberNavBackStack(Screen.Timer)
val toolbarScrollBehavior = FloatingToolbarDefaults.exitAlwaysScrollBehavior(
FloatingToolbarExitDirection.Bottom
)
if (uiState.alarmRinging)
AlarmDialog {
@@ -99,46 +133,117 @@ fun AppScreen(
bottomBar = {
AnimatedVisibility(
backStack.last() !is Screen.AOD,
enter = fadeIn(),
exit = fadeOut()
enter = slideInVertically(motionScheme.slowSpatialSpec()) { it },
exit = slideOutVertically(motionScheme.slowSpatialSpec()) { it }
) {
val wide = remember {
windowSizeClass.isWidthAtLeastBreakpoint(
WindowSizeClass.WIDTH_DP_MEDIUM_LOWER_BOUND
)
}
ShortNavigationBar(
arrangement =
if (wide) ShortNavigationBarArrangement.Centered
else ShortNavigationBarArrangement.EqualWeight
val primary by animateColorAsState(
if (uiState.timerMode == TimerMode.FOCUS) colorScheme.primary else colorScheme.tertiary
)
val onPrimary by animateColorAsState(
if (uiState.timerMode == TimerMode.FOCUS) colorScheme.onPrimary else colorScheme.onTertiary
)
val primaryContainer by animateColorAsState(
if (uiState.timerMode == TimerMode.FOCUS) colorScheme.primaryContainer else colorScheme.tertiaryContainer
)
val onPrimaryContainer by animateColorAsState(
if (uiState.timerMode == TimerMode.FOCUS) colorScheme.onPrimaryContainer else colorScheme.onTertiaryContainer
)
Box(
Modifier
.fillMaxWidth()
.padding(
start = cutoutInsets.calculateStartPadding(layoutDirection),
end = cutoutInsets.calculateEndPadding(layoutDirection)
),
Alignment.Center
) {
mainScreens.forEach {
val selected = backStack.last() == it.route
ShortNavigationBarItem(
selected = selected,
onClick = if (it.route != Screen.Timer) { // Ensure the backstack does not accumulate screens
{
if (backStack.size < 2) backStack.add(it.route)
else backStack[1] = it.route
HorizontalFloatingToolbar(
expanded = true,
scrollBehavior = toolbarScrollBehavior,
colors = FloatingToolbarDefaults.vibrantFloatingToolbarColors(
toolbarContainerColor = primaryContainer,
toolbarContentColor = onPrimaryContainer
),
modifier = Modifier
.padding(
top = ScreenOffset,
bottom = systemBarsInsets.calculateBottomPadding()
+ ScreenOffset
)
.zIndex(1f)
) {
mainScreens.fastForEach { item ->
val selected by remember { derivedStateOf { backStack.lastOrNull() == item.route } }
TooltipBox(
positionProvider =
TooltipDefaults.rememberTooltipPositionProvider(
TooltipAnchorPosition.Above
),
tooltip = { PlainTooltip { Text(stringResource(item.label)) } },
state = rememberTooltipState(),
) {
ToggleButton(
checked = selected,
onCheckedChange = if (item.route != Screen.Timer) { // Ensure the backstack does not accumulate screens
{
if (backStack.size < 2) backStack.add(item.route)
else backStack[1] = item.route
}
} else {
{ if (backStack.size > 1) backStack.removeAt(1) }
},
colors = ToggleButtonDefaults.toggleButtonColors(
containerColor = primaryContainer,
contentColor = onPrimaryContainer,
checkedContainerColor = primary,
checkedContentColor = onPrimary
),
shapes = ToggleButtonDefaults.shapes(
CircleShape,
CircleShape,
CircleShape
),
modifier = Modifier.height(56.dp)
) {
Row {
Crossfade(selected) {
if (it) Icon(
painterResource(item.selectedIcon),
null
)
else Icon(painterResource(item.unselectedIcon), null)
}
AnimatedVisibility(
visible = selected || wide,
enter = expandHorizontally(motionScheme.defaultSpatialSpec()),
exit = shrinkHorizontally(motionScheme.defaultSpatialSpec())
) {
Text(
text = stringResource(item.label),
fontSize = 16.sp,
lineHeight = 24.sp,
maxLines = 1,
softWrap = false,
overflow = TextOverflow.Clip,
modifier = Modifier.padding(start = ButtonDefaults.IconSpacing)
)
}
}
}
} else {
{ if (backStack.size > 1) backStack.removeAt(1) }
},
icon = {
Crossfade(selected) { selected ->
if (selected) Icon(painterResource(it.selectedIcon), null)
else Icon(painterResource(it.unselectedIcon), null)
}
},
iconPosition =
if (wide) NavigationItemIconPosition.Start
else NavigationItemIconPosition.Top,
label = { Text(stringResource(it.label)) }
)
}
}
}
}
}
}
},
modifier = modifier
) { contentPadding ->
SharedTransitionLayout {
NavDisplay(
@@ -161,20 +266,12 @@ fun AppScreen(
TimerScreen(
timerState = uiState,
isPlus = isPlus,
contentPadding = contentPadding,
progress = { progress },
onAction = timerViewModel::onAction,
modifier = modifier
.padding(
start = contentPadding.calculateStartPadding(layoutDirection),
end = contentPadding.calculateEndPadding(layoutDirection),
bottom = contentPadding.calculateBottomPadding()
)
.then(
if (isAODEnabled) Modifier.clickable {
if (backStack.size < 2) backStack.add(Screen.AOD)
}
else Modifier
),
modifier = if (isAODEnabled) Modifier.clickable {
if (backStack.size < 2) backStack.add(Screen.AOD)
} else Modifier
)
}
@@ -183,36 +280,21 @@ fun AppScreen(
timerState = uiState,
progress = { progress },
setTimerFrequency = setTimerFrequency,
modifier = Modifier
.then(
if (isAODEnabled) Modifier.clickable {
if (backStack.size > 1) backStack.removeLastOrNull()
}
else Modifier
)
modifier = if (isAODEnabled) Modifier.clickable {
if (backStack.size > 1) backStack.removeLastOrNull()
} else Modifier
)
}
entry<Screen.Settings.Main> {
SettingsScreenRoot(
setShowPaywall = { showPaywall = it },
modifier = modifier.padding(
start = contentPadding.calculateStartPadding(layoutDirection),
end = contentPadding.calculateEndPadding(layoutDirection),
bottom = contentPadding.calculateBottomPadding()
)
contentPadding = contentPadding
)
}
entry<Screen.Stats> {
StatsScreenRoot(
contentPadding = contentPadding,
modifier = modifier.padding(
start = contentPadding.calculateStartPadding(layoutDirection),
end = contentPadding.calculateEndPadding(layoutDirection),
bottom = contentPadding.calculateBottomPadding()
)
)
StatsScreenRoot(contentPadding = contentPadding)
}
}
)

View File

@@ -45,18 +45,23 @@ val settingsScreens = listOf(
Screen.Settings.Timer,
R.drawable.timer_filled,
R.string.timer,
listOf(R.string.durations, R.string.session_length, R.string.always_on_display)
listOf(R.string.durations, R.string.dnd, R.string.always_on_display)
),
SettingsNavItem(
Screen.Settings.Alarm,
R.drawable.alarm,
R.string.alarm,
listOf(R.string.alarm_sound, R.string.alarm, R.string.vibrate)
listOf(
R.string.alarm_sound,
R.string.sound,
R.string.vibrate,
R.string.media_volume_for_alarm
)
),
SettingsNavItem(
Screen.Settings.Appearance,
R.drawable.palette,
R.string.appearance,
listOf(R.string.color_scheme, R.string.theme, R.string.black_theme)
listOf(R.string.theme, R.string.color_scheme, R.string.black_theme)
)
)

View File

@@ -34,6 +34,9 @@ sealed class Screen : NavKey {
@Serializable
object Main : Settings()
@Serializable
object About : Settings()
@Serializable
object Alarm : Settings()

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.ui
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.foundation.layout.calculateStartPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalLayoutDirection
@Composable
fun mergePaddingValues(
topSource: PaddingValues,
restSource: PaddingValues
): PaddingValues {
val layoutDirection = LocalLayoutDirection.current
return PaddingValues(
top = topSource.calculateTopPadding(),
bottom = restSource.calculateBottomPadding(),
start = restSource.calculateStartPadding(layoutDirection),
end = restSource.calculateEndPadding(layoutDirection)
)
}

View File

@@ -27,7 +27,7 @@ import androidx.compose.animation.slideOutHorizontally
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
@@ -39,6 +39,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.Icon
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SliderState
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
@@ -64,12 +65,14 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation3.runtime.entryProvider
import androidx.navigation3.ui.NavDisplay
import org.nsh07.pomodoro.BuildConfig
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.Screen
import org.nsh07.pomodoro.ui.settingsScreen.components.AboutCard
import org.nsh07.pomodoro.ui.mergePaddingValues
import org.nsh07.pomodoro.ui.settingsScreen.components.ClickableListItem
import org.nsh07.pomodoro.ui.settingsScreen.components.LocaleBottomSheet
import org.nsh07.pomodoro.ui.settingsScreen.components.PlusPromo
import org.nsh07.pomodoro.ui.settingsScreen.screens.AboutScreen
import org.nsh07.pomodoro.ui.settingsScreen.screens.AlarmSettings
import org.nsh07.pomodoro.ui.settingsScreen.screens.AppearanceSettings
import org.nsh07.pomodoro.ui.settingsScreen.screens.TimerSettings
@@ -86,6 +89,7 @@ import org.nsh07.pomodoro.ui.theme.CustomColors.topBarColors
@Composable
fun SettingsScreenRoot(
setShowPaywall: (Boolean) -> Unit,
contentPadding: PaddingValues,
modifier: Modifier = Modifier,
viewModel: SettingsViewModel = viewModel(factory = SettingsViewModel.Factory)
) {
@@ -119,6 +123,7 @@ fun SettingsScreenRoot(
serviceRunning = serviceRunning,
settingsState = settingsState,
backStack = backStack,
contentPadding = contentPadding,
focusTimeInputFieldState = focusTimeInputFieldState,
shortBreakTimeInputFieldState = shortBreakTimeInputFieldState,
longBreakTimeInputFieldState = longBreakTimeInputFieldState,
@@ -137,6 +142,7 @@ private fun SettingsScreen(
serviceRunning: Boolean,
settingsState: SettingsState,
backStack: SnapshotStateList<Screen.Settings>,
contentPadding: PaddingValues,
focusTimeInputFieldState: TextFieldState,
shortBreakTimeInputFieldState: TextFieldState,
longBreakTimeInputFieldState: TextFieldState,
@@ -181,47 +187,63 @@ private fun SettingsScreen(
},
entryProvider = entryProvider {
entry<Screen.Settings.Main> {
Column(modifier.nestedScroll(scrollBehavior.nestedScrollConnection)) {
TopAppBar(
title = {
Text(
stringResource(R.string.settings),
style = LocalTextStyle.current.copy(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp
Scaffold(
topBar = {
TopAppBar(
title = {
Text(
stringResource(R.string.settings),
style = LocalTextStyle.current.copy(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp
)
)
)
},
subtitle = {},
colors = topBarColors,
titleHorizontalAlignment = Alignment.CenterHorizontally,
scrollBehavior = scrollBehavior
)
},
subtitle = {},
colors = topBarColors,
titleHorizontalAlignment = Alignment.CenterHorizontally,
scrollBehavior = scrollBehavior
)
},
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
) { innerPadding ->
val insets = mergePaddingValues(innerPadding, contentPadding)
LazyColumn(
verticalArrangement = Arrangement.spacedBy(2.dp),
contentPadding = insets,
modifier = Modifier
.background(topBarColors.containerColor)
.fillMaxSize()
.padding(horizontal = 16.dp)
) {
item { Spacer(Modifier.height(12.dp)) }
item { Spacer(Modifier.height(14.dp)) }
if (!isPlus) item {
item {
PlusPromo(isPlus, setShowPaywall)
Spacer(Modifier.height(14.dp))
}
item { AboutCard(isPlus) }
item {
ClickableListItem(
leadingContent = {
Icon(painterResource(R.drawable.info), null)
},
headlineContent = {
Text(stringResource(R.string.about))
},
supportingContent = {
Text(stringResource(R.string.app_name) + " ${BuildConfig.VERSION_NAME}")
},
trailingContent = {
Icon(painterResource(R.drawable.arrow_forward_big), null)
},
items = 2,
index = 1
) { backStack.add(Screen.Settings.About) }
}
item { Spacer(Modifier.height(12.dp)) }
if (isPlus) item {
PlusPromo(isPlus, setShowPaywall)
Spacer(Modifier.height(14.dp))
}
itemsIndexed(settingsScreens) { index, item ->
ClickableListItem(
leadingContent = {
@@ -276,9 +298,18 @@ private fun SettingsScreen(
}
}
entry<Screen.Settings.About> {
AboutScreen(
contentPadding = contentPadding,
isPlus = isPlus,
onBack = backStack::removeLastOrNull
)
}
entry<Screen.Settings.Alarm> {
AlarmSettings(
settingsState = settingsState,
contentPadding = contentPadding,
onAction = onAction,
onBack = backStack::removeLastOrNull,
modifier = modifier,
@@ -287,6 +318,7 @@ private fun SettingsScreen(
entry<Screen.Settings.Appearance> {
AppearanceSettings(
settingsState = settingsState,
contentPadding = contentPadding,
isPlus = isPlus,
onAction = onAction,
setShowPaywall = setShowPaywall,
@@ -299,6 +331,7 @@ private fun SettingsScreen(
isPlus = isPlus,
serviceRunning = serviceRunning,
settingsState = settingsState,
contentPadding = contentPadding,
focusTimeInputFieldState = focusTimeInputFieldState,
shortBreakTimeInputFieldState = shortBreakTimeInputFieldState,
longBreakTimeInputFieldState = longBreakTimeInputFieldState,

View File

@@ -23,6 +23,7 @@ import androidx.annotation.StringRes
data class SettingsSwitchItem(
val checked: Boolean,
val enabled: Boolean = true,
val collapsible: Boolean = false,
@param:DrawableRes val icon: Int,
@param:StringRes val label: Int,
@param:StringRes val description: Int,

View File

@@ -1,129 +0,0 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.ui.settingsScreen.components
import android.widget.Toast
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.shapes
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import org.nsh07.pomodoro.BuildConfig
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTopBar
// Taken from https://github.com/shub39/Grit/blob/master/app/src/main/java/com/shub39/grit/core/presentation/settings/ui/component/AboutApp.kt
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun AboutCard(
isPlus: Boolean,
modifier: Modifier = Modifier
) {
val uriHandler = LocalUriHandler.current
val context = LocalContext.current
Card(
modifier = modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(
containerColor = colorScheme.primaryContainer,
contentColor = colorScheme.onPrimaryContainer
),
shape = shapes.extraLarge
) {
val buttonColors = ButtonDefaults.buttonColors(
containerColor = colorScheme.onPrimaryContainer,
contentColor = colorScheme.primaryContainer
)
Row(
modifier = Modifier
.padding(16.dp)
.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Column {
Text(
if (!isPlus) stringResource(R.string.app_name)
else stringResource(R.string.app_name_plus),
style = MaterialTheme.typography.titleLarge,
fontFamily = robotoFlexTopBar
)
Text(text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")
}
Spacer(modifier = Modifier.weight(1f))
Row {
IconButton(
onClick = {
Toast.makeText(context, "Coming soon...", Toast.LENGTH_SHORT).show()
},
shapes = IconButtonDefaults.shapes()
) {
Icon(
painterResource(R.drawable.discord),
contentDescription = "Discord",
modifier = Modifier.size(24.dp)
)
}
IconButton(
onClick = { uriHandler.openUri("https://github.com/nsh07/Tomato") },
shapes = IconButtonDefaults.shapes()
) {
Icon(
painterResource(R.drawable.github),
contentDescription = "GitHub",
modifier = Modifier.size(24.dp)
)
}
}
}
FlowRow(
modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
TopButton(buttonColors)
BottomButton(buttonColors)
}
}
}

View File

@@ -0,0 +1,531 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.ui.settingsScreen.components
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.ParagraphStyle
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withLink
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex400
import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex600
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun LicenseBottomSheet(
setShowSheet: (Boolean) -> Unit,
modifier: Modifier = Modifier
) {
val colorScheme = colorScheme
val typography = typography
val paragraphs = remember {
listOf(
buildAnnotatedString {
append("Copyright © 2007 Free Software Foundation, Inc. <")
withLink(LinkAnnotation.Url("https://fsf.org/")) {
append("https://fsf.org/")
}
append(
">\n\n" +
"Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed."
)
},
buildAnnotatedString {
withStyle(
SpanStyle(
fontSize = typography.titleLarge.fontSize,
fontFamily = googleFlex600
)
) {
append("Preamble")
}
},
buildAnnotatedString {
append(
"The GNU General Public License is a free, copyleft license for software and other kinds of works.\n" +
"\n" +
"The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.\n" +
"\n" +
"When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.\n" +
"\n" +
"To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.\n" +
"\n" +
"For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\n" +
"\n" +
"Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.\n" +
"\n" +
"For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.\n" +
"\n" +
"Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.\n" +
"\n" +
"Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.\n" +
"\n" +
"The precise terms and conditions for copying, distribution and modification follow."
)
},
buildAnnotatedString {
withStyle(
SpanStyle(
fontSize = typography.titleLarge.fontSize,
fontFamily = googleFlex600
)
) {
append("TERMS AND CONDITIONS")
}
},
buildAnnotatedString {
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("0. Definitions.\n\n")
}
append(
"“This License” refers to version 3 of the GNU General Public License.\n" +
"\n" +
"“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.\n" +
"\n" +
"“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.\n" +
"\n" +
"To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.\n" +
"\n" +
"A “covered work” means either the unmodified Program or a work based on the Program.\n" +
"\n" +
"To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.\n" +
"\n" +
"To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.\n" +
"\n" +
"An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("1. Source Code.\n\n")
}
append(
"The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.\n" +
"\n" +
"A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.\n" +
"\n" +
"The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.\n" +
"\n" +
"The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.\n" +
"\n" +
"The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.\n" +
"\n" +
"The Corresponding Source for a work in source code form is that same work.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("2. Basic Permissions.\n\n")
}
append(
"All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.\n" +
"\n" +
"You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.\n" +
"\n" +
"Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n")
}
append(
"No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.\n" +
"\n" +
"When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("4. Conveying Verbatim Copies.\n\n")
}
append(
"You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.\n" +
"\n" +
"You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("5. Conveying Modified Source Versions.\n\n")
}
append(
"You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:\n" +
"\n" +
"a) The work must carry prominent notices stating that you modified it, and giving a relevant date.\n" +
"b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.\n" +
"c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.\n" +
"d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.\n" +
"A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("6. Conveying Non-Source Forms.\n\n")
}
append(
"You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:\n" +
"\n" +
"a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.\n" +
"b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.\n" +
"c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.\n" +
"d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.\n" +
"e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.\n" +
"A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.\n" +
"\n" +
"A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.\n" +
"\n" +
"“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.\n" +
"\n" +
"If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).\n" +
"\n" +
"The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.\n" +
"\n" +
"Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("7. Additional Terms.\n\n")
}
append(
"“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.\n" +
"\n" +
"When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.\n" +
"\n" +
"Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:\n" +
"\n" +
"a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or\n" +
"b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or\n" +
"c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or\n" +
"d) Limiting the use for publicity purposes of names of licensors or authors of the material; or\n" +
"e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or\n" +
"f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.\n" +
"All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.\n" +
"\n" +
"If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.\n" +
"\n" +
"Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("8. Termination.\n\n")
}
append(
"You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).\n" +
"\n" +
"However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.\n" +
"\n" +
"Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.\n" +
"\n" +
"Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("9. Acceptance Not Required for Having Copies.\n\n")
}
append(
"You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("10. Automatic Licensing of Downstream Recipients.\n\n")
}
append(
"Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.\n" +
"\n" +
"An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.\n" +
"\n" +
"You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("11. Patents.\n\n")
}
append(
"A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.\n" +
"\n" +
"A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.\n" +
"\n" +
"Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.\n" +
"\n" +
"In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.\n" +
"\n" +
"If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.\n" +
"\n" +
"If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.\n" +
"\n" +
"A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.\n" +
"\n" +
"Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("12. No Surrender of Others' Freedom.\n\n")
}
append(
"If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("13. Use with the GNU Affero General Public License.\n\n")
}
append(
"Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("14. Revised Versions of this License.\n\n")
}
append(
"The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\n" +
"\n" +
"Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.\n" +
"\n" +
"If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.\n" +
"\n" +
"Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("15. Disclaimer of Warranty.\n\n")
}
append(
"THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("16. Limitation of Liability.\n\n")
}
append(
"IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("17. Interpretation of Sections 15 and 16.\n\n")
}
append(
"If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.\n" +
"\n"
)
withStyle(
SpanStyle(
fontSize = typography.titleMedium.fontSize,
fontFamily = googleFlex600
)
) {
append("END OF TERMS AND CONDITIONS")
}
},
buildAnnotatedString {
withStyle(style = ParagraphStyle(lineHeight = typography.titleLarge.lineHeight)) {
withStyle(
SpanStyle(
fontSize = typography.titleLarge.fontSize,
fontFamily = googleFlex600
)
) {
append("How to Apply These Terms to Your New Programs")
}
}
},
buildAnnotatedString {
append(
"If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.\n" +
"\n" +
"To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.\n" +
"\n"
)
withStyle(SpanStyle(fontFamily = FontFamily.Monospace)) {
append(
"<one line to give the program's name and a brief idea of what it does.>\nCopyright (C) <year> <name of author>\n" +
"\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n" +
"\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n" +
"\nYou should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.\n"
)
}
append(
"\nAlso add information on how to contact you by electronic and paper mail.\n" +
"\n" +
"If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:\n" +
"\n"
)
withStyle(SpanStyle(fontFamily = FontFamily.Monospace)) {
append(
"<program> Copyright (C) <year> <name of author>\n" +
"This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.\n"
)
}
append(
"\nThe hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.\n" +
"\n" +
"You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <"
)
withLink(LinkAnnotation.Url("https://www.gnu.org/licenses/")) {
append("https://www.gnu.org/licenses/")
}
append(
">.\n" +
"\n" +
"The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <"
)
withLink(LinkAnnotation.Url("https://www.gnu.org/licenses/why-not-lgpl.html")) {
append("https://www.gnu.org/licenses/why-not-lgpl.html")
}
append(
">."
)
}
)
}
ModalBottomSheet(
onDismissRequest = { setShowSheet(false) },
modifier = modifier
) {
LazyColumn(Modifier.padding(horizontal = 16.dp)) {
item {
Text(
"GNU GENERAL PUBLIC LICENSE",
style = typography.headlineSmall,
textAlign = TextAlign.Center,
modifier = Modifier
.padding(top = 16.dp, bottom = 4.dp)
.fillMaxWidth()
)
Text(
"Version 3, 29 June 2007",
style = typography.titleSmall,
fontFamily = googleFlex400,
color = colorScheme.onSurfaceVariant,
textAlign = TextAlign.Center,
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 16.dp)
)
}
items(paragraphs) {
Text(
it,
style = typography.bodyMedium,
modifier = Modifier.padding(vertical = 12.dp)
)
}
}
}
}

View File

@@ -125,9 +125,10 @@ fun LocaleBottomSheet(
colors =
if (currentLocales.isEmpty)
ListItemDefaults.colors(
containerColor = colorScheme.primaryContainer.copy(
0.3f
)
containerColor = colorScheme.secondaryContainer,
headlineColor = colorScheme.onSecondaryContainer,
leadingIconColor = colorScheme.onSecondaryContainer,
trailingIconColor = colorScheme.onSecondaryContainer
)
else listItemColors,
modifier = Modifier
@@ -169,7 +170,12 @@ fun LocaleBottomSheet(
},
colors =
if (!currentLocales.isEmpty && it.locale == currentLocales.get(0))
ListItemDefaults.colors(containerColor = colorScheme.primaryContainer)
ListItemDefaults.colors(
containerColor = colorScheme.secondaryContainer,
headlineColor = colorScheme.onSecondaryContainer,
leadingIconColor = colorScheme.onSecondaryContainer,
trailingIconColor = colorScheme.onSecondaryContainer
)
else listItemColors,
modifier = Modifier
.clip(

View File

@@ -39,7 +39,7 @@ 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.interClock
import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex600
import org.nsh07.pomodoro.ui.theme.CustomColors.listItemColors
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@@ -62,7 +62,7 @@ fun MinuteInputField(
imeAction = imeAction
),
textStyle = TextStyle(
fontFamily = interClock,
fontFamily = googleFlex600,
fontSize = 57.sp,
letterSpacing = (-2).sp,
color = if (enabled) colorScheme.onSurfaceVariant else colorScheme.outlineVariant,

View File

@@ -32,7 +32,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import org.nsh07.pomodoro.R
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
@@ -49,7 +51,7 @@ fun PlusDivider(
.background(colorScheme.surfaceContainer)
.padding(horizontal = 8.dp)
) {
Text("Customize further with Tomato+", style = typography.titleSmall)
Text(stringResource(R.string.tomato_plus_desc), style = typography.titleSmall)
}
}
}

View File

@@ -17,27 +17,18 @@
package org.nsh07.pomodoro.ui.settingsScreen.components
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItemDefaults
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTopBar
import org.nsh07.pomodoro.ui.theme.CustomColors.listItemColors
@Composable
fun PlusPromo(
@@ -45,38 +36,38 @@ fun PlusPromo(
setShowPaywall: (Boolean) -> Unit,
modifier: Modifier = Modifier
) {
val container = if (isPlus) colorScheme.surfaceBright else colorScheme.primary
val onContainer = if (isPlus) colorScheme.onSurface else colorScheme.onPrimary
val onContainerVariant = if (isPlus) colorScheme.onSurfaceVariant else colorScheme.onPrimary
Row(
verticalAlignment = Alignment.CenterVertically,
ClickableListItem(
leadingContent = {
Icon(
painterResource(R.drawable.tomato_logo_notification),
null,
modifier = Modifier.size(24.dp)
)
},
headlineContent = {
Text(
if (!isPlus) stringResource(R.string.get_plus)
else stringResource(R.string.app_name_plus)
)
},
supportingContent = {
if (!isPlus) Text(stringResource(R.string.tomato_plus_desc))
},
trailingContent = {
Icon(
painterResource(R.drawable.arrow_forward_big),
null
)
},
colors = if (isPlus) listItemColors else ListItemDefaults.colors(
containerColor = colorScheme.primary,
leadingIconColor = colorScheme.onPrimary,
trailingIconColor = colorScheme.onPrimary,
supportingColor = colorScheme.onPrimary,
headlineColor = colorScheme.onPrimary
),
items = 2,
index = 0,
modifier = modifier
.clip(CircleShape)
.clickable { setShowPaywall(true) }
.background(container)
.padding(16.dp)
) {
Icon(
painterResource(R.drawable.tomato_logo_notification),
null,
tint = onContainerVariant,
modifier = Modifier
.size(24.dp)
)
Spacer(Modifier.width(8.dp))
Text(
if (!isPlus) stringResource(R.string.get_plus)
else stringResource(R.string.app_name_plus),
style = typography.titleLarge,
fontFamily = robotoFlexTopBar,
color = onContainer
)
Spacer(Modifier.weight(1f))
Icon(
painterResource(R.drawable.arrow_forward_big),
null,
tint = onContainerVariant
)
}
) { setShowPaywall(true) }
}

View File

@@ -40,6 +40,7 @@ import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEachIndexed
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.theme.CustomColors.listItemColors
import org.nsh07.pomodoro.ui.theme.TomatoShapeDefaults.bottomListItemShape
@@ -101,7 +102,7 @@ fun ThemePickerListItem(
.background(listItemColors.containerColor)
.padding(start = 52.dp, end = 16.dp, bottom = 8.dp)
) {
options.forEachIndexed { index, theme ->
options.fastForEachIndexed { index, theme ->
val isSelected = selectedIndex == index
ToggleButton(
checked = isSelected,

View File

@@ -0,0 +1,291 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.ui.settingsScreen.screens
import androidx.annotation.DrawableRes
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.FilledTonalIconButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.LargeFlexibleTopAppBar
import androidx.compose.material3.MaterialShapes
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.toShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEach
import org.nsh07.pomodoro.BuildConfig
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.mergePaddingValues
import org.nsh07.pomodoro.ui.settingsScreen.components.BottomButton
import org.nsh07.pomodoro.ui.settingsScreen.components.ClickableListItem
import org.nsh07.pomodoro.ui.settingsScreen.components.LicenseBottomSheet
import org.nsh07.pomodoro.ui.settingsScreen.components.TopButton
import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex600
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTopBar
import org.nsh07.pomodoro.ui.theme.CustomColors.listItemColors
import org.nsh07.pomodoro.ui.theme.CustomColors.topBarColors
import org.nsh07.pomodoro.ui.theme.TomatoShapeDefaults.bottomListItemShape
import org.nsh07.pomodoro.ui.theme.TomatoShapeDefaults.topListItemShape
import org.nsh07.pomodoro.ui.theme.TomatoTheme
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun AboutScreen(
contentPadding: PaddingValues,
isPlus: Boolean,
onBack: () -> Unit,
modifier: Modifier = Modifier
) {
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
val uriHandler = LocalUriHandler.current
val socialLinks = remember {
listOf(
SocialLink(R.drawable.github, "https://github.com/nsh07"),
SocialLink(R.drawable.x, "https://x.com/nsh_zero7"),
SocialLink(R.drawable.globe, "https://nsh07.github.io"),
SocialLink(R.drawable.email, "mailto:nishant.28@outlook.com")
)
}
var showLicense by rememberSaveable { mutableStateOf(false) }
Scaffold(
topBar = {
LargeFlexibleTopAppBar(
title = {
Text(stringResource(R.string.about), fontFamily = robotoFlexTopBar)
},
subtitle = {
Text(stringResource(R.string.app_name))
},
navigationIcon = {
FilledTonalIconButton(
onClick = onBack,
shapes = IconButtonDefaults.shapes(),
colors = IconButtonDefaults.filledTonalIconButtonColors(containerColor = listItemColors.containerColor)
) {
Icon(
painterResource(R.drawable.arrow_back),
null
)
}
},
colors = topBarColors,
scrollBehavior = scrollBehavior
)
},
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
) { innerPadding ->
val insets = mergePaddingValues(innerPadding, contentPadding)
LazyColumn(
verticalArrangement = Arrangement.spacedBy(2.dp),
contentPadding = insets,
modifier = Modifier
.background(topBarColors.containerColor)
.fillMaxSize()
.padding(horizontal = 16.dp)
) {
item {
Box(Modifier.background(listItemColors.containerColor, topListItemShape)) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(16.dp)
) {
Icon(
painterResource(R.drawable.ic_launcher_monochrome),
tint = colorScheme.onPrimaryContainer,
contentDescription = null,
modifier = Modifier
.size(64.dp)
.background(
colorScheme.primaryContainer,
MaterialShapes.Cookie12Sided.toShape()
)
)
Spacer(Modifier.width(16.dp))
Column {
Text(
if (!isPlus) stringResource(R.string.app_name)
else stringResource(R.string.app_name_plus),
color = colorScheme.onSurface,
style = typography.titleLarge,
fontFamily = googleFlex600
)
Text(
text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})",
style = typography.labelLarge,
color = colorScheme.primary
)
}
Spacer(Modifier.weight(1f))
Row(horizontalArrangement = Arrangement.spacedBy(2.dp)) {
FilledTonalIconButton(
onClick = {
uriHandler.openUri("http://discord.com/users/658886962048008192")
},
shapes = IconButtonDefaults.shapes()
) {
Icon(
painterResource(R.drawable.discord),
contentDescription = "Discord",
modifier = Modifier.size(24.dp)
)
}
FilledTonalIconButton(
onClick = { uriHandler.openUri("https://github.com/nsh07/Tomato") },
shapes = IconButtonDefaults.shapes()
) {
Icon(
painterResource(R.drawable.github),
contentDescription = "GitHub",
modifier = Modifier.size(24.dp)
)
}
}
}
}
}
item {
Box(Modifier.background(listItemColors.containerColor, bottomListItemShape)) {
Column(modifier = Modifier.padding(16.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(
painterResource(R.drawable.pfp),
tint = colorScheme.onSecondaryContainer,
contentDescription = null,
modifier = Modifier
.size(64.dp)
.background(
colorScheme.secondaryContainer,
MaterialShapes.Square.toShape()
)
.padding(8.dp)
)
Spacer(Modifier.width(16.dp))
Column {
Text(
"Nishant Mishra",
style = typography.titleLarge,
color = colorScheme.onSurface,
fontFamily = googleFlex600
)
Text(
"Developer",
style = typography.labelLarge,
color = colorScheme.secondary
)
}
Spacer(Modifier.weight(1f))
}
Spacer(Modifier.height(8.dp))
Row {
Spacer(Modifier.width((64 + 16).dp))
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
socialLinks.fastForEach {
FilledTonalIconButton(
onClick = { uriHandler.openUri(it.url) },
shapes = IconButtonDefaults.shapes(),
modifier = Modifier.width(52.dp)
) {
Icon(
painterResource(it.icon),
null,
modifier = Modifier.size(ButtonDefaults.SmallIconSize)
)
}
}
}
}
}
}
}
item { Spacer(Modifier.height(12.dp)) }
item { TopButton() }
item { BottomButton() }
item { Spacer(Modifier.height(12.dp)) }
item {
ClickableListItem(
leadingContent = { Icon(painterResource(R.drawable.gavel), null) },
headlineContent = { Text(stringResource(R.string.license)) },
supportingContent = { Text("GNU General Public License Version 3") },
items = 1,
index = 0
) { showLicense = true }
}
}
}
if (showLicense) {
LicenseBottomSheet({ showLicense = false })
}
}
@Preview
@Composable
private fun AboutScreenPreview() {
TomatoTheme(dynamicColor = false) {
AboutScreen(
contentPadding = PaddingValues(),
isPlus = true,
onBack = {}
)
}
}
data class SocialLink(
@param:DrawableRes val icon: Int,
val url: String
)

View File

@@ -25,10 +25,11 @@ import android.net.Uri
import android.os.Build
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
@@ -43,6 +44,8 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.LargeFlexibleTopAppBar
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme.motionScheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text
@@ -59,12 +62,14 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.net.toUri
import androidx.compose.ui.util.fastForEach
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.mergePaddingValues
import org.nsh07.pomodoro.ui.settingsScreen.SettingsSwitchItem
import org.nsh07.pomodoro.ui.settingsScreen.viewModel.SettingsAction
import org.nsh07.pomodoro.ui.settingsScreen.viewModel.SettingsState
@@ -73,6 +78,7 @@ import org.nsh07.pomodoro.ui.theme.CustomColors.listItemColors
import org.nsh07.pomodoro.ui.theme.CustomColors.switchColors
import org.nsh07.pomodoro.ui.theme.CustomColors.topBarColors
import org.nsh07.pomodoro.ui.theme.TomatoShapeDefaults.bottomListItemShape
import org.nsh07.pomodoro.ui.theme.TomatoShapeDefaults.cardShape
import org.nsh07.pomodoro.ui.theme.TomatoShapeDefaults.middleListItemShape
import org.nsh07.pomodoro.ui.theme.TomatoShapeDefaults.topListItemShape
@@ -80,6 +86,7 @@ import org.nsh07.pomodoro.ui.theme.TomatoShapeDefaults.topListItemShape
@Composable
fun AlarmSettings(
settingsState: SettingsState,
contentPadding: PaddingValues,
onAction: (SettingsAction) -> Unit,
onBack: () -> Unit,
modifier: Modifier = Modifier
@@ -89,10 +96,10 @@ fun AlarmSettings(
var alarmName by remember { mutableStateOf("...") }
LaunchedEffect(settingsState.alarmSound) {
LaunchedEffect(settingsState.alarmSoundUri) {
withContext(Dispatchers.IO) {
alarmName =
RingtoneManager.getRingtone(context, settingsState.alarmSound.toUri())
RingtoneManager.getRingtone(context, settingsState.alarmSoundUri)
?.getTitle(context) ?: ""
}
}
@@ -116,64 +123,80 @@ fun AlarmSettings(
}
@SuppressLint("LocalContextGetResourceValueCall")
val ringtonePickerIntent = remember(settingsState.alarmSound) {
val ringtonePickerIntent = remember(settingsState.alarmSoundUri) {
Intent(RingtoneManager.ACTION_RINGTONE_PICKER).apply {
putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM)
putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, context.getString(R.string.alarm_sound))
putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, settingsState.alarmSound.toUri())
putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, settingsState.alarmSoundUri)
}
}
val switchItems = remember(
settingsState.blackTheme,
settingsState.aodEnabled,
settingsState.alarmEnabled,
settingsState.vibrateEnabled
settingsState.vibrateEnabled,
settingsState.mediaVolumeForAlarm
) {
listOf(
SettingsSwitchItem(
checked = settingsState.alarmEnabled,
icon = R.drawable.alarm_on,
label = R.string.sound,
description = R.string.alarm_desc,
onClick = { onAction(SettingsAction.SaveAlarmEnabled(it)) }
listOf(
SettingsSwitchItem(
checked = settingsState.alarmEnabled,
icon = R.drawable.alarm_on,
label = R.string.sound,
description = R.string.alarm_desc,
onClick = { onAction(SettingsAction.SaveAlarmEnabled(it)) }
),
SettingsSwitchItem(
checked = settingsState.vibrateEnabled,
icon = R.drawable.mobile_vibrate,
label = R.string.vibrate,
description = R.string.vibrate_desc,
onClick = { onAction(SettingsAction.SaveVibrateEnabled(it)) }
)
),
SettingsSwitchItem(
checked = settingsState.vibrateEnabled,
icon = R.drawable.mobile_vibrate,
label = R.string.vibrate,
description = R.string.vibrate_desc,
onClick = { onAction(SettingsAction.SaveVibrateEnabled(it)) }
listOf(
SettingsSwitchItem(
checked = settingsState.mediaVolumeForAlarm,
collapsible = true,
icon = R.drawable.music_note,
label = R.string.media_volume_for_alarm,
description = R.string.media_volume_for_alarm_desc,
onClick = { onAction(SettingsAction.SaveMediaVolumeForAlarm(it)) }
)
)
)
}
Column(modifier.nestedScroll(scrollBehavior.nestedScrollConnection)) {
LargeFlexibleTopAppBar(
title = {
Text(stringResource(R.string.alarm), fontFamily = robotoFlexTopBar)
},
subtitle = {
Text(stringResource(R.string.settings))
},
navigationIcon = {
FilledTonalIconButton(
onClick = onBack,
shapes = IconButtonDefaults.shapes(),
colors = IconButtonDefaults.filledTonalIconButtonColors(containerColor = listItemColors.containerColor)
) {
Icon(
painterResource(R.drawable.arrow_back),
null
)
}
},
colors = topBarColors,
scrollBehavior = scrollBehavior
)
Scaffold(
topBar = {
LargeFlexibleTopAppBar(
title = {
Text(stringResource(R.string.alarm), fontFamily = robotoFlexTopBar)
},
subtitle = {
Text(stringResource(R.string.settings))
},
navigationIcon = {
FilledTonalIconButton(
onClick = onBack,
shapes = IconButtonDefaults.shapes(),
colors = IconButtonDefaults.filledTonalIconButtonColors(containerColor = listItemColors.containerColor)
) {
Icon(
painterResource(R.drawable.arrow_back),
null
)
}
},
colors = topBarColors,
scrollBehavior = scrollBehavior
)
},
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
) { innerPadding ->
val insets = mergePaddingValues(innerPadding, contentPadding)
LazyColumn(
verticalArrangement = Arrangement.spacedBy(2.dp),
contentPadding = insets,
modifier = Modifier
.background(topBarColors.containerColor)
.fillMaxSize()
@@ -196,44 +219,65 @@ fun AlarmSettings(
.clickable(onClick = { ringtonePickerLauncher.launch(ringtonePickerIntent) })
)
}
itemsIndexed(switchItems) { index, item ->
ListItem(
leadingContent = {
Icon(painterResource(item.icon), contentDescription = null)
},
headlineContent = { Text(stringResource(item.label)) },
supportingContent = { Text(stringResource(item.description)) },
trailingContent = {
Switch(
checked = item.checked,
onCheckedChange = { item.onClick(it) },
thumbContent = {
if (item.checked) {
Icon(
painter = painterResource(R.drawable.check),
contentDescription = null,
modifier = Modifier.size(SwitchDefaults.IconSize),
)
} else {
Icon(
painter = painterResource(R.drawable.clear),
contentDescription = null,
modifier = Modifier.size(SwitchDefaults.IconSize),
)
}
},
colors = switchColors
)
},
colors = listItemColors,
modifier = Modifier
.clip(
when (index) {
switchItems.lastIndex -> bottomListItemShape
else -> middleListItemShape
switchItems.fastForEach { items ->
itemsIndexed(items) { index, item ->
ListItem(
leadingContent = {
Icon(painterResource(item.icon), contentDescription = null)
},
headlineContent = { Text(stringResource(item.label)) },
supportingContent = {
if (item.collapsible) {
var expanded by remember { mutableStateOf(false) }
Text(
stringResource(item.description),
maxLines = if (expanded) Int.MAX_VALUE else 2,
overflow = TextOverflow.Ellipsis,
modifier = Modifier
.clickable { expanded = !expanded }
.animateContentSize(motionScheme.defaultSpatialSpec())
)
} else {
Text(stringResource(item.description))
}
)
)
},
trailingContent = {
Switch(
checked = item.checked,
onCheckedChange = { item.onClick(it) },
thumbContent = {
if (item.checked) {
Icon(
painter = painterResource(R.drawable.check),
contentDescription = null,
modifier = Modifier.size(SwitchDefaults.IconSize),
)
} else {
Icon(
painter = painterResource(R.drawable.clear),
contentDescription = null,
modifier = Modifier.size(SwitchDefaults.IconSize),
)
}
},
colors = switchColors
)
},
colors = listItemColors,
modifier = Modifier
.clip(
when {
items.size == 1 -> cardShape
index == items.lastIndex -> bottomListItemShape
else -> middleListItemShape
}
)
)
}
item {
Spacer(Modifier.height(12.dp))
}
}
item { Spacer(Modifier.height(12.dp)) }
@@ -248,6 +292,7 @@ fun AlarmSettingsPreview() {
val settingsState = SettingsState()
AlarmSettings(
settingsState = settingsState,
contentPadding = PaddingValues(),
onAction = {},
onBack = {}
)

View File

@@ -19,7 +19,7 @@ package org.nsh07.pomodoro.ui.settingsScreen.screens
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
@@ -33,6 +33,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.LargeFlexibleTopAppBar
import androidx.compose.material3.ListItem
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Switch
import androidx.compose.material3.SwitchDefaults
import androidx.compose.material3.Text
@@ -46,6 +47,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.mergePaddingValues
import org.nsh07.pomodoro.ui.settingsScreen.SettingsSwitchItem
import org.nsh07.pomodoro.ui.settingsScreen.components.ColorSchemePickerListItem
import org.nsh07.pomodoro.ui.settingsScreen.components.PlusDivider
@@ -64,6 +66,7 @@ import org.nsh07.pomodoro.utils.toColor
@Composable
fun AppearanceSettings(
settingsState: SettingsState,
contentPadding: PaddingValues,
isPlus: Boolean,
onAction: (SettingsAction) -> Unit,
setShowPaywall: (Boolean) -> Unit,
@@ -72,32 +75,37 @@ fun AppearanceSettings(
) {
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
Column(modifier.nestedScroll(scrollBehavior.nestedScrollConnection)) {
LargeFlexibleTopAppBar(
title = {
Text(stringResource(R.string.appearance), fontFamily = robotoFlexTopBar)
},
subtitle = {
Text(stringResource(R.string.settings))
},
navigationIcon = {
FilledTonalIconButton(
onClick = onBack,
shapes = IconButtonDefaults.shapes(),
colors = IconButtonDefaults.filledTonalIconButtonColors(containerColor = listItemColors.containerColor)
) {
Icon(
painterResource(R.drawable.arrow_back),
null
)
}
},
colors = topBarColors,
scrollBehavior = scrollBehavior
)
Scaffold(
topBar = {
LargeFlexibleTopAppBar(
title = {
Text(stringResource(R.string.appearance), fontFamily = robotoFlexTopBar)
},
subtitle = {
Text(stringResource(R.string.settings))
},
navigationIcon = {
FilledTonalIconButton(
onClick = onBack,
shapes = IconButtonDefaults.shapes(),
colors = IconButtonDefaults.filledTonalIconButtonColors(containerColor = listItemColors.containerColor)
) {
Icon(
painterResource(R.drawable.arrow_back),
null
)
}
},
colors = topBarColors,
scrollBehavior = scrollBehavior
)
},
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
) { innerPadding ->
val insets = mergePaddingValues(innerPadding, contentPadding)
LazyColumn(
verticalArrangement = Arrangement.spacedBy(2.dp),
contentPadding = insets,
modifier = Modifier
.background(topBarColors.containerColor)
.fillMaxSize()
@@ -182,6 +190,7 @@ fun AppearanceSettingsPreview() {
TomatoTheme(dynamicColor = false) {
AppearanceSettings(
settingsState = settingsState,
contentPadding = PaddingValues(),
isPlus = false,
onAction = {},
setShowPaywall = {},

View File

@@ -20,6 +20,7 @@ package org.nsh07.pomodoro.ui.settingsScreen.screens
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.os.Build
import android.provider.Settings
import android.widget.Toast
import androidx.compose.animation.AnimatedVisibility
@@ -27,6 +28,7 @@ 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.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
@@ -53,6 +55,7 @@ import androidx.compose.material3.ListItem
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderState
import androidx.compose.material3.Switch
@@ -77,6 +80,7 @@ import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.mergePaddingValues
import org.nsh07.pomodoro.ui.settingsScreen.SettingsSwitchItem
import org.nsh07.pomodoro.ui.settingsScreen.components.MinuteInputField
import org.nsh07.pomodoro.ui.settingsScreen.components.PlusDivider
@@ -98,6 +102,7 @@ fun TimerSettings(
isPlus: Boolean,
serviceRunning: Boolean,
settingsState: SettingsState,
contentPadding: PaddingValues,
focusTimeInputFieldState: TextFieldState,
shortBreakTimeInputFieldState: TextFieldState,
longBreakTimeInputFieldState: TextFieldState,
@@ -113,60 +118,77 @@ fun TimerSettings(
val notificationManagerService =
remember { context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager }
val switchItems = listOf(
SettingsSwitchItem(
checked = settingsState.dndEnabled,
enabled = !serviceRunning,
icon = R.drawable.dnd,
label = R.string.dnd,
description = R.string.dnd_desc,
onClick = {
if (it && !notificationManagerService.isNotificationPolicyAccessGranted()) {
val intent = Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS)
Toast.makeText(context, "Enable permission for \"$appName\"", Toast.LENGTH_LONG)
.show()
context.startActivity(intent)
} else if (!it && notificationManagerService.isNotificationPolicyAccessGranted()) {
notificationManagerService.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL)
val switchItems = remember(
settingsState.dndEnabled,
settingsState.aodEnabled,
isPlus,
serviceRunning
) {
listOf(
SettingsSwitchItem(
checked = settingsState.dndEnabled,
enabled = !serviceRunning,
icon = R.drawable.dnd,
label = R.string.dnd,
description = R.string.dnd_desc,
onClick = {
if (it && !notificationManagerService.isNotificationPolicyAccessGranted()) {
val intent = Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS)
Toast.makeText(
context,
"Enable permission for \"$appName\"",
Toast.LENGTH_LONG
)
.show()
context.startActivity(intent)
} else if (!it && notificationManagerService.isNotificationPolicyAccessGranted()) {
notificationManagerService.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL)
}
onAction(SettingsAction.SaveDndEnabled(it))
}
onAction(SettingsAction.SaveDndEnabled(it))
}
),
SettingsSwitchItem(
checked = settingsState.aodEnabled,
icon = R.drawable.aod,
label = R.string.always_on_display,
description = R.string.always_on_display_desc,
onClick = { onAction(SettingsAction.SaveAodEnabled(it)) }
)
)
Column(modifier.nestedScroll(scrollBehavior.nestedScrollConnection)) {
LargeFlexibleTopAppBar(
title = {
Text(stringResource(R.string.timer), fontFamily = robotoFlexTopBar)
},
subtitle = {
Text(stringResource(R.string.settings))
},
navigationIcon = {
FilledTonalIconButton(
onClick = onBack,
shapes = IconButtonDefaults.shapes(),
colors = IconButtonDefaults.filledTonalIconButtonColors(containerColor = listItemColors.containerColor)
) {
Icon(
painterResource(R.drawable.arrow_back),
null
)
}
},
colors = topBarColors,
scrollBehavior = scrollBehavior
),
SettingsSwitchItem(
checked = settingsState.aodEnabled,
enabled = isPlus,
icon = R.drawable.aod,
label = R.string.always_on_display,
description = R.string.always_on_display_desc,
onClick = { onAction(SettingsAction.SaveAodEnabled(it)) }
)
)
}
Scaffold(
topBar = {
LargeFlexibleTopAppBar(
title = {
Text(stringResource(R.string.timer), fontFamily = robotoFlexTopBar)
},
subtitle = {
Text(stringResource(R.string.settings))
},
navigationIcon = {
FilledTonalIconButton(
onClick = onBack,
shapes = IconButtonDefaults.shapes(),
colors = IconButtonDefaults.filledTonalIconButtonColors(containerColor = listItemColors.containerColor)
) {
Icon(
painterResource(R.drawable.arrow_back),
null
)
}
},
colors = topBarColors,
scrollBehavior = scrollBehavior
)
},
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
) { innerPadding ->
val insets = mergePaddingValues(innerPadding, contentPadding)
LazyColumn(
verticalArrangement = Arrangement.spacedBy(2.dp),
contentPadding = insets,
modifier = Modifier
.background(topBarColors.containerColor)
.fillMaxSize()
@@ -259,31 +281,32 @@ fun TimerSettings(
Spacer(Modifier.height(12.dp))
}
item {
ListItem(
leadingContent = {
Icon(painterResource(R.drawable.clocks), null)
},
headlineContent = {
Text(stringResource(R.string.session_length))
},
supportingContent = {
Column {
Column(Modifier.background(listItemColors.containerColor, cardShape)) {
ListItem(
leadingContent = {
Icon(painterResource(R.drawable.clocks), null)
},
headlineContent = {
Text(stringResource(R.string.session_length))
},
supportingContent = {
Text(
stringResource(
R.string.session_length_desc,
sessionsSliderState.value.toInt()
)
)
Slider(
state = sessionsSliderState,
enabled = !serviceRunning,
modifier = Modifier.padding(vertical = 4.dp)
)
}
},
colors = listItemColors,
modifier = Modifier.clip(cardShape)
)
},
colors = listItemColors,
modifier = Modifier.clip(cardShape)
)
Slider(
state = sessionsSliderState,
enabled = !serviceRunning,
modifier = Modifier
.padding(start = (16 * 2 + 24).dp, end = 16.dp, bottom = 12.dp)
)
}
}
item { Spacer(Modifier.height(12.dp)) }
@@ -333,6 +356,44 @@ fun TimerSettings(
)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
item { Spacer(Modifier.height(12.dp)) }
item {
ListItem(
leadingContent = {
Icon(painterResource(R.drawable.view_day), null)
},
headlineContent = { Text(stringResource(R.string.session_only_progress)) },
supportingContent = { Text(stringResource(R.string.session_only_progress_desc)) },
trailingContent = {
Switch(
checked = settingsState.singleProgressBar,
enabled = !serviceRunning,
onCheckedChange = { onAction(SettingsAction.SaveSingleProgressBar(it)) },
thumbContent = {
if (settingsState.singleProgressBar) {
Icon(
painter = painterResource(R.drawable.check),
contentDescription = null,
modifier = Modifier.size(SwitchDefaults.IconSize),
)
} else {
Icon(
painter = painterResource(R.drawable.clear),
contentDescription = null,
modifier = Modifier.size(SwitchDefaults.IconSize),
)
}
},
colors = switchColors
)
},
colors = listItemColors,
modifier = Modifier.clip(cardShape)
)
}
}
if (!isPlus) {
item {
PlusDivider(setShowPaywall)
@@ -352,7 +413,7 @@ fun TimerSettings(
Switch(
checked = item.checked,
onCheckedChange = { item.onClick(it) },
enabled = isPlus,
enabled = item.enabled,
thumbContent = {
if (item.checked) {
Icon(
@@ -428,6 +489,7 @@ private fun TimerSettingsPreview() {
isPlus = false,
serviceRunning = true,
settingsState = remember { SettingsState() },
contentPadding = PaddingValues(),
focusTimeInputFieldState = focusTimeInputFieldState,
shortBreakTimeInputFieldState = shortBreakTimeInputFieldState,
longBreakTimeInputFieldState = longBreakTimeInputFieldState,

View File

@@ -26,6 +26,8 @@ sealed interface SettingsAction {
data class SaveBlackTheme(val enabled: Boolean) : SettingsAction
data class SaveAodEnabled(val enabled: Boolean) : SettingsAction
data class SaveDndEnabled(val enabled: Boolean) : SettingsAction
data class SaveMediaVolumeForAlarm(val enabled: Boolean) : SettingsAction
data class SaveSingleProgressBar(val enabled: Boolean) : SettingsAction
data class SaveAlarmSound(val uri: Uri?) : SettingsAction
data class SaveTheme(val theme: String) : SettingsAction
data class SaveColorScheme(val color: Color) : SettingsAction

View File

@@ -17,17 +17,29 @@
package org.nsh07.pomodoro.ui.settingsScreen.viewModel
import android.net.Uri
import android.provider.Settings
import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color
@Immutable
data class SettingsState(
val theme: String = "auto",
val alarmSound: String = "",
val colorScheme: String = Color.White.toString(),
val blackTheme: Boolean = false,
val aodEnabled: Boolean = false,
val alarmEnabled: Boolean = true,
val vibrateEnabled: Boolean = true,
val dndEnabled: Boolean = false
val dndEnabled: Boolean = false,
val mediaVolumeForAlarm: Boolean = false,
val singleProgressBar: Boolean = false,
val focusTime: Long = 25 * 60 * 1000L,
val shortBreakTime: Long = 5 * 60 * 1000L,
val longBreakTime: Long = 15 * 60 * 1000L,
val sessionLength: Int = 4,
val alarmSoundUri: Uri? =
Settings.System.DEFAULT_ALARM_ALERT_URI ?: Settings.System.DEFAULT_RINGTONE_URI
)

View File

@@ -25,6 +25,7 @@ import androidx.compose.material3.SliderState
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.graphics.Color
import androidx.core.net.toUri
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY
@@ -35,51 +36,57 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import org.nsh07.pomodoro.TomatoApplication
import org.nsh07.pomodoro.billing.BillingManager
import org.nsh07.pomodoro.data.AppPreferenceRepository
import org.nsh07.pomodoro.data.TimerRepository
import org.nsh07.pomodoro.data.PreferenceRepository
import org.nsh07.pomodoro.data.StateRepository
import org.nsh07.pomodoro.service.ServiceHelper
import org.nsh07.pomodoro.ui.Screen
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerAction
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerMode
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerState
import org.nsh07.pomodoro.utils.millisecondsToStr
@OptIn(FlowPreview::class, ExperimentalMaterial3Api::class)
class SettingsViewModel(
private val billingManager: BillingManager,
private val preferenceRepository: AppPreferenceRepository,
private val preferenceRepository: PreferenceRepository,
private val stateRepository: StateRepository,
private val serviceHelper: ServiceHelper,
private val time: MutableStateFlow<Long>,
private val timerRepository: TimerRepository,
private val timerState: MutableStateFlow<TimerState>
private val time: MutableStateFlow<Long>
) : ViewModel() {
val backStack = mutableStateListOf<Screen.Settings>(Screen.Settings.Main)
val isPlus = billingManager.isPlus
val serviceRunning = timerRepository.serviceRunning.asStateFlow()
val serviceRunning = stateRepository.timerState.map { it.serviceRunning }
.stateIn(
viewModelScope,
SharingStarted.WhileSubscribed(5000),
false
)
private val _settingsState = MutableStateFlow(SettingsState())
private val _settingsState = stateRepository.settingsState
val settingsState = _settingsState.asStateFlow()
val focusTimeTextFieldState by lazy {
TextFieldState((timerRepository.focusTime / 60000).toString())
TextFieldState((_settingsState.value.focusTime / 60000).toString())
}
val shortBreakTimeTextFieldState by lazy {
TextFieldState((timerRepository.shortBreakTime / 60000).toString())
TextFieldState((_settingsState.value.shortBreakTime / 60000).toString())
}
val longBreakTimeTextFieldState by lazy {
TextFieldState((timerRepository.longBreakTime / 60000).toString())
TextFieldState((_settingsState.value.longBreakTime / 60000).toString())
}
val sessionsSliderState by lazy {
SliderState(
value = timerRepository.sessionLength.toFloat(),
value = _settingsState.value.sessionLength.toFloat(),
steps = 4,
valueRange = 1f..6f,
onValueChangeFinished = ::updateSessionLength
@@ -102,6 +109,8 @@ class SettingsViewModel(
is SettingsAction.SaveAlarmEnabled -> saveAlarmEnabled(action.enabled)
is SettingsAction.SaveVibrateEnabled -> saveVibrateEnabled(action.enabled)
is SettingsAction.SaveDndEnabled -> saveDndEnabled(action.enabled)
is SettingsAction.SaveMediaVolumeForAlarm -> saveMediaVolumeForAlarm(action.enabled)
is SettingsAction.SaveSingleProgressBar -> saveSingleProgressBar(action.enabled)
is SettingsAction.SaveColorScheme -> saveColorScheme(action.color)
is SettingsAction.SaveTheme -> saveTheme(action.theme)
is SettingsAction.SaveBlackTheme -> saveBlackTheme(action.enabled)
@@ -110,11 +119,15 @@ class SettingsViewModel(
}
private fun updateSessionLength() {
viewModelScope.launch {
timerRepository.sessionLength = preferenceRepository.saveIntPreference(
"session_length",
sessionsSliderState.value.toInt()
)
viewModelScope.launch(Dispatchers.IO) {
_settingsState.update { currentState ->
currentState.copy(
sessionLength = preferenceRepository.saveIntPreference(
"session_length",
sessionsSliderState.value.toInt()
)
)
}
refreshTimer()
}
}
@@ -125,11 +138,13 @@ class SettingsViewModel(
.debounce(500)
.collect {
if (it.isNotEmpty()) {
timerRepository.focusTime = it.toString().toLong() * 60 * 1000
_settingsState.update { currentState ->
currentState.copy(focusTime = it.toString().toLong() * 60 * 1000)
}
refreshTimer()
preferenceRepository.saveIntPreference(
"focus_time",
timerRepository.focusTime.toInt()
_settingsState.value.focusTime.toInt()
)
}
}
@@ -139,11 +154,13 @@ class SettingsViewModel(
.debounce(500)
.collect {
if (it.isNotEmpty()) {
timerRepository.shortBreakTime = it.toString().toLong() * 60 * 1000
_settingsState.update { currentState ->
currentState.copy(shortBreakTime = it.toString().toLong() * 60 * 1000)
}
refreshTimer()
preferenceRepository.saveIntPreference(
"short_break_time",
timerRepository.shortBreakTime.toInt()
_settingsState.value.shortBreakTime.toInt()
)
}
}
@@ -153,11 +170,13 @@ class SettingsViewModel(
.debounce(500)
.collect {
if (it.isNotEmpty()) {
timerRepository.longBreakTime = it.toString().toLong() * 60 * 1000
_settingsState.update { currentState ->
currentState.copy(longBreakTime = it.toString().toLong() * 60 * 1000)
}
refreshTimer()
preferenceRepository.saveIntPreference(
"long_break_time",
timerRepository.longBreakTime.toInt()
_settingsState.value.longBreakTime.toInt()
)
}
}
@@ -173,7 +192,6 @@ class SettingsViewModel(
private fun saveAlarmEnabled(enabled: Boolean) {
viewModelScope.launch {
timerRepository.alarmEnabled = enabled
_settingsState.update { currentState ->
currentState.copy(alarmEnabled = enabled)
}
@@ -183,7 +201,6 @@ class SettingsViewModel(
private fun saveVibrateEnabled(enabled: Boolean) {
viewModelScope.launch {
timerRepository.vibrateEnabled = enabled
_settingsState.update { currentState ->
currentState.copy(vibrateEnabled = enabled)
}
@@ -193,7 +210,6 @@ class SettingsViewModel(
private fun saveDndEnabled(enabled: Boolean) {
viewModelScope.launch {
timerRepository.dndEnabled = enabled
_settingsState.update { currentState ->
currentState.copy(dndEnabled = enabled)
}
@@ -203,9 +219,8 @@ class SettingsViewModel(
private fun saveAlarmSound(uri: Uri?) {
viewModelScope.launch {
timerRepository.alarmSoundUri = uri
_settingsState.update { currentState ->
currentState.copy(alarmSound = uri.toString())
currentState.copy(alarmSoundUri = uri)
}
preferenceRepository.saveStringPreference("alarm_sound", uri.toString())
}
@@ -247,55 +262,150 @@ class SettingsViewModel(
}
}
suspend fun reloadSettings() {
val theme = preferenceRepository.getStringPreference("theme")
?: preferenceRepository.saveStringPreference("theme", "auto")
val colorScheme = preferenceRepository.getStringPreference("color_scheme")
?: preferenceRepository.saveStringPreference("color_scheme", Color.White.toString())
val blackTheme = preferenceRepository.getBooleanPreference("black_theme")
?: preferenceRepository.saveBooleanPreference("black_theme", false)
val aodEnabled = preferenceRepository.getBooleanPreference("aod_enabled")
?: preferenceRepository.saveBooleanPreference("aod_enabled", false)
val alarmSound = preferenceRepository.getStringPreference("alarm_sound")
?: preferenceRepository.saveStringPreference(
"alarm_sound",
(Settings.System.DEFAULT_ALARM_ALERT_URI
?: Settings.System.DEFAULT_RINGTONE_URI).toString()
private fun saveMediaVolumeForAlarm(mediaVolumeForAlarm: Boolean) {
viewModelScope.launch {
_settingsState.update { currentState ->
currentState.copy(mediaVolumeForAlarm = mediaVolumeForAlarm)
}
preferenceRepository.saveBooleanPreference(
"media_volume_for_alarm",
mediaVolumeForAlarm
)
}
}
private fun saveSingleProgressBar(singleProgressBar: Boolean) {
viewModelScope.launch {
_settingsState.update { currentState ->
currentState.copy(singleProgressBar = singleProgressBar)
}
preferenceRepository.saveBooleanPreference(
"single_progress_bar",
singleProgressBar
)
}
}
suspend fun reloadSettings() {
var settingsState = _settingsState.value
val focusTime =
preferenceRepository.getIntPreference("focus_time")?.toLong()
?: preferenceRepository.saveIntPreference(
"focus_time",
settingsState.focusTime.toInt()
).toLong()
val shortBreakTime =
preferenceRepository.getIntPreference("short_break_time")?.toLong()
?: preferenceRepository.saveIntPreference(
"short_break_time",
settingsState.shortBreakTime.toInt()
).toLong()
val longBreakTime =
preferenceRepository.getIntPreference("long_break_time")?.toLong()
?: preferenceRepository.saveIntPreference(
"long_break_time",
settingsState.longBreakTime.toInt()
).toLong()
val sessionLength =
preferenceRepository.getIntPreference("session_length")
?: preferenceRepository.saveIntPreference(
"session_length",
settingsState.sessionLength
)
val alarmSoundUri = (
preferenceRepository.getStringPreference("alarm_sound")
?: preferenceRepository.saveStringPreference(
"alarm_sound",
(Settings.System.DEFAULT_ALARM_ALERT_URI
?: Settings.System.DEFAULT_RINGTONE_URI).toString()
)
).toUri()
val theme = preferenceRepository.getStringPreference("theme")
?: preferenceRepository.saveStringPreference("theme", settingsState.theme)
val colorScheme = preferenceRepository.getStringPreference("color_scheme")
?: preferenceRepository.saveStringPreference("color_scheme", settingsState.colorScheme)
val blackTheme = preferenceRepository.getBooleanPreference("black_theme")
?: preferenceRepository.saveBooleanPreference("black_theme", settingsState.blackTheme)
val aodEnabled = preferenceRepository.getBooleanPreference("aod_enabled")
?: preferenceRepository.saveBooleanPreference("aod_enabled", settingsState.aodEnabled)
val alarmEnabled = preferenceRepository.getBooleanPreference("alarm_enabled")
?: preferenceRepository.saveBooleanPreference("alarm_enabled", true)
?: preferenceRepository.saveBooleanPreference(
"alarm_enabled",
settingsState.alarmEnabled
)
val vibrateEnabled = preferenceRepository.getBooleanPreference("vibrate_enabled")
?: preferenceRepository.saveBooleanPreference("vibrate_enabled", true)
?: preferenceRepository.saveBooleanPreference(
"vibrate_enabled",
settingsState.vibrateEnabled
)
val dndEnabled = preferenceRepository.getBooleanPreference("dnd_enabled")
?: preferenceRepository.saveBooleanPreference("dnd_enabled", false)
?: preferenceRepository.saveBooleanPreference("dnd_enabled", settingsState.dndEnabled)
val mediaVolumeForAlarm =
preferenceRepository.getBooleanPreference("media_volume_for_alarm")
?: preferenceRepository.saveBooleanPreference(
"media_volume_for_alarm",
settingsState.mediaVolumeForAlarm
)
val singleProgressBar = preferenceRepository.getBooleanPreference("single_progress_bar")
?: preferenceRepository.saveBooleanPreference(
"single_progress_bar",
settingsState.singleProgressBar
)
_settingsState.update { currentState ->
currentState.copy(
focusTime = focusTime,
shortBreakTime = shortBreakTime,
longBreakTime = longBreakTime,
sessionLength = sessionLength,
theme = theme,
colorScheme = colorScheme,
alarmSound = alarmSound,
alarmSoundUri = alarmSoundUri,
blackTheme = blackTheme,
aodEnabled = aodEnabled,
alarmEnabled = alarmEnabled,
vibrateEnabled = vibrateEnabled,
dndEnabled = dndEnabled
dndEnabled = dndEnabled,
mediaVolumeForAlarm = mediaVolumeForAlarm,
singleProgressBar = singleProgressBar
)
}
settingsState = _settingsState.value
if (!stateRepository.timerState.value.serviceRunning) {
time.update { settingsState.focusTime }
stateRepository.timerState.update { currentState ->
currentState.copy(
timerMode = TimerMode.FOCUS,
timeStr = millisecondsToStr(time.value),
totalTime = time.value,
nextTimerMode = if (settingsState.sessionLength > 1) TimerMode.SHORT_BREAK else TimerMode.LONG_BREAK,
nextTimeStr = millisecondsToStr(if (settingsState.sessionLength > 1) settingsState.shortBreakTime else settingsState.longBreakTime),
currentFocusCount = 1,
totalFocusCount = settingsState.sessionLength
)
}
}
}
private fun refreshTimer() {
if (!serviceRunning.value) {
time.update { timerRepository.focusTime }
val settingsState = _settingsState.value
timerState.update { currentState ->
time.update { settingsState.focusTime }
stateRepository.timerState.update { currentState ->
currentState.copy(
timerMode = TimerMode.FOCUS,
timeStr = millisecondsToStr(time.value),
totalTime = time.value,
nextTimerMode = if (timerRepository.sessionLength > 1) TimerMode.SHORT_BREAK else TimerMode.LONG_BREAK,
nextTimeStr = millisecondsToStr(if (timerRepository.sessionLength > 1) timerRepository.shortBreakTime else timerRepository.longBreakTime),
nextTimerMode = if (settingsState.sessionLength > 1) TimerMode.SHORT_BREAK else TimerMode.LONG_BREAK,
nextTimeStr = millisecondsToStr(if (settingsState.sessionLength > 1) settingsState.shortBreakTime else settingsState.longBreakTime),
currentFocusCount = 1,
totalFocusCount = timerRepository.sessionLength
totalFocusCount = settingsState.sessionLength
)
}
}
@@ -307,18 +417,16 @@ class SettingsViewModel(
val application = (this[APPLICATION_KEY] as TomatoApplication)
val appBillingManager = application.container.billingManager
val appPreferenceRepository = application.container.appPreferenceRepository
val appTimerRepository = application.container.appTimerRepository
val serviceHelper = application.container.serviceHelper
val stateRepository = application.container.stateRepository
val time = application.container.time
val timerState = application.container.timerState
SettingsViewModel(
billingManager = appBillingManager,
preferenceRepository = appPreferenceRepository,
serviceHelper = serviceHelper,
time = time,
timerRepository = appTimerRepository,
timerState = timerState
stateRepository = stateRepository,
time = time
)
}
}

View File

@@ -32,7 +32,6 @@ import androidx.compose.ui.unit.dp
import com.patrykandpatrick.vico.core.cartesian.data.CartesianChartModelProducer
import com.patrykandpatrick.vico.core.cartesian.data.CartesianValueFormatter
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.utils.millisecondsToHoursMinutes
@Composable
fun ColumnScope.ProductivityGraph(
@@ -53,6 +52,9 @@ fun ColumnScope.ProductivityGraph(
Spacer(Modifier.height(8.dp))
TimeColumnChart(
modelProducer,
hoursFormat = stringResource(R.string.hours_format),
hoursMinutesFormat = stringResource(R.string.hours_and_minutes_format),
minutesFormat = stringResource(R.string.minutes_format),
axisTypeface = axisTypeface,
markerTypeface = markerTypeface,
xValueFormatter = CartesianValueFormatter { _, value, _ ->
@@ -63,9 +65,6 @@ fun ColumnScope.ProductivityGraph(
3.0 -> "18 - 24"
else -> ""
}
},
yValueFormatter = CartesianValueFormatter { _, value, _ ->
millisecondsToHoursMinutes(value.toLong())
}
)
}

View File

@@ -45,6 +45,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.motionScheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
@@ -76,6 +77,7 @@ import com.patrykandpatrick.vico.core.common.data.ExtraStore
import org.nsh07.pomodoro.BuildConfig
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.data.Stat
import org.nsh07.pomodoro.ui.mergePaddingValues
import org.nsh07.pomodoro.ui.statsScreen.viewModel.StatsViewModel
import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex400
import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex600
@@ -130,6 +132,10 @@ fun StatsScreen(
) {
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
val hoursFormat = stringResource(R.string.hours_format)
val hoursMinutesFormat = stringResource(R.string.hours_and_minutes_format)
val minutesFormat = stringResource(R.string.minutes_format)
var lastWeekStatExpanded by rememberSaveable { mutableStateOf(false) }
var lastMonthStatExpanded by rememberSaveable { mutableStateOf(false) }
@@ -156,43 +162,45 @@ fun StatsScreen(
val axisTypeface = remember { resolver.resolve(googleFlex400).value as Typeface }
val markerTypeface = remember { resolver.resolve(googleFlex600).value as Typeface }
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
) {
TopAppBar(
title = {
Text(
stringResource(R.string.stats),
style = LocalTextStyle.current.copy(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp
),
modifier = Modifier
.padding(top = contentPadding.calculateTopPadding())
.padding(vertical = 14.dp)
)
},
actions = if (BuildConfig.DEBUG) {
{
IconButton(
onClick = generateSampleData
) {
Spacer(Modifier.size(24.dp))
Scaffold(
topBar = {
TopAppBar(
title = {
Text(
stringResource(R.string.stats),
style = LocalTextStyle.current.copy(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp
),
modifier = Modifier
.padding(top = contentPadding.calculateTopPadding())
.padding(vertical = 14.dp)
)
},
actions = if (BuildConfig.DEBUG) {
{
IconButton(
onClick = generateSampleData
) {
Spacer(Modifier.size(24.dp))
}
}
}
} else {
{}
},
subtitle = {},
titleHorizontalAlignment = Alignment.CenterHorizontally,
scrollBehavior = scrollBehavior,
windowInsets = WindowInsets()
)
} else {
{}
},
subtitle = {},
titleHorizontalAlignment = Alignment.CenterHorizontally,
scrollBehavior = scrollBehavior,
windowInsets = WindowInsets()
)
},
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection)
) { innerPadding ->
val insets = mergePaddingValues(innerPadding, contentPadding)
LazyColumn(
horizontalAlignment = Alignment.CenterHorizontally,
contentPadding = insets,
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
item { Spacer(Modifier) }
@@ -223,7 +231,10 @@ fun StatsScreen(
)
Text(
remember(todayStat) {
millisecondsToHoursMinutes(todayStat?.totalFocusTime() ?: 0)
millisecondsToHoursMinutes(
todayStat?.totalFocusTime() ?: 0,
hoursMinutesFormat
)
},
style = typography.displaySmall,
color = colorScheme.onPrimaryContainer,
@@ -249,7 +260,10 @@ fun StatsScreen(
)
Text(
remember(todayStat) {
millisecondsToHoursMinutes(todayStat?.breakTime ?: 0)
millisecondsToHoursMinutes(
todayStat?.breakTime ?: 0,
hoursMinutesFormat
)
},
style = typography.displaySmall,
color = colorScheme.onTertiaryContainer,
@@ -282,7 +296,8 @@ fun StatsScreen(
millisecondsToHoursMinutes(
remember(lastWeekAverageFocusTimes) {
lastWeekAverageFocusTimes.sum().toLong()
}
},
hoursMinutesFormat
),
style = typography.displaySmall
)
@@ -295,7 +310,10 @@ fun StatsScreen(
}
item {
TimeColumnChart(
lastWeekSummaryChartData.first,
modelProducer = lastWeekSummaryChartData.first,
hoursFormat = hoursFormat,
hoursMinutesFormat = hoursMinutesFormat,
minutesFormat = minutesFormat,
modifier = Modifier.padding(start = 16.dp),
axisTypeface = axisTypeface,
markerTypeface = markerTypeface,
@@ -361,7 +379,8 @@ fun StatsScreen(
millisecondsToHoursMinutes(
remember(lastMonthAverageFocusTimes) {
lastMonthAverageFocusTimes.sum().toLong()
}
},
hoursMinutesFormat
),
style = typography.displaySmall
)
@@ -374,7 +393,10 @@ fun StatsScreen(
}
item {
TimeColumnChart(
lastMonthSummaryChartData.first,
modelProducer = lastMonthSummaryChartData.first,
hoursFormat = hoursFormat,
hoursMinutesFormat = hoursMinutesFormat,
minutesFormat = minutesFormat,
modifier = Modifier.padding(start = 16.dp),
axisTypeface = axisTypeface,
markerTypeface = markerTypeface,
@@ -441,7 +463,8 @@ fun StatsScreen(
millisecondsToHoursMinutes(
remember(lastYearAverageFocusTimes) {
lastYearAverageFocusTimes.sum().toLong()
}
},
hoursMinutesFormat
),
style = typography.displaySmall
)
@@ -454,7 +477,10 @@ fun StatsScreen(
}
item {
TimeLineChart(
lastYearSummaryChartData.first,
modelProducer = lastYearSummaryChartData.first,
hoursFormat = hoursFormat,
hoursMinutesFormat = hoursMinutesFormat,
minutesFormat = minutesFormat,
modifier = Modifier.padding(start = 16.dp),
axisTypeface = axisTypeface,
markerTypeface = markerTypeface,

View File

@@ -22,6 +22,7 @@ import androidx.compose.animation.core.AnimationSpec
import androidx.compose.foundation.layout.height
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.motionScheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
@@ -68,6 +69,9 @@ import org.nsh07.pomodoro.utils.millisecondsToMinutes
@Composable
fun TimeColumnChart(
modelProducer: CartesianChartModelProducer,
hoursFormat: String,
hoursMinutesFormat: String,
minutesFormat: String,
modifier: Modifier = Modifier,
axisTypeface: Typeface = Typeface.DEFAULT,
markerTypeface: Typeface = Typeface.DEFAULT,
@@ -76,9 +80,9 @@ fun TimeColumnChart(
xValueFormatter: CartesianValueFormatter = CartesianValueFormatter.Default,
yValueFormatter: CartesianValueFormatter = CartesianValueFormatter { _, value, _ ->
if (value >= 60 * 60 * 1000) {
millisecondsToHours(value.toLong())
millisecondsToHours(value.toLong(), hoursFormat)
} else {
millisecondsToMinutes(value.toLong())
millisecondsToMinutes(value.toLong(), minutesFormat)
}
},
markerValueFormatter: DefaultCartesianMarker.ValueFormatter = DefaultCartesianMarker.ValueFormatter { _, targets ->
@@ -88,12 +92,12 @@ fun TimeColumnChart(
} else 0L
if (value >= 60 * 60 * 1000) {
millisecondsToHoursMinutes(value)
millisecondsToHoursMinutes(value, hoursMinutesFormat)
} else {
millisecondsToMinutes(value)
millisecondsToMinutes(value, minutesFormat)
}
},
animationSpec: AnimationSpec<Float>? = null
animationSpec: AnimationSpec<Float>? = motionScheme.defaultEffectsSpec()
) {
ProvideVicoTheme(rememberM3VicoTheme()) {
CartesianChartHost(
@@ -157,6 +161,7 @@ fun TimeColumnChart(
minZoom = Zoom.min(Zoom.Content, Zoom.fixed())
),
animationSpec = animationSpec,
animateIn = false,
modifier = modifier.height(226.dp),
)
}
@@ -179,7 +184,13 @@ private fun TimeColumnChartPreview() {
}
TomatoTheme {
Surface {
TimeColumnChart(thickness = 8.dp, modelProducer = modelProducer)
TimeColumnChart(
thickness = 8.dp,
modelProducer = modelProducer,
hoursFormat = "%dh",
hoursMinutesFormat = "%dh %dm",
minutesFormat = "%dm"
)
}
}
}

View File

@@ -22,6 +22,7 @@ import androidx.compose.animation.core.AnimationSpec
import androidx.compose.foundation.layout.height
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.motionScheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
@@ -74,6 +75,9 @@ import org.nsh07.pomodoro.utils.millisecondsToMinutes
@Composable
fun TimeLineChart(
modelProducer: CartesianChartModelProducer,
hoursFormat: String,
hoursMinutesFormat: String,
minutesFormat: String,
modifier: Modifier = Modifier,
axisTypeface: Typeface = Typeface.DEFAULT,
markerTypeface: Typeface = Typeface.DEFAULT,
@@ -82,9 +86,9 @@ fun TimeLineChart(
xValueFormatter: CartesianValueFormatter = CartesianValueFormatter.Default,
yValueFormatter: CartesianValueFormatter = CartesianValueFormatter { _, value, _ ->
if (value >= 60 * 60 * 1000) {
millisecondsToHours(value.toLong())
millisecondsToHours(value.toLong(), hoursFormat)
} else {
millisecondsToMinutes(value.toLong())
millisecondsToMinutes(value.toLong(), minutesFormat)
}
},
markerValueFormatter: DefaultCartesianMarker.ValueFormatter = DefaultCartesianMarker.ValueFormatter { _, targets ->
@@ -94,12 +98,12 @@ fun TimeLineChart(
} else 0L
if (value >= 60 * 60 * 1000) {
millisecondsToHoursMinutes(value)
millisecondsToHoursMinutes(value, hoursMinutesFormat)
} else {
millisecondsToMinutes(value)
millisecondsToMinutes(value, minutesFormat)
}
},
animationSpec: AnimationSpec<Float>? = null
animationSpec: AnimationSpec<Float>? = motionScheme.defaultEffectsSpec()
) {
ProvideVicoTheme(rememberM3VicoTheme()) {
CartesianChartHost(
@@ -180,6 +184,7 @@ fun TimeLineChart(
minZoom = Zoom.min(Zoom.Content, Zoom.fixed())
),
animationSpec = animationSpec,
animateIn = false,
modifier = modifier.height(224.dp),
)
}
@@ -203,7 +208,12 @@ private fun TimeLineChartPreview() {
}
TomatoTheme {
Surface {
TimeLineChart(modelProducer = modelProducer)
TimeLineChart(
modelProducer = modelProducer,
hoursFormat = "%dh",
hoursMinutesFormat = "%dh %dm",
minutesFormat = "%dm"
)
}
}
}

View File

@@ -92,8 +92,6 @@ val Typography = Typography(
@OptIn(ExperimentalTextApi::class)
object AppFonts {
val interClock = FontFamily(Font(R.font.inter_bold))
val googleFlex400 = FontFamily(Font(R.font.google_sans_flex_400))
val googleFlex600 = FontFamily(Font(R.font.google_sans_flex_600))

View File

@@ -38,6 +38,7 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
@@ -47,8 +48,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.ButtonGroup
import androidx.compose.material3.ButtonGroupDefaults
import androidx.compose.material3.CircularProgressIndicator
@@ -64,6 +64,7 @@ import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MaterialTheme.motionScheme
import androidx.compose.material3.MaterialTheme.shapes
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
@@ -94,7 +95,8 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation3.ui.LocalNavAnimatedContentScope
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.theme.AppFonts.interClock
import org.nsh07.pomodoro.ui.mergePaddingValues
import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex600
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTopBar
import org.nsh07.pomodoro.ui.theme.TomatoTheme
import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerAction
@@ -107,6 +109,7 @@ import org.nsh07.pomodoro.ui.timerScreen.viewModel.TimerState
fun SharedTransitionScope.TimerScreen(
timerState: TimerState,
isPlus: Boolean,
contentPadding: PaddingValues,
progress: () -> Float,
onAction: (TimerAction) -> Unit,
modifier: Modifier = Modifier
@@ -137,407 +140,419 @@ fun SharedTransitionScope.TimerScreen(
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
Column(modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection)) {
TopAppBar(
title = {
AnimatedContent(
if (!timerState.showBrandTitle) timerState.timerMode else TimerMode.BRAND,
transitionSpec = {
slideInVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
initialOffsetY = { (-it * 1.25).toInt() }
).togetherWith(
slideOutVertically(
Scaffold(
topBar = {
TopAppBar(
title = {
AnimatedContent(
if (!timerState.showBrandTitle) timerState.timerMode else TimerMode.BRAND,
transitionSpec = {
slideInVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
targetOffsetY = { (it * 1.25).toInt() }
initialOffsetY = { (-it * 1.25).toInt() }
).togetherWith(
slideOutVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
targetOffsetY = { (it * 1.25).toInt() }
)
)
)
},
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxWidth(.9f)
) {
when (it) {
TimerMode.BRAND ->
Text(
if (!isPlus) stringResource(R.string.app_name)
else stringResource(R.string.app_name_plus),
},
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxWidth(.9f)
) {
when (it) {
TimerMode.BRAND ->
Text(
if (!isPlus) stringResource(R.string.app_name)
else stringResource(R.string.app_name_plus),
style = TextStyle(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp,
color = colorScheme.error
),
textAlign = TextAlign.Center
)
TimerMode.FOCUS ->
Text(
stringResource(R.string.focus),
style = TextStyle(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp,
color = colorScheme.primary
),
textAlign = TextAlign.Center
)
TimerMode.SHORT_BREAK -> Text(
stringResource(R.string.short_break),
style = TextStyle(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp,
color = colorScheme.error
color = colorScheme.tertiary
),
textAlign = TextAlign.Center
)
TimerMode.FOCUS ->
Text(
stringResource(R.string.focus),
TimerMode.LONG_BREAK -> Text(
stringResource(R.string.long_break),
style = TextStyle(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp,
color = colorScheme.primary
color = colorScheme.tertiary
),
textAlign = TextAlign.Center
)
TimerMode.SHORT_BREAK -> Text(
stringResource(R.string.short_break),
style = TextStyle(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp,
color = colorScheme.tertiary
),
textAlign = TextAlign.Center
)
TimerMode.LONG_BREAK -> Text(
stringResource(R.string.long_break),
style = TextStyle(
fontFamily = robotoFlexTopBar,
fontSize = 32.sp,
lineHeight = 32.sp,
color = colorScheme.tertiary
),
textAlign = TextAlign.Center
)
}
}
}
},
subtitle = {},
titleHorizontalAlignment = CenterHorizontally,
scrollBehavior = scrollBehavior
)
Column(
},
subtitle = {},
titleHorizontalAlignment = CenterHorizontally,
scrollBehavior = scrollBehavior
)
},
modifier = modifier
.nestedScroll(scrollBehavior.nestedScrollConnection)
) { innerPadding ->
val insets = mergePaddingValues(innerPadding, contentPadding)
LazyColumn(
verticalArrangement = Arrangement.Center,
horizontalAlignment = CenterHorizontally,
contentPadding = insets,
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
) {
Column(horizontalAlignment = CenterHorizontally) {
Box(contentAlignment = Alignment.Center) {
if (timerState.timerMode == TimerMode.FOCUS) {
CircularProgressIndicator(
progress = progress,
modifier = Modifier
.sharedBounds(
sharedContentState = this@TimerScreen.rememberSharedContentState(
"focus progress"
),
animatedVisibilityScope = LocalNavAnimatedContentScope.current
)
.widthIn(max = 350.dp)
.fillMaxWidth(0.9f)
.aspectRatio(1f),
color = color,
trackColor = colorContainer,
strokeWidth = 16.dp,
gapSize = 8.dp
)
} else {
CircularWavyProgressIndicator(
progress = progress,
modifier = Modifier
.sharedBounds(
sharedContentState = this@TimerScreen.rememberSharedContentState(
"break progress"
),
animatedVisibilityScope = LocalNavAnimatedContentScope.current
)
.widthIn(max = 350.dp)
.fillMaxWidth(0.9f)
.aspectRatio(1f),
color = color,
trackColor = colorContainer,
stroke = Stroke(
width = with(LocalDensity.current) {
16.dp.toPx()
},
cap = StrokeCap.Round,
),
trackStroke = Stroke(
width = with(LocalDensity.current) {
16.dp.toPx()
},
cap = StrokeCap.Round,
),
wavelength = 60.dp,
gapSize = 8.dp
)
}
var expanded by remember { mutableStateOf(timerState.showBrandTitle) }
Column(
horizontalAlignment = CenterHorizontally,
modifier = Modifier
.clip(shapes.largeIncreased)
.clickable(onClick = { expanded = !expanded })
) {
LaunchedEffect(timerState.showBrandTitle) {
expanded = timerState.showBrandTitle
}
Text(
text = timerState.timeStr,
style = TextStyle(
fontFamily = interClock,
fontSize = 72.sp,
letterSpacing = (-2).sp,
fontFeatureSettings = "tnum"
),
textAlign = TextAlign.Center,
maxLines = 1,
modifier = Modifier.sharedBounds(
sharedContentState = this@TimerScreen.rememberSharedContentState("clock"),
animatedVisibilityScope = LocalNavAnimatedContentScope.current
)
)
AnimatedVisibility(
expanded,
enter = fadeIn(motionScheme.defaultEffectsSpec()) +
expandVertically(motionScheme.defaultSpatialSpec()),
exit = fadeOut(motionScheme.defaultEffectsSpec()) +
shrinkVertically(motionScheme.defaultSpatialSpec())
) {
Text(
stringResource(
R.string.timer_session_count,
timerState.currentFocusCount,
timerState.totalFocusCount
),
fontFamily = interClock,
style = typography.titleLarge,
color = colorScheme.outline
)
}
}
}
val interactionSources = remember { List(3) { MutableInteractionSource() } }
ButtonGroup(
overflowIndicator = { state ->
ButtonGroupDefaults.OverflowIndicator(
state,
colors = IconButtonDefaults.filledTonalIconButtonColors(),
modifier = Modifier.size(64.dp, 96.dp)
)
},
modifier = Modifier.padding(16.dp)
) {
customItem(
{
FilledIconToggleButton(
onCheckedChange = { checked ->
onAction(TimerAction.ToggleTimer)
if (checked) haptic.performHapticFeedback(HapticFeedbackType.ToggleOn)
else haptic.performHapticFeedback(HapticFeedbackType.ToggleOff)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && checked) {
permissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
}
},
checked = timerState.timerRunning,
colors = IconButtonDefaults.filledIconToggleButtonColors(
checkedContainerColor = color,
checkedContentColor = onColor
),
shapes = IconButtonDefaults.toggleableShapes(),
interactionSource = interactionSources[0],
item {
Column(horizontalAlignment = CenterHorizontally) {
Box(contentAlignment = Alignment.Center) {
if (timerState.timerMode == TimerMode.FOCUS) {
CircularProgressIndicator(
progress = progress,
modifier = Modifier
.size(width = 128.dp, height = 96.dp)
.animateWidth(interactionSources[0])
) {
if (timerState.timerRunning) {
Icon(
painterResource(R.drawable.pause_large),
contentDescription = stringResource(R.string.pause),
modifier = Modifier.size(32.dp)
.sharedBounds(
sharedContentState = this@TimerScreen.rememberSharedContentState(
"focus progress"
),
animatedVisibilityScope = LocalNavAnimatedContentScope.current
)
} else {
Icon(
painterResource(R.drawable.play_large),
contentDescription = stringResource(R.string.play),
modifier = Modifier.size(32.dp)
.widthIn(max = 350.dp)
.fillMaxWidth(0.9f)
.aspectRatio(1f),
color = color,
trackColor = colorContainer,
strokeWidth = 16.dp,
gapSize = 8.dp
)
} else {
CircularWavyProgressIndicator(
progress = progress,
modifier = Modifier
.sharedBounds(
sharedContentState = this@TimerScreen.rememberSharedContentState(
"break progress"
),
animatedVisibilityScope = LocalNavAnimatedContentScope.current
)
}
.widthIn(max = 350.dp)
.fillMaxWidth(0.9f)
.aspectRatio(1f),
color = color,
trackColor = colorContainer,
stroke = Stroke(
width = with(LocalDensity.current) {
16.dp.toPx()
},
cap = StrokeCap.Round,
),
trackStroke = Stroke(
width = with(LocalDensity.current) {
16.dp.toPx()
},
cap = StrokeCap.Round,
),
wavelength = 60.dp,
gapSize = 8.dp
)
}
var expanded by remember { mutableStateOf(timerState.showBrandTitle) }
Column(
horizontalAlignment = CenterHorizontally,
modifier = Modifier
.clip(shapes.largeIncreased)
.clickable(onClick = { expanded = !expanded })
) {
LaunchedEffect(timerState.showBrandTitle) {
expanded = timerState.showBrandTitle
}
Text(
text = timerState.timeStr,
style = TextStyle(
fontFamily = googleFlex600,
fontSize = 72.sp,
letterSpacing = (-2.6).sp,
fontFeatureSettings = "tnum"
),
textAlign = TextAlign.Center,
maxLines = 1,
modifier = Modifier.sharedBounds(
sharedContentState = this@TimerScreen.rememberSharedContentState(
"clock"
),
animatedVisibilityScope = LocalNavAnimatedContentScope.current
)
)
AnimatedVisibility(
expanded,
enter = fadeIn(motionScheme.defaultEffectsSpec()) +
expandVertically(motionScheme.defaultSpatialSpec()),
exit = fadeOut(motionScheme.defaultEffectsSpec()) +
shrinkVertically(motionScheme.defaultSpatialSpec())
) {
Text(
stringResource(
R.string.timer_session_count,
timerState.currentFocusCount,
timerState.totalFocusCount
),
fontFamily = googleFlex600,
style = typography.titleLarge,
color = colorScheme.outline
)
}
}
}
val interactionSources = remember { List(3) { MutableInteractionSource() } }
ButtonGroup(
overflowIndicator = { state ->
ButtonGroupDefaults.OverflowIndicator(
state,
colors = IconButtonDefaults.filledTonalIconButtonColors(),
modifier = Modifier.size(64.dp, 96.dp)
)
},
{ state ->
DropdownMenuItem(
leadingIcon = {
modifier = Modifier.padding(16.dp)
) {
customItem(
{
FilledIconToggleButton(
onCheckedChange = { checked ->
onAction(TimerAction.ToggleTimer)
if (checked) haptic.performHapticFeedback(HapticFeedbackType.ToggleOn)
else haptic.performHapticFeedback(HapticFeedbackType.ToggleOff)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && checked) {
permissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
}
},
checked = timerState.timerRunning,
colors = IconButtonDefaults.filledIconToggleButtonColors(
checkedContainerColor = color,
checkedContentColor = onColor
),
shapes = IconButtonDefaults.toggleableShapes(),
interactionSource = interactionSources[0],
modifier = Modifier
.size(width = 128.dp, height = 96.dp)
.animateWidth(interactionSources[0])
) {
if (timerState.timerRunning) {
Icon(
painterResource(R.drawable.pause),
contentDescription = stringResource(R.string.pause)
painterResource(R.drawable.pause_large),
contentDescription = stringResource(R.string.pause),
modifier = Modifier.size(32.dp)
)
} else {
Icon(
painterResource(R.drawable.play),
contentDescription = stringResource(R.string.play)
painterResource(R.drawable.play_large),
contentDescription = stringResource(R.string.play),
modifier = Modifier.size(32.dp)
)
}
},
text = {
Text(
if (timerState.timerRunning) stringResource(R.string.pause) else stringResource(
R.string.play
}
},
{ state ->
DropdownMenuItem(
leadingIcon = {
if (timerState.timerRunning) {
Icon(
painterResource(R.drawable.pause),
contentDescription = stringResource(R.string.pause)
)
} else {
Icon(
painterResource(R.drawable.play),
contentDescription = stringResource(R.string.play)
)
}
},
text = {
Text(
if (timerState.timerRunning) stringResource(R.string.pause) else stringResource(
R.string.play
)
)
)
},
onClick = {
onAction(TimerAction.ToggleTimer)
state.dismiss()
}
)
}
)
customItem(
{
FilledTonalIconButton(
onClick = {
onAction(TimerAction.ResetTimer)
haptic.performHapticFeedback(HapticFeedbackType.VirtualKey)
},
colors = IconButtonDefaults.filledTonalIconButtonColors(
containerColor = colorContainer
),
shapes = IconButtonDefaults.shapes(),
interactionSource = interactionSources[1],
modifier = Modifier
.size(96.dp)
.animateWidth(interactionSources[1])
) {
Icon(
painterResource(R.drawable.restart_large),
contentDescription = stringResource(R.string.restart),
modifier = Modifier.size(32.dp)
},
onClick = {
onAction(TimerAction.ToggleTimer)
state.dismiss()
}
)
}
},
{ state ->
DropdownMenuItem(
leadingIcon = {
Icon(
painterResource(R.drawable.restart),
stringResource(R.string.restart)
)
},
text = { Text(stringResource(R.string.restart)) },
onClick = {
onAction(TimerAction.ResetTimer)
state.dismiss()
}
)
}
)
)
customItem(
{
FilledTonalIconButton(
onClick = {
onAction(TimerAction.SkipTimer(fromButton = true))
haptic.performHapticFeedback(HapticFeedbackType.VirtualKey)
},
colors = IconButtonDefaults.filledTonalIconButtonColors(
containerColor = colorContainer
),
shapes = IconButtonDefaults.shapes(),
interactionSource = interactionSources[2],
modifier = Modifier
.size(64.dp, 96.dp)
.animateWidth(interactionSources[2])
) {
Icon(
painterResource(R.drawable.skip_next_large),
contentDescription = stringResource(R.string.skip_to_next),
modifier = Modifier.size(32.dp)
customItem(
{
FilledTonalIconButton(
onClick = {
onAction(TimerAction.ResetTimer)
haptic.performHapticFeedback(HapticFeedbackType.VirtualKey)
},
colors = IconButtonDefaults.filledTonalIconButtonColors(
containerColor = colorContainer
),
shapes = IconButtonDefaults.shapes(),
interactionSource = interactionSources[1],
modifier = Modifier
.size(96.dp)
.animateWidth(interactionSources[1])
) {
Icon(
painterResource(R.drawable.restart_large),
contentDescription = stringResource(R.string.restart),
modifier = Modifier.size(32.dp)
)
}
},
{ state ->
DropdownMenuItem(
leadingIcon = {
Icon(
painterResource(R.drawable.restart),
stringResource(R.string.restart)
)
},
text = { Text(stringResource(R.string.restart)) },
onClick = {
onAction(TimerAction.ResetTimer)
state.dismiss()
}
)
}
},
{ state ->
DropdownMenuItem(
leadingIcon = {
)
customItem(
{
FilledTonalIconButton(
onClick = {
onAction(TimerAction.SkipTimer(fromButton = true))
haptic.performHapticFeedback(HapticFeedbackType.VirtualKey)
},
colors = IconButtonDefaults.filledTonalIconButtonColors(
containerColor = colorContainer
),
shapes = IconButtonDefaults.shapes(),
interactionSource = interactionSources[2],
modifier = Modifier
.size(64.dp, 96.dp)
.animateWidth(interactionSources[2])
) {
Icon(
painterResource(R.drawable.skip_next),
stringResource(R.string.skip_to_next)
painterResource(R.drawable.skip_next_large),
contentDescription = stringResource(R.string.skip_to_next),
modifier = Modifier.size(32.dp)
)
},
text = { Text(stringResource(R.string.skip_to_next)) },
onClick = {
onAction(TimerAction.SkipTimer(fromButton = true))
state.dismiss()
}
)
}
)
},
{ state ->
DropdownMenuItem(
leadingIcon = {
Icon(
painterResource(R.drawable.skip_next),
stringResource(R.string.skip_to_next)
)
},
text = { Text(stringResource(R.string.skip_to_next)) },
onClick = {
onAction(TimerAction.SkipTimer(fromButton = true))
state.dismiss()
}
)
}
)
}
}
}
Spacer(Modifier.height(32.dp))
item { Spacer(Modifier.height(32.dp)) }
Column(horizontalAlignment = CenterHorizontally) {
Text(stringResource(R.string.up_next), style = typography.titleSmall)
AnimatedContent(
timerState.nextTimeStr,
transitionSpec = {
slideInVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
initialOffsetY = { (-it * 1.25).toInt() }
).togetherWith(
slideOutVertically(
item {
Column(horizontalAlignment = CenterHorizontally) {
Text(stringResource(R.string.up_next), style = typography.titleSmall)
AnimatedContent(
timerState.nextTimeStr,
transitionSpec = {
slideInVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
targetOffsetY = { (it * 1.25).toInt() }
initialOffsetY = { (-it * 1.25).toInt() }
).togetherWith(
slideOutVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
targetOffsetY = { (it * 1.25).toInt() }
)
)
}
) {
Text(
it,
style = TextStyle(
fontFamily = googleFlex600,
fontSize = 22.sp,
lineHeight = 28.sp,
color = if (timerState.nextTimerMode == TimerMode.FOCUS) colorScheme.primary else colorScheme.tertiary,
textAlign = TextAlign.Center
),
modifier = Modifier.width(200.dp)
)
}
) {
Text(
it,
style = TextStyle(
fontFamily = interClock,
fontSize = 22.sp,
lineHeight = 28.sp,
color = if (timerState.nextTimerMode == TimerMode.FOCUS) colorScheme.primary else colorScheme.tertiary,
textAlign = TextAlign.Center
),
modifier = Modifier.width(200.dp)
)
}
AnimatedContent(
timerState.nextTimerMode,
transitionSpec = {
slideInVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
initialOffsetY = { (-it * 1.25).toInt() }
).togetherWith(
slideOutVertically(
AnimatedContent(
timerState.nextTimerMode,
transitionSpec = {
slideInVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
targetOffsetY = { (it * 1.25).toInt() }
initialOffsetY = { (-it * 1.25).toInt() }
).togetherWith(
slideOutVertically(
animationSpec = motionScheme.defaultSpatialSpec(),
targetOffsetY = { (it * 1.25).toInt() }
)
)
}
) {
Text(
when (it) {
TimerMode.FOCUS -> stringResource(R.string.focus)
TimerMode.SHORT_BREAK -> stringResource(R.string.short_break)
else -> stringResource(R.string.long_break)
},
style = typography.titleMediumEmphasized,
textAlign = TextAlign.Center,
modifier = Modifier.width(200.dp)
)
}
) {
Text(
when (it) {
TimerMode.FOCUS -> stringResource(R.string.focus)
TimerMode.SHORT_BREAK -> stringResource(R.string.short_break)
else -> stringResource(R.string.long_break)
},
style = typography.titleMediumEmphasized,
textAlign = TextAlign.Center,
modifier = Modifier.width(200.dp)
)
}
}
Spacer(Modifier.height(16.dp))
item { Spacer(Modifier.height(16.dp)) }
}
}
}
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Preview(
showSystemUi = true,
device = Devices.PIXEL_9_PRO
@@ -553,6 +568,7 @@ fun TimerScreenPreview() {
TimerScreen(
timerState,
isPlus = true,
contentPadding = PaddingValues(),
{ 0.3f },
{}
)

View File

@@ -1,8 +1,18 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.ui.timerScreen.viewModel
@@ -17,7 +27,8 @@ data class TimerState(
val showBrandTitle: Boolean = true,
val currentFocusCount: Int = 1,
val totalFocusCount: Int = 4,
val alarmRinging: Boolean = false
val alarmRinging: Boolean = false,
val serviceRunning: Boolean = false
)
enum class TimerMode {

View File

@@ -17,8 +17,6 @@
package org.nsh07.pomodoro.ui.timerScreen.viewModel
import android.provider.Settings
import androidx.core.net.toUri
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY
@@ -37,122 +35,49 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import org.nsh07.pomodoro.TomatoApplication
import org.nsh07.pomodoro.data.PreferenceRepository
import org.nsh07.pomodoro.data.Stat
import org.nsh07.pomodoro.data.StatRepository
import org.nsh07.pomodoro.data.TimerRepository
import org.nsh07.pomodoro.data.StateRepository
import org.nsh07.pomodoro.service.ServiceHelper
import org.nsh07.pomodoro.utils.millisecondsToStr
import java.time.LocalDate
import java.time.temporal.ChronoUnit
@OptIn(FlowPreview::class)
class TimerViewModel(
private val preferenceRepository: PreferenceRepository,
private val serviceHelper: ServiceHelper,
private val stateRepository: StateRepository,
private val statRepository: StatRepository,
private val timerRepository: TimerRepository,
private val _timerState: MutableStateFlow<TimerState>,
private val _time: MutableStateFlow<Long>
) : ViewModel() {
val timerState: StateFlow<TimerState> = _timerState.asStateFlow()
val timerState: StateFlow<TimerState> = stateRepository.timerState.asStateFlow()
val time: StateFlow<Long> = _time.asStateFlow()
val progress = _time.combine(_timerState) { remainingTime, uiState ->
val progress = _time.combine(stateRepository.timerState) { remainingTime, uiState ->
(uiState.totalTime.toFloat() - remainingTime) / uiState.totalTime
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), 0f)
private var cycles = 0
private var startTime = 0L
private var pauseTime = 0L
private var pauseDuration = 0L
init {
if (!timerRepository.serviceRunning.value)
viewModelScope.launch(Dispatchers.IO) {
timerRepository.focusTime =
preferenceRepository.getIntPreference("focus_time")?.toLong()
?: preferenceRepository.saveIntPreference(
"focus_time",
timerRepository.focusTime.toInt()
).toLong()
timerRepository.shortBreakTime =
preferenceRepository.getIntPreference("short_break_time")?.toLong()
?: preferenceRepository.saveIntPreference(
"short_break_time",
timerRepository.shortBreakTime.toInt()
).toLong()
timerRepository.longBreakTime =
preferenceRepository.getIntPreference("long_break_time")?.toLong()
?: preferenceRepository.saveIntPreference(
"long_break_time",
timerRepository.longBreakTime.toInt()
).toLong()
timerRepository.sessionLength =
preferenceRepository.getIntPreference("session_length")
?: preferenceRepository.saveIntPreference(
"session_length",
timerRepository.sessionLength
)
viewModelScope.launch(Dispatchers.IO) {
var lastDate = statRepository.getLastDate()
val today = LocalDate.now()
timerRepository.alarmEnabled =
preferenceRepository.getBooleanPreference("alarm_enabled")
?: preferenceRepository.saveBooleanPreference("alarm_enabled", true)
timerRepository.vibrateEnabled =
preferenceRepository.getBooleanPreference("vibrate_enabled")
?: preferenceRepository.saveBooleanPreference("vibrate_enabled", true)
timerRepository.dndEnabled =
preferenceRepository.getBooleanPreference("dnd_enabled")
?: preferenceRepository.saveBooleanPreference("dnd_enabled", false)
timerRepository.alarmSoundUri = (
preferenceRepository.getStringPreference("alarm_sound")
?: preferenceRepository.saveStringPreference(
"alarm_sound",
(Settings.System.DEFAULT_ALARM_ALERT_URI
?: Settings.System.DEFAULT_RINGTONE_URI).toString()
)
).toUri()
_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 = if (timerRepository.sessionLength > 1) TimerMode.SHORT_BREAK else TimerMode.LONG_BREAK,
nextTimeStr = millisecondsToStr(if (timerRepository.sessionLength > 1) timerRepository.shortBreakTime else timerRepository.longBreakTime),
currentFocusCount = 1,
totalFocusCount = timerRepository.sessionLength
)
}
var lastDate = statRepository.getLastDate()
val today = LocalDate.now()
// Fills dates between today and lastDate with 0s to ensure continuous history
if (lastDate != null) {
while (ChronoUnit.DAYS.between(lastDate, today) > 0) {
lastDate = lastDate?.plusDays(1)
statRepository.insertStat(Stat(lastDate!!, 0, 0, 0, 0, 0))
}
} else {
statRepository.insertStat(Stat(today, 0, 0, 0, 0, 0))
}
delay(1500)
_timerState.update { currentState ->
currentState.copy(showBrandTitle = false)
// Fills dates between today and lastDate with 0s to ensure continuous history
if (lastDate != null) {
while (ChronoUnit.DAYS.between(lastDate, today) > 0) {
lastDate = lastDate?.plusDays(1)
statRepository.insertStat(Stat(lastDate!!, 0, 0, 0, 0, 0))
}
} else {
statRepository.insertStat(Stat(today, 0, 0, 0, 0, 0))
}
delay(1500)
stateRepository.timerState.update { currentState ->
currentState.copy(showBrandTitle = false)
}
}
}
fun onAction(action: TimerAction) {
@@ -163,19 +88,15 @@ class TimerViewModel(
val Factory: ViewModelProvider.Factory = viewModelFactory {
initializer {
val application = (this[APPLICATION_KEY] as TomatoApplication)
val appPreferenceRepository = application.container.appPreferenceRepository
val appStatRepository = application.container.appStatRepository
val appTimerRepository = application.container.appTimerRepository
val stateRepository = application.container.stateRepository
val serviceHelper = application.container.serviceHelper
val timerState = application.container.timerState
val time = application.container.time
TimerViewModel(
preferenceRepository = appPreferenceRepository,
serviceHelper = serviceHelper,
stateRepository = stateRepository,
statRepository = appStatRepository,
timerRepository = appTimerRepository,
_timerState = timerState,
_time = time
)
}

View File

@@ -1,8 +1,18 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.utils
@@ -21,29 +31,30 @@ fun millisecondsToStr(t: Long): String {
)
}
fun millisecondsToHours(t: Long): String {
fun millisecondsToHours(t: Long, format: String = "%dh"): String {
require(t >= 0L)
return String.format(
Locale.getDefault(),
"%dh",
format,
TimeUnit.MILLISECONDS.toHours(t)
)
}
fun millisecondsToMinutes(t: Long): String {
fun millisecondsToMinutes(t: Long, format: String = "%dm"): String {
require(t >= 0L)
return String.format(
Locale.getDefault(),
"%dm",
format,
TimeUnit.MILLISECONDS.toMinutes(t)
)
}
fun millisecondsToHoursMinutes(t: Long): String {
fun millisecondsToHoursMinutes(t: Long, format: String = $$"%1$dh %2$dm"): String {
require(t >= 0L)
return String.format(
Locale.getDefault(),
"%dh %dm", TimeUnit.MILLISECONDS.toHours(t),
format,
TimeUnit.MILLISECONDS.toHours(t),
TimeUnit.MILLISECONDS.toMinutes(t) % TimeUnit.HOURS.toMinutes(1)
)
}
@@ -51,10 +62,12 @@ fun millisecondsToHoursMinutes(t: Long): String {
/**
* Extension function for [String] to convert it to a [androidx.compose.ui.graphics.Color]
*
* The base string must be of the format produced by [androidx.compose.ui.graphics.Color.toString],
* The base string MUST be of the format produced by [androidx.compose.ui.graphics.Color.toString],
* i.e, the color black with 100% opacity in sRGB would be represented by:
*
* Color(0.0, 0.0, 0.0, 1.0, sRGB IEC61966-2.1)
*
* The behaviour of this function is undefined if the format is not followed
*/
fun String.toColor(): Color {
// Sample string: Color(0.0, 0.0, 0.0, 1.0, sRGB IEC61966-2.1)
@@ -64,8 +77,8 @@ fun String.toColor(): Color {
val comma4 = this.indexOf(',', comma3 + 1)
val r = this.substringAfter('(').substringBefore(',').toFloat()
val g = this.slice(comma1 + 1..comma2 - 1).toFloat()
val b = this.slice(comma2 + 1..comma3 - 1).toFloat()
val a = this.slice(comma3 + 1..comma4 - 1).toFloat()
val g = this.slice(comma1 + 1..<comma2).toFloat()
val b = this.slice(comma2 + 1..<comma3).toFloat()
val a = this.slice(comma3 + 1..<comma4).toFloat()
return Color(r, g, b, a)
}

View File

@@ -22,5 +22,5 @@
android:viewportHeight="960">
<path
android:fillColor="#e3e3e3"
android:pathData="m321,880 l-71,-71 329,-329 -329,-329 71,-71 400,400L321,880Z" />
android:pathData="M579,480 L285,186q-15,-15 -14.5,-35.5T286,115q15,-15 35.5,-15t35.5,15l307,308q12,12 18,27t6,30q0,15 -6,30t-18,27L356,845q-15,15 -35,14.5T286,844q-15,-15 -15,-35.5t15,-35.5l293,-293Z" />
</vector>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#e3e3e3"
android:pathData="M480,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,480v58q0,59 -40.5,100.5T740,680q-35,0 -66,-15t-52,-43q-29,29 -65.5,43.5T480,680q-83,0 -141.5,-58.5T280,480q0,-83 58.5,-141.5T480,280q83,0 141.5,58.5T680,480v58q0,26 17,44t43,18q26,0 43,-18t17,-44v-58q0,-134 -93,-227t-227,-93q-134,0 -227,93t-93,227q0,134 93,227t227,93h160q17,0 28.5,11.5T680,840q0,17 -11.5,28.5T640,880L480,880ZM480,600q50,0 85,-35t35,-85q0,-50 -35,-85t-85,-35q-50,0 -85,35t-35,85q0,50 35,85t85,35Z" />
</vector>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#e3e3e3"
android:pathData="M200,760h400q17,0 28.5,11.5T640,800q0,17 -11.5,28.5T600,840L200,840q-17,0 -28.5,-11.5T160,800q0,-17 11.5,-28.5T200,760ZM329,589L216,476q-23,-23 -23.5,-56.5T215,363l29,-29 228,226 -29,29q-23,23 -57,23t-57,-23ZM640,392L414,164l29,-29q23,-23 56.5,-22.5T556,136l113,113q23,23 23,57t-23,57l-29,29ZM796,772L302,278l56,-56 494,494q11,11 11,28t-11,28q-11,11 -28,11t-28,-11Z" />
</vector>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#e3e3e3"
android:pathData="M480,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,880ZM480,800q134,0 227,-93t93,-227q0,-7 -0.5,-14.5T799,453q-5,29 -27,48t-52,19h-80q-33,0 -56.5,-23.5T560,440v-40L400,400v-80q0,-33 23.5,-56.5T480,240h40q0,-23 12.5,-40.5T563,171q-20,-5 -40.5,-8t-42.5,-3q-134,0 -227,93t-93,227h200q66,0 113,47t47,113v40L400,680v110q20,5 39.5,7.5T480,800Z" />
</vector>

View File

@@ -1,59 +1,65 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
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: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:strokeLineJoin="round"
android:strokeWidth="3.32220472"
android:fillColor="#00000000"
android:strokeColor="#ffffff"/>
<path
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:strokeLineJoin="round"
android:strokeWidth="3.32220472"
android:strokeColor="#00000000">
<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
android:pathData="m61.22,25.81c-9.66,0.52 -9.89,6.71 -9.22,10.6l3.48,0.08c1.13,-2.8 -0.16,-6.5 7.42,-6.91 0,-1.55 0.07,-3.18 -1.68,-3.77zM67.14,33.3c-3.56,-0.17 -7.58,0.44 -9.39,3.55l7.41,3.5c3.18,-0.94 5.77,-1.16 8.65,-5.93 0,0 -3.11,-0.95 -6.67,-1.12zM40.11,33.46c-3.43,0.14 -6.25,0.96 -6.25,0.96 2.41,2.89 5.24,5.15 9.54,5.21 1.65,-1.88 4.05,-2.62 6.64,-3.08 -2.46,-2.7 -6.5,-3.23 -9.93,-3.09zM53.93,38.98c-9.07,-0.33 -11.94,7.41 -11.94,7.41 4.64,-0.38 8.72,-2.26 11.94,-6.43 2.58,4.94 6.8,6.14 11.59,6.04 0,0 -2.52,-6.7 -11.59,-7.02z"
android:strokeLineJoin="round"
android:strokeWidth="3.32073"
android:fillColor="#00000000"
android:strokeColor="#ffffff"/>
<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>
android:viewportWidth="25.4"
android:viewportHeight="25.4">
<group
android:scaleX="0.65"
android:scaleY="0.65"
android:translateX="4.445"
android:translateY="4.445">
<path
android:fillColor="#137e3a"
android:pathData="m8.886,10.709c1.099,-0.071 2.221,-0.352 3.111,-1.026 0.235,-0.192 0.456,-0.401 0.63,-0.651 0.419,0.625 1.098,1.024 1.79,1.283 0.749,0.262 1.543,0.409 2.337,0.402 0.291,-0.012 0.349,-0.376 0.236,-0.59C16.805,9.561 16.476,9.056 16.078,8.617 16.788,8.505 17.494,8.262 18.053,7.797 18.456,7.478 18.812,7.095 19.084,6.658 19.188,6.409 18.993,6.17 18.743,6.139 18.081,5.976 17.398,5.901 16.716,5.92 15.826,5.9 14.939,6.156 14.171,6.6 13.965,6.712 13.786,6.87 13.592,6.995c-0.037,-0.419 0.048,-0.86 0.247,-1.235 0.24,-0.393 0.686,-0.621 1.14,-0.631 0.237,0.002 0.577,-0.004 0.612,-0.31 0.105,-0.481 0.009,-1.022 -0.307,-1.407 -0.192,-0.194 -0.493,-0.074 -0.731,-0.063 -0.688,0.094 -1.381,0.348 -1.865,0.865 -0.396,0.403 -0.639,0.926 -0.773,1.47 -0.107,0.409 -0.157,0.829 -0.208,1.248C10.951,6.318 9.99,5.984 9.023,5.926 8.425,5.91 7.822,5.905 7.234,6.028c-0.273,0.062 -0.576,0.067 -0.818,0.218 -0.267,0.19 -0.063,0.517 0.095,0.704 0.561,0.763 1.384,1.335 2.306,1.562 0.138,0.065 0.557,0.04 0.28,0.228 -0.41,0.44 -0.7,0.984 -0.892,1.551 -0.021,0.434 0.344,0.45 0.68,0.417z"
android:strokeWidth="0.0124219" />
<path
android:pathData="m13.277,22.081c1.522,-0.097 3.008,-0.593 4.289,-1.416 1.718,-1.096 3.047,-2.838 3.5,-4.839 0.536,-2.224 -0.072,-4.68 -1.562,-6.413 -0.384,-0.451 -1.175,-1.183 -1.334,-1.227 -0.295,0.16 -0.495,0.381 -1.395,0.678 0.271,0.368 0.559,1.008 0.644,1.431 0.07,0.448 -0.354,0.874 -0.803,0.801C15.427,11.036 13.85,10.805 12.624,9.637 11.46,10.755 9.998,11.054 8.509,11.099 8.035,11.096 7.687,10.56 7.869,10.124 8.008,9.661 8.257,9.247 8.509,8.84 8.07,8.655 7.627,8.462 7.233,8.187 5.606,9.335 4.483,11.179 4.217,13.155c-0.215,1.411 0.03,2.882 0.64,4.168 0.585,1.265 1.545,2.338 2.679,3.141 1.327,0.939 2.911,1.498 4.532,1.607 0.402,0.037 0.807,0.019 1.209,0.01z"
android:strokeWidth="0.0124219">
<aapt:attr name="android:fillColor">
<gradient
android:endX="18.755"
android:endY="21.194"
android:startX="6.645"
android:startY="9.085"
android:type="linear">
<item
android:color="#FFEC2D01"
android:offset="0" />
<item
android:color="#FFC82300"
android:offset="1" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#00000000"
android:pathData="m5.35,11.991c-0.259,0.59 -0.409,1.215 -0.442,1.85 -0.008,0.154 -0.008,0.404 -0,0.557 0.005,0.087 0.012,0.175 0.021,0.262 0.016,0.153 0.161,0.276 0.315,0.276l0.41,0c0.154,0 0.255,-0.123 0.236,-0.275 -0.011,-0.087 -0.019,-0.175 -0.024,-0.263 -0.01,-0.154 -0.01,-0.404 0,-0.557 0.041,-0.647 0.223,-1.279 0.536,-1.861 0.073,-0.136 0.015,-0.241 -0.139,-0.241l-0.514,0c-0.154,0 -0.335,0.111 -0.397,0.252zM5.114,15.6c0.036,0.122 0.076,0.243 0.121,0.363 0.054,0.144 0.229,0.259 0.383,0.259l0.485,0c0.154,0 0.22,-0.11 0.156,-0.25 -0.056,-0.123 -0.106,-0.248 -0.15,-0.375 -0.051,-0.145 -0.209,-0.266 -0.363,-0.266l-0.424,0c-0.154,0 -0.251,0.122 -0.207,0.269z"
android:strokeWidth="0"
android:strokeColor="#ffffff"
android:strokeLineJoin="round" />
<path
android:fillColor="#ffffff"
android:pathData="m5.35,11.991c-0.259,0.59 -0.409,1.215 -0.442,1.85 -0.008,0.154 -0.008,0.404 -0,0.557 0.005,0.087 0.012,0.175 0.021,0.262 0.016,0.153 0.161,0.276 0.315,0.276l0.41,0c0.154,0 0.255,-0.123 0.236,-0.275 -0.011,-0.087 -0.019,-0.175 -0.024,-0.263 -0.01,-0.154 -0.01,-0.404 0,-0.557 0.041,-0.647 0.223,-1.279 0.536,-1.861 0.073,-0.136 0.015,-0.241 -0.139,-0.241l-0.514,0c-0.154,0 -0.335,0.111 -0.397,0.252zM5.114,15.6c0.036,0.122 0.076,0.243 0.121,0.363 0.054,0.144 0.229,0.259 0.383,0.259l0.485,0c0.154,0 0.22,-0.11 0.156,-0.25 -0.056,-0.123 -0.106,-0.248 -0.15,-0.375 -0.051,-0.145 -0.209,-0.266 -0.363,-0.266l-0.424,0c-0.154,0 -0.251,0.122 -0.207,0.269z"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeLineJoin="round" />
</group>
</vector>

View File

@@ -1,36 +1,37 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
android:viewportWidth="25.4"
android:viewportHeight="25.4">
<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" />
android:scaleX="0.65"
android:scaleY="0.65"
android:translateX="4.445"
android:translateY="4.445">
<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" />
android:pathData="m8.886,10.709c1.099,-0.071 2.221,-0.352 3.111,-1.026 0.235,-0.192 0.456,-0.401 0.63,-0.651 0.419,0.625 1.098,1.024 1.79,1.283 0.749,0.262 1.543,0.409 2.337,0.402 0.291,-0.012 0.349,-0.376 0.236,-0.59C16.805,9.561 16.476,9.056 16.078,8.617 16.788,8.505 17.494,8.262 18.053,7.797 18.456,7.478 18.812,7.095 19.084,6.658 19.188,6.409 18.993,6.17 18.743,6.139 18.081,5.976 17.398,5.901 16.716,5.92 15.826,5.9 14.939,6.156 14.171,6.6 13.965,6.712 13.786,6.87 13.592,6.995c-0.037,-0.419 0.048,-0.86 0.247,-1.235 0.24,-0.393 0.686,-0.621 1.14,-0.631 0.237,0.002 0.577,-0.004 0.612,-0.31 0.105,-0.481 0.009,-1.022 -0.307,-1.407 -0.192,-0.194 -0.493,-0.074 -0.731,-0.063 -0.688,0.094 -1.381,0.348 -1.865,0.865 -0.396,0.403 -0.639,0.926 -0.773,1.47 -0.107,0.409 -0.157,0.829 -0.208,1.248C10.951,6.318 9.99,5.984 9.023,5.926 8.425,5.91 7.822,5.905 7.234,6.028c-0.273,0.062 -0.576,0.067 -0.818,0.218 -0.267,0.19 -0.063,0.517 0.095,0.704 0.561,0.763 1.384,1.335 2.306,1.562 0.138,0.065 0.557,0.04 0.28,0.228 -0.41,0.44 -0.7,0.984 -0.892,1.551 -0.021,0.434 0.344,0.45 0.68,0.417z"
android:strokeWidth="0.0124219" />
<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" />
android:pathData="m13.277,22.081c1.522,-0.097 3.008,-0.593 4.289,-1.416 1.718,-1.096 3.047,-2.838 3.5,-4.839 0.536,-2.224 -0.072,-4.68 -1.562,-6.413 -0.384,-0.451 -1.175,-1.183 -1.334,-1.227 -0.295,0.16 -0.495,0.381 -1.395,0.678 0.271,0.368 0.559,1.008 0.644,1.431 0.07,0.448 -0.354,0.874 -0.803,0.801C15.427,11.036 13.85,10.805 12.624,9.637 11.46,10.755 9.998,11.054 8.509,11.099 8.035,11.096 7.687,10.56 7.869,10.124 8.008,9.661 8.257,9.247 8.509,8.84 8.07,8.655 7.627,8.462 7.233,8.187 5.606,9.335 4.483,11.179 4.217,13.155c-0.215,1.411 0.03,2.882 0.64,4.168 0.585,1.265 1.545,2.338 2.679,3.141 1.327,0.939 2.911,1.498 4.532,1.607 0.402,0.037 0.807,0.019 1.209,0.01z"
android:strokeWidth="0.0124219" />
</group>
</vector>

View File

@@ -1,10 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<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:fillColor="#e3e3e3"
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>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#e3e3e3"
android:pathData="M400,840q-66,0 -113,-47t-47,-113q0,-66 47,-113t113,-47q23,0 42.5,5.5T480,542v-382q0,-17 11.5,-28.5T520,120h160q17,0 28.5,11.5T720,160v80q0,17 -11.5,28.5T680,280L560,280v400q0,66 -47,113t-113,47Z" />
</vector>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#e3e3e3"
android:pathData="M200,840q-33,0 -56.5,-23.5T120,760v-560q0,-33 23.5,-56.5T200,120h240q17,0 28.5,11.5T480,160q0,17 -11.5,28.5T440,200L200,200v560h560v-240q0,-17 11.5,-28.5T800,480q17,0 28.5,11.5T840,520v240q0,33 -23.5,56.5T760,840L200,840ZM760,256L416,600q-11,11 -28,11t-28,-11q-11,-11 -11,-28t11,-28l344,-344L600,200q-17,0 -28.5,-11.5T560,160q0,-17 11.5,-28.5T600,120h200q17,0 28.5,11.5T840,160v200q0,17 -11.5,28.5T800,400q-17,0 -28.5,-11.5T760,360v-104Z" />
</vector>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="655.36dp"
android:height="655.36dp"
android:viewportWidth="655.36"
android:viewportHeight="655.36">
<path
android:fillColor="#000000"
android:pathData="m167.68,493.2c-2.01,-0.71 -4.85,-3.61 -5.55,-5.66 -0.5,-1.47 -0.54,-12.62 -0.54,-159.86 0,-147.24 0.04,-158.4 0.54,-159.86 0.36,-1.07 1.11,-2.15 2.32,-3.37 2.92,-2.92 2.87,-2.91 17.68,-2.78 11.96,0.11 12.67,0.15 14.42,0.81 4.82,1.8 6.26,3.01 15,12.56 4.43,4.83 78.74,85.46 136.27,147.85 22.97,24.91 55,59.65 71.17,77.19 22.69,24.62 29.65,31.98 30.48,32.25 1.94,0.64 5.11,-0.56 6.2,-2.35 0.62,-1.02 0.63,-2.21 0.55,-102.73l-0.08,-101.7 -1.17,-1.07c-1.65,-1.51 -4.07,-2.12 -5.8,-1.47 -0.42,0.16 -4.86,4.73 -9.86,10.16 -26.15,28.39 -31.85,34.48 -33.05,35.36 -2.05,1.49 -4.2,2.49 -6.84,3.16 -2.24,0.57 -3.65,0.62 -18.48,0.62H364.89l-1.06,-0.72c-1.52,-1.03 -2.55,-3.15 -2.55,-5.24v-1.7l43.41,-47.13c23.88,-25.92 44.67,-48.38 46.21,-49.91 2.14,-2.13 3.35,-3.04 5.21,-3.93 4.02,-1.93 5.35,-2.08 18.32,-2.09 13.56,-0.01 13.64,0.01 16.48,2.85 1.21,1.21 1.96,2.29 2.32,3.36 0.5,1.47 0.54,12.62 0.54,159.86 0,147.24 -0.04,158.4 -0.54,159.86 -0.36,1.07 -1.11,2.15 -2.32,3.37 -2.92,2.92 -2.87,2.91 -17.68,2.78 -13.77,-0.12 -13.42,-0.08 -17.7,-2.25 -2.57,-1.3 -4.16,-2.81 -12.2,-11.6 -4.19,-4.58 -25.41,-27.62 -47.15,-51.2 -73.9,-80.15 -92.94,-100.8 -109.6,-118.88 -9.15,-9.93 -27.87,-30.23 -41.6,-45.12C231.23,249.76 217.12,234.45 213.6,230.62c-4.68,-5.09 -6.67,-7.03 -7.4,-7.23 -2.07,-0.58 -5.15,0.57 -6.21,2.3 -0.62,1.01 -0.62,2.41 -0.62,101.98 0,99.66 0.01,100.97 0.63,101.99 1.09,1.78 4.27,2.99 6.2,2.35 0.82,-0.27 5.7,-5.37 20.84,-21.8 10.87,-11.79 20.39,-21.99 21.15,-22.66 1.94,-1.71 4.79,-3.15 7.68,-3.89 2.3,-0.59 3.59,-0.63 18.78,-0.63h16.31l1.21,1.21c1.63,1.63 2.5,4.42 1.86,5.99 -0.24,0.59 -7.73,8.97 -16.91,18.92 -18.82,20.39 -45.98,49.88 -59.79,64.91 -13.19,14.35 -14.75,15.9 -17.35,17.27 -4.27,2.25 -5.61,2.41 -18.99,2.38 -9.97,-0.02 -12.1,-0.11 -13.31,-0.53z" />
</vector>

View File

@@ -1,25 +1,31 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="96dp"
android:height="96dp"
android:viewportWidth="96"
android:viewportHeight="96">
android:viewportWidth="25.4"
android:viewportHeight="25.4">
<path
android:fillColor="#000000"
android:pathData="m43.703,21.153a2.562,2.562 0,0 1,-0.193 0.169c0.112,-0.017 0.242,-0.011 0.356,-0.027a2.562,2.562 0,0 1,-0.163 -0.142zM51.619,21.34a2.562,2.562 0,0 1,-0.145 0.096c0.084,0.014 0.176,0.019 0.259,0.033a2.562,2.562 0,0 1,-0.115 -0.13zM22.448,24.643A41.674,38.064 0,0 0,6.326 54.715,41.674 38.064,0 0,0 48,92.778 41.674,38.064 0,0 0,89.674 54.715,41.674 38.064,0 0,0 74.028,24.989c-2.769,1.727 -5.538,2.367 -8.088,3.119A2.562,2.562 0,0 1,64.384 27.988c2.579,2.775 3.779,5.491 3.779,5.491a2.562,2.562 0,0 1,-2.351 3.466c-3.918,0.074 -7.789,-0.365 -11.328,-1.986 -2.626,-1.203 -4.872,-3.337 -6.838,-5.961 -5.06,5.243 -11.259,7.985 -17.979,8.534a2.562,2.562 0,0 1,-2.61 -3.447c0,0 1.303,-3.494 4.538,-6.801 0.111,-0.113 0.273,-0.218 0.389,-0.331a2.562,2.562 0,0 1,-0.368 0.163c-3.53,-0.053 -6.551,-0.997 -9.17,-2.471z"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeLineJoin="round" />
android:pathData="m8.002,10.249c1.354,-0.088 2.737,-0.434 3.833,-1.264 0.29,-0.236 0.562,-0.494 0.777,-0.802 0.516,0.77 1.353,1.261 2.205,1.58 0.923,0.323 1.901,0.504 2.879,0.495 0.359,-0.014 0.431,-0.463 0.291,-0.727C17.758,8.836 17.353,8.213 16.863,7.673 17.738,7.535 18.607,7.235 19.296,6.662 19.793,6.269 20.231,5.797 20.566,5.259 20.694,4.952 20.454,4.658 20.146,4.62 19.33,4.418 18.489,4.326 17.649,4.35 16.553,4.325 15.459,4.64 14.514,5.188 14.26,5.325 14.039,5.52 13.8,5.674 13.755,5.158 13.859,4.615 14.104,4.152 14.399,3.668 14.949,3.387 15.508,3.374 15.8,3.376 16.219,3.369 16.263,2.993 16.393,2.4 16.274,1.733 15.885,1.259 15.649,1.021 15.277,1.168 14.984,1.182 14.137,1.298 13.283,1.611 12.686,2.248 12.199,2.744 11.899,3.388 11.734,4.058 11.602,4.562 11.54,5.08 11.478,5.596 10.547,4.84 9.362,4.428 8.171,4.357 7.435,4.337 6.692,4.331 5.967,4.483 5.63,4.56 5.258,4.565 4.959,4.752 4.63,4.986 4.882,5.389 5.077,5.619 5.768,6.559 6.782,7.264 7.918,7.543 8.088,7.623 8.605,7.592 8.263,7.825 7.758,8.367 7.401,9.037 7.164,9.736 7.139,10.27 7.588,10.291 8.002,10.249Z"
android:strokeWidth="0.0153039" />
<path
android:fillColor="#000000"
android:pathData="M59.132,3.222C44.223,4.02 43.871,13.569 44.908,19.578l5.365,0.129C52.013,15.381 50.024,9.674 61.717,9.04c0,-2.399 0.111,-4.904 -2.585,-5.818zM68.267,14.779C62.769,14.516 56.573,15.456 53.784,20.256l11.431,5.395c4.907,-1.447 8.898,-1.794 13.348,-9.144 0,0 -4.799,-1.465 -10.296,-1.728zM26.572,15.03c-5.292,0.217 -9.638,1.476 -9.638,1.476 3.724,4.456 8.092,7.946 14.721,8.046 2.54,-2.895 6.253,-4.035 10.243,-4.756 -3.795,-4.16 -10.035,-4.983 -15.327,-4.766zM47.886,23.546C33.896,23.043 29.462,34.978 29.462,34.978c7.162,-0.585 13.455,-3.491 18.425,-9.922 3.986,7.619 10.498,9.467 17.879,9.327 0,0 -3.889,-10.333 -17.879,-10.836z"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeLineJoin="round" />
android:pathData="m13.412,24.26c1.875,-0.119 3.705,-0.731 5.285,-1.745 2.117,-1.351 3.754,-3.496 4.312,-5.961 0.66,-2.74 -0.089,-5.766 -1.925,-7.9 -0.474,-0.556 -1.448,-1.458 -1.643,-1.511 -0.363,0.197 -0.61,0.469 -1.718,0.835 0.334,0.453 0.689,1.242 0.794,1.762 0.087,0.552 -0.437,1.076 -0.989,0.987 -1.466,-0.074 -3.409,-0.359 -4.92,-1.797C11.173,10.306 9.372,10.675 7.538,10.73 6.954,10.726 6.525,10.067 6.75,9.53 6.921,8.958 7.228,8.448 7.538,7.948 6.996,7.719 6.45,7.481 5.965,7.143 3.961,8.557 2.577,10.829 2.25,13.263c-0.265,1.738 0.037,3.551 0.789,5.135 0.721,1.559 1.903,2.88 3.3,3.869 1.634,1.157 3.586,1.845 5.583,1.98 0.495,0.046 0.995,0.024 1.49,0.013z"
android:strokeWidth="0.0153039" />
</vector>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#e3e3e3"
android:pathData="M159,800q-17,0 -28,-11.5T120,760q0,-17 11.5,-28.5T160,720h641q17,0 28,11.5t11,28.5q0,17 -11.5,28.5T800,800L159,800ZM200,640q-33,0 -56.5,-23.5T120,560v-160q0,-33 23.5,-56.5T200,320h560q33,0 56.5,23.5T840,400v160q0,33 -23.5,56.5T760,640L200,640ZM159,240q-17,0 -28,-11.5T120,200q0,-17 11.5,-28.5T160,160h641q17,0 28,11.5t11,28.5q0,17 -11.5,28.5T800,240L159,240Z" />
</vector>

View File

@@ -0,0 +1,26 @@
<!--
~ Copyright (c) 2025 Nishant Mishra
~
~ This file is part of Tomato - a minimalist pomodoro timer for Android.
~
~ Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
~ General Public License as published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
~ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
~ Public License for more details.
~
~ You should have received a copy of the GNU General Public License along with Tomato.
~ If not, see <https://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M14.234,10.162 L22.977,0h-2.072l-7.591,8.824L7.251,0L0.258,0l9.168,13.343L0.258,24L2.33,24l8.016,-9.318L16.749,24h6.993zM11.397,13.461 L10.468,12.132L3.076,1.56h3.182l5.965,8.532 0.929,1.329 7.754,11.09h-3.182z" />
</vector>

Binary file not shown.

View File

@@ -73,6 +73,6 @@
<string name="choose_language">Sprache wählen</string>
<string name="rate_on_google_play">Im Play Store bewerten</string>
<string name="selected">Ausgewählt</string>
<string name="help_with_translation">Bei der Übersetzung helfen</string>
<string name="help_with_translation">Hilf beim Übersetzen</string>
<string name="timer_settings_reset_info">Den Timer zurücksetzen um Einstellungen zu ändern</string>
</resources>

View File

@@ -3,13 +3,13 @@
<string name="start">Iniciar</string>
<string name="stop">Detener</string>
<string name="focus">Concentración</string>
<string name="short_break">Pequeño descanso</string>
<string name="long_break">Descanso extenso</string>
<string name="short_break">Descanso corto</string>
<string name="long_break">Descanso largo</string>
<string name="exit">Salir</string>
<string name="skip">Omitir</string>
<string name="stop_alarm">Parar alarma</string>
<string name="paused">En pausa</string>
<string name="system_default">Predeterminado del sistema</string>
<string name="system_default">Sistema</string>
<string name="alarm">Alarma</string>
<string name="choose_theme">Elige tema</string>
<string name="productivity_analysis">Análisis de productividad</string>
@@ -18,7 +18,7 @@
<string name="black_theme">Tema negro</string>
<string name="black_theme_desc">Utilizar un tema oscuro negro puro</string>
<string name="alarm_desc">Sonar alarma cuando el temporizador finalice</string>
<string name="vibrate">Vibrar</string>
<string name="vibrate">Vibración</string>
<string name="vibrate_desc">Vibrar cuando el temporizador finalice</string>
<string name="theme">Tema</string>
<string name="settings">Configuración</string>
@@ -29,12 +29,12 @@
<string name="today">Hoy</string>
<string name="break_">Descanso</string>
<string name="last_week">Semana pasada</string>
<string name="focus_per_day_avg">concentración por día (avg)</string>
<string name="focus_per_day_avg">concentración por día (promedio)</string>
<string name="more_info">Más información</string>
<string name="weekly_productivity_analysis">Análisis de productividad semanal</string>
<string name="last_month">Mes pasado</string>
<string name="monthly_productivity_analysis">Análisis de productividad mensual</string>
<string name="stop_alarm_question">Parar alarma?</string>
<string name="stop_alarm_question">¿Parar Alarma?</string>
<string name="stop_alarm_dialog_text">La sesión actual del temporizador ha finalizado. Toque en cualquier lugar para detener la alarma.</string>
<string name="timer_session_count">%1$d de %2$d</string>
<string name="more">Más</string>
@@ -54,7 +54,24 @@
<string name="color_scheme">Esquema de colores</string>
<string name="dynamic">Dinámica</string>
<string name="color">Color</string>
<string name="light">Luz</string>
<string name="light">Claro</string>
<string name="dark">Oscuro</string>
<string name="last_year">Año pasado</string>
<string name="appearance">Apariencia</string>
<string name="durations">Duraciones</string>
<string name="sound">Sonido</string>
<string name="dnd">No Molestar</string>
<string name="get_plus">Obtener Tomato+</string>
<string name="dynamic_color">Color dinámico</string>
<string name="dynamic_color_desc">Adapta los colores del tema a tu fondo de pantalla</string>
<string name="language">Idioma</string>
<string name="choose_language">Seleccionar idioma</string>
<string name="selected">Seleccionado</string>
<string name="help_with_translation">Ayudar con la traducción</string>
<string name="always_on_display">Always On Display</string>
<string name="always_on_display_desc">Toca en cualquier lugar mientras ves el temporizador para cambiar al modo AOD</string>
<string name="dnd_desc">Activar NM al ejecutar un temporizador de concentración</string>
<string name="tomato_foss_desc">Todas las funciones están desbloqueadas en esta versión. Si mi aplicación ha marcado una diferencia en tu vida, por favor, considera apoyarme donando en %1$s.</string>
<string name="rate_on_google_play">Valorar en Google Play</string>
<string name="timer_settings_reset_info">Reinicia el temporizador para cambiar la configuración</string>
</resources>

View File

@@ -1,3 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<string name="alarm">هشدار</string>
<string name="alarm_desc">زنگ هشدار هنگام پایان تایمر</string>
<string name="alarm_sound">صدای زنگ</string>
<string name="always_on_display">نمایشگر همیشه روشن</string>
<string name="always_on_display_desc">روی هر نقطه هنگام مشاهده تایمر ضربه بزنید تا به حالت نمایشگر همیشه روشن (AOD) بروید</string>
</resources>

View File

@@ -74,6 +74,11 @@
<string name="choose_language">Choisissez la langue</string>
<string name="rate_on_google_play">Noter sur Google Play</string>
<string name="selected">Selectionné</string>
<string name="help_with_translation">Aider pour la traduction</string>
<string name="help_with_translation">Aider à traduire Tomato</string>
<string name="timer_settings_reset_info">Réinitialiser le timer pour pouvoir changer les paramètres</string>
<string name="bmc_desc">Soutenez-moi avec un petit don</string>
<string name="tomato_plus_desc">Personnalisez plus avec Tomato+</string>
<string name="about">A propos</string>
<string name="help_with_translation_desc">Traduire Tomato dans votre langue</string>
<string name="rate_on_google_play_desc">Vous aimez l\'appli? Écrivez un avis!</string>
</resources>

View File

@@ -68,10 +68,19 @@
<string name="language">言語</string>
<string name="choose_language">言語選択</string>
<string name="rate_on_google_play">Google Play で評価</string>
<string name="help_with_translation">翻訳を支援</string>
<string name="help_with_translation">Tomato の翻訳を手伝う</string>
<string name="timer_settings_reset_info">設定を変更するにはタイマーをリセットしてください</string>
<string name="selected">選択中</string>
<string name="always_on_display_desc">タイマー表示中に常時表示ディスプレイに切り替えるには任意の場所をタップしてください</string>
<string name="dnd_desc">タイマーの実行時にサイレントモードをオンにします</string>
<string name="tomato_foss_desc">全機能がこのバージョンでは解放されています。私のアプリが生活に変化をもたらしたのであれば、%1$s で寄付することで私を支援することをご検討ください。</string>
<string name="hours_and_minutes_format">%d時%d分</string>
<string name="hours_format">%d時</string>
<string name="minutes_format">%d分</string>
<string name="about">について</string>
<string name="help_with_translation_desc">Tomato をあなたの言語に翻訳してください</string>
<string name="rate_on_google_play_desc">アプリが気に入りましたか?レビューを書いてください!</string>
<string name="bmc_desc">小さな寄付でご支援してもよろしいでしょうか</string>
<string name="tomato_plus_desc">Tomato+ を使用してさらにカスタマイズする</string>
<string name="license">ライセンス</string>
</resources>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="alarm">Wawā</string>
<string name="alarm_desc">Whakatangihia te wawā inā mutu te kaitaki</string>
<string name="alarm_sound">Reo wawā</string>
<string name="always_on_display">Mata Kikimo-Kore</string>
<string name="always_on_display_desc">I te kitenga mai o te kaitaki, pāngia te mata (ki whea nei) kia tīmata a MKK</string>
<string name="black_theme">Mata pango</string>
<string name="black_theme_desc">Kia pango noa atu te āhua mata</string>
<string name="break_">Whakatā</string>
<string name="choose_color_scheme">Whiriwhiria ngā tae</string>
<string name="choose_theme">Whiriwhiria te momo āhua</string>
<string name="color">Tae</string>
<string name="color_scheme">Ngā tae</string>
<string name="completed">Kua oti</string>
<string name="dark">Uriuri</string>
<string name="dynamic">Whitiwhiti</string>
<string name="exit">Puta atu</string>
<string name="focus">Arotahi</string>
<string name="focus_per_day_avg">Wā arotahi ia rā (toharite)</string>
<string name="last_month">I tērā marama</string>
<string name="last_week">I tērā wiki</string>
<string name="last_year">I tērā tau</string>
<string name="light">Teatea</string>
<string name="long_break">Whakatā nui</string>
<string name="min_remaining_notification">%1$s meneti e toe ana</string>
<string name="monthly_productivity_analysis">Ripōata huanga ā-marama</string>
<string name="more">Nui ake</string>
<string name="more_info">Whakamārama tonu</string>
<string name="ok">KtP</string>
<string name="pause">Taihoa</string>
<string name="paused">Kua tū</string>
<string name="play">Whakakā</string>
<string name="pomodoro_info">Ko te \"huringa\" ko ētehi wā e takingia - he wāhanga arotahi, he wāhanga whakatā poto, ā, he wāhanga hoki o taua wā e whai whakatā nui ai te tangata. Ko te wā o te whakatā nui te wāhanga whakamutunga o te huringa.</string>
<string name="productivity_analysis">Ripōata huanga</string>
<string name="productivity_analysis_desc">Ko te arotahitanga i tēnā, i tēnā wā o te rā</string>
<string name="restart">Tīmata anō</string>
<string name="session_length">Ko te roa o te huringa</string>
<string name="session_length_desc">Wā arotahi i te huringa kotahi: %1$d</string>
<string name="settings">Tautuhinga</string>
<string name="short_break">Whakatā poto</string>
<string name="skip">Hipa</string>
<string name="skip_to_next">Whanake atu</string>
<string name="start">Tīmata</string>
<string name="start_next">Wāhanga whai muri</string>
<string name="stats">Ngā tatauranga</string>
<string name="stop">Whakamutua</string>
<string name="stop_alarm">Whakamutua te wawā</string>
<string name="help_with_translation">Tautokona te whakawhiti reo ki Tomato</string>
<string name="timer_settings_reset_info">Whakahoua te kaitaki ki te tīni tautuhinga</string>
<string name="stop_alarm_dialog_text">Kua mutu te huringa. Pāngia te mata kia mutu te wawā.</string>
<string name="stop_alarm_question">Whakamutua te wāwā?</string>
<string name="system_default">Pūnaha</string>
<string name="theme">Āhua ā-Kano</string>
<string name="timer">Kaitaki</string>
<string name="timer_progress">Haerenga ā-kaitaki</string>
<string name="timer_session_count">%1$d o %2$d</string>
<string name="today">Tēnei rā</string>
<string name="up_next">E whai mai ana</string>
<string name="up_next_notification">Whai muri mai: %1$s (%2$s)</string>
<string name="vibrate">Ngatari</string>
<string name="vibrate_desc">Ka ngatari inā mutu te kaitaki</string>
<string name="weekly_productivity_analysis">Ripōata huanga ā-wiki</string>
<string name="appearance">Āhua</string>
<string name="durations">Wāhanga</string>
<string name="sound">Oro</string>
<string name="dnd">Kaua e Whakakotiti</string>
<string name="dnd_desc">Whakatūria a Kaua e Whakakotiti i te wā Arotahi</string>
<string name="get_plus">Tikiakegia Tomato+</string>
<string name="dynamic_color">Tae whitiwhiti</string>
<string name="dynamic_color_desc">Whāia ngā tae o tāu mata waea</string>
<string name="tomato_foss_desc">Kua wātea ngā āheinga katoa ki tēnei putanga. Mēnā he mea whai āwhina i tō ao, tēnā, whakaarohia te tuku koha ki %1$s.</string>
<string name="language">Reo</string>
<string name="choose_language">Whiriwhiri reo</string>
<string name="rate_on_google_play">Tohu kounga ki Google Play</string>
<string name="selected">Kua whiriwhiria</string>
<string name="hours_and_minutes_format">%dh %dm</string>
<string name="hours_format">%dh</string>
<string name="minutes_format">%dm</string>
<string name="about">Mō mātou</string>
<string name="help_with_translation_desc">Whakawhitia a Tomato ki tō reo</string>
<string name="rate_on_google_play_desc">Pai te taupāngā? Tuhia āu whakaaro!</string>
<string name="bmc_desc">Tautokona au ki te paku koha</string>
<string name="tomato_plus_desc">He whakahāngaitanga anō ki Tomato+</string>
</resources>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="alarm">хонх</string>
<string name="alarm_desc">Цаг хэмжигч дуусахад хонх дуугаргах</string>
<string name="alarm_sound">Хонхны дуу</string>
<string name="always_on_display">Үргэлж дэлгэц дээр</string>
<string name="appearance">гадаад төрх</string>
<string name="black_theme">Хар загвар</string>
<string name="break_">Завсарлага</string>
<string name="choose_color_scheme">Өнгөний схемийг сонгоно уу</string>
<string name="choose_language">Хэл сонгох</string>
<string name="choose_theme">загвар сонгох</string>
<string name="color">өнгө</string>
<string name="color_scheme">Өнгөний схем</string>
<string name="completed">Дууссан</string>
<string name="dark">Харанхуй</string>
<string name="dnd">Бүү саад бол горим</string>
<string name="durations">хугацаа</string>
<string name="dynamic">Динамик</string>
<string name="dynamic_color">Динамик өнгө</string>
<string name="exit">Гарах</string>
<string name="focus">анхаарлаа төвлөрүүлэх</string>
</resources>

View File

@@ -15,7 +15,7 @@
<string name="completed">Ukończono</string>
<string name="dark">Ciemny</string>
<string name="dynamic">Dynamiczna</string>
<string name="exit">Wyjść</string>
<string name="exit">Wyj</string>
<string name="focus">Skupienie</string>
<string name="focus_per_day_avg">skupienia w ciągu dnia (średnio)</string>
<string name="last_month">Ostatni miesiąc</string>
@@ -23,12 +23,12 @@
<string name="last_year">Ostatni rok</string>
<string name="light">Jasny</string>
<string name="long_break">Długa przerwa</string>
<string name="min_remaining_notification">%1$s minut pozostało</string>
<string name="min_remaining_notification">pozostało %1$s min</string>
<string name="more">Więcej</string>
<string name="more_info">Więcej informacji</string>
<string name="ok">Ok</string>
<string name="pause">Wstrzymaj</string>
<string name="paused">Wstzymano</string>
<string name="paused">Wstrzymano</string>
<string name="monthly_productivity_analysis">Analiza miesięcznego czasu produktywności</string>
<string name="play">Wznów</string>
<string name="productivity_analysis">Analiza produktywności</string>
@@ -37,13 +37,13 @@
<string name="settings">Ustawienia</string>
<string name="short_break">Krótka przerwa</string>
<string name="skip">Pomiń</string>
<string name="start">Zacznij</string>
<string name="start">Wznów</string>
<string name="stats">Statystyki</string>
<string name="stop">Zakończ</string>
<string name="stop">Zatrzymaj</string>
<string name="stop_alarm">Wyłącz alarm</string>
<string name="stop_alarm_dialog_text">Sesja ukończona, kliknij gdziekolwiek, aby zatrzymać alarm.</string>
<string name="stop_alarm_dialog_text">Sesja ukończona. Kliknij gdziekolwiek, aby zatrzymać alarm.</string>
<string name="stop_alarm_question">Zatrzymać alarm?</string>
<string name="system_default">System</string>
<string name="system_default">Systemowy</string>
<string name="theme">Motyw</string>
<string name="timer">Timer</string>
<string name="today">Dziś</string>
@@ -53,17 +53,34 @@
<string name="vibrate_desc">Wibruje gdy timer się zakończy</string>
<string name="weekly_productivity_analysis">Tygodniowa analiza czasu produktywności</string>
<string name="appearance">Wygląd</string>
<string name="durations">Długość</string>
<string name="sound">Dzwięk</string>
<string name="durations">Długość interwałów</string>
<string name="sound">Dźwięk</string>
<string name="dnd">Nie przeszkadzać</string>
<string name="dnd_desc">Włącz tryb nie przeszkadzać podczas sesji skupienia</string>
<string name="dnd_desc">Włącz tryb Nie przeszkadzać podczas sesji skupienia</string>
<string name="language">Język</string>
<string name="selected">Zaznaczone</string>
<string name="dynamic_color">Dynamiczny kolor</string>
<string name="choose_language">Wybierz język</string>
<string name="skip_to_next">Przejdź do następnego</string>
<string name="timer_session_count">%1$d z %2$d</string>
<string name="help_with_translation">Pomóż w tłumaczeniu aplikacji</string>
<string name="help_with_translation">Pomóż przetłumaczyć Tomato</string>
<string name="rate_on_google_play">Wystaw ocenę na Google Play</string>
<string name="dynamic_color_desc">Dostosuj kolory motywu do swojej tapety</string>
<string name="get_plus">Uzyskaj wersję Tomato+</string>
<string name="hours_and_minutes_format">%dg %dm</string>
<string name="hours_format">%dg</string>
<string name="minutes_format">%dm</string>
<string name="pomodoro_info">„Sesja” to szereg interwałów pomodoro, który obejmuje interwały skupienia, krótkie przerwy i długą przerwę. Ostatnia przerwa w sesji to zawsze długa przerwa.</string>
<string name="session_length_desc">Liczba interwałów skupienia w sesji: %1$d</string>
<string name="productivity_analysis_desc">Czas spędzony w skupieniu o różnych porach dnia</string>
<string name="timer_progress">Postęp timera</string>
<string name="timer_settings_reset_info">Zresetuj timer, aby zmienić ustawienia</string>
<string name="tomato_foss_desc">W tej wersji wszystkie funkcje są odblokowane. Jeśli moja aplikacja zmieniła Twoje życie, rozważ wsparcie mnie poprzez darowiznę na %1$s.</string>
<string name="about">O aplikacji</string>
<string name="help_with_translation_desc">Przetłumacz Tomato na swój język</string>
<string name="rate_on_google_play_desc">Podoba Ci się aplikacja? Napisz recenzję!</string>
<string name="bmc_desc">Wesprzyj mnie niewielką darowizną</string>
<string name="tomato_plus_desc">Dodatkowe możliwości z Tomato+</string>
<string name="license">Licencja</string>
<string name="start_next">Rozpocznij następny</string>
</resources>

View File

@@ -73,6 +73,15 @@
<string name="choose_language">Dil seç</string>
<string name="rate_on_google_play">Google Play\'de değerlendir</string>
<string name="selected">Seçilen</string>
<string name="help_with_translation">Çeviriye yardım edin</string>
<string name="help_with_translation">Tomato\'nun çevirisine yardım edin</string>
<string name="timer_settings_reset_info">Ayarları değiştirmek için zamanlayıcıyı sıfırlayın</string>
<string name="hours_and_minutes_format">%dsa %ddk</string>
<string name="hours_format">%dsa</string>
<string name="minutes_format">%ddk</string>
<string name="about">Hakkında</string>
<string name="help_with_translation_desc">Tomato\'yu kendi dilinize çevirin</string>
<string name="rate_on_google_play_desc">Uygulamayı beğendinizmi? Bir yorum bırakın!</string>
<string name="bmc_desc">Beni küçük bir bağışla destekleyin</string>
<string name="tomato_plus_desc">Tomato+ ile daha fazla özelleştirin</string>
<string name="license">Lisans</string>
</resources>

View File

@@ -75,5 +75,13 @@
<string name="rate_on_google_play">Оцінити на Google Play</string>
<string name="selected">Обрано</string>
<string name="timer_settings_reset_info">Перезапустіть таймер, щоб змінити налаштування</string>
<string name="help_with_translation">Допомога з перекладом</string>
<string name="help_with_translation">Допомогти з перекладом Tomato</string>
<string name="hours_and_minutes_format">%dгод %dхв</string>
<string name="hours_format">%dгод</string>
<string name="minutes_format">%dхв</string>
<string name="about">Відомості</string>
<string name="help_with_translation_desc">Перекладіть Tomato на Вашу мову</string>
<string name="rate_on_google_play_desc">Сподобався додаток? Напишіть відгук!</string>
<string name="bmc_desc">Підтримайте мене невеликим пожертвуванням</string>
<string name="tomato_plus_desc">Налаштуйте ще більше з Tomato+</string>
</resources>

View File

@@ -75,4 +75,13 @@
<string name="selected">已选中</string>
<string name="help_with_translation">帮忙翻译</string>
<string name="timer_settings_reset_info">重置定时器来更改设置</string>
<string name="hours_and_minutes_format">%1$d 小时 %2$d 分钟</string>
<string name="hours_format">%1$d 小时</string>
<string name="minutes_format">%1$d 分钟</string>
<string name="about">关于</string>
<string name="help_with_translation_desc">将 Tomato 翻译成你的语言</string>
<string name="rate_on_google_play_desc">喜欢本应用?写一条评价吧!</string>
<string name="bmc_desc">小额捐赠支持</string>
<string name="tomato_plus_desc">用 Tomato+ 进一步定制</string>
<string name="license">许可证</string>
</resources>

View File

@@ -22,25 +22,40 @@
<string name="always_on_display">Always On Display</string>
<string name="always_on_display_desc">Tap anywhere when viewing the timer to switch to AOD mode</string>
<string name="app_name">Tomato</string>
<string name="app_name_plus">Tomato+</string>
<string name="appearance">Appearance</string>
<string name="black_theme">Black theme</string>
<string name="black_theme_desc">Use a pure black dark theme</string>
<string name="bmc">BuyMeACoffee</string>
<string name="break_">Break</string>
<string name="choose_color_scheme">Choose color scheme</string>
<string name="choose_language">Choose language</string>
<string name="choose_theme">Choose theme</string>
<string name="color">Color</string>
<string name="color_scheme">Color scheme</string>
<string name="completed">Completed</string>
<string name="dark">Dark</string>
<string name="dnd">Do Not Disturb</string>
<string name="dnd_desc">Turn on DND when running a Focus timer</string>
<string name="durations">Durations</string>
<string name="dynamic">Dynamic</string>
<string name="dynamic_color">Dynamic color</string>
<string name="dynamic_color_desc">Adapt theme colors from your wallpaper</string>
<string name="exit">Exit</string>
<string name="focus">Focus</string>
<string name="focus_per_day_avg">focus per day (avg)</string>
<string name="get_plus">Get Tomato+</string>
<string name="help_with_translation">Help translate Tomato</string>
<string name="hours_and_minutes_format">%1$dh %2$dm</string>
<string name="hours_format">%1$dh</string>
<string name="language">Language</string>
<string name="last_month">Last month</string>
<string name="last_week">Last week</string>
<string name="last_year">Last year</string>
<string name="light">Light</string>
<string name="long_break">Long break</string>
<string name="min_remaining_notification">%1$s min remaining</string>
<string name="minutes_format">%1$dm</string>
<string name="monthly_productivity_analysis">Monthly productivity analysis</string>
<string name="more">More</string>
<string name="more_info">More info</string>
@@ -51,13 +66,16 @@
<string name="pomodoro_info">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.</string>
<string name="productivity_analysis">Productivity analysis</string>
<string name="productivity_analysis_desc">Focus durations at different times of the day</string>
<string name="rate_on_google_play">Rate on Google Play</string>
<string name="restart">Restart</string>
<string name="selected">Selected</string>
<string name="session_length">Session length</string>
<string name="session_length_desc">Focus intervals in one session: %1$d</string>
<string name="settings">Settings</string>
<string name="short_break">Short break</string>
<string name="skip">Skip</string>
<string name="skip_to_next">Skip to next</string>
<string name="sound">Sound</string>
<string name="start">Start</string>
<string name="start_next">Start next</string>
<string name="stats">Stats</string>
@@ -70,28 +88,23 @@
<string name="timer">Timer</string>
<string name="timer_progress">Timer progress</string>
<string name="timer_session_count">%1$d of %2$d</string>
<string name="timer_settings_reset_info">Reset the timer to change settings</string>
<string name="today">Today</string>
<string name="tomato_foss">Tomato FOSS</string>
<string name="tomato_foss_desc">All features are unlocked in this version. If my app made a difference in your life, please consider supporting me by donating on %1$s.</string>
<string name="up_next">Up next</string>
<string name="up_next_notification">Up next: %1$s (%2$s)</string>
<string name="vibrate">Vibration</string>
<string name="vibrate_desc">Vibrate when a timer completes</string>
<string name="weekly_productivity_analysis">Weekly productivity analysis</string>
<string name="appearance">Appearance</string>
<string name="durations">Durations</string>
<string name="sound">Sound</string>
<string name="dnd">Do Not Disturb</string>
<string name="dnd_desc">Turn on DND when running a Focus timer</string>
<string name="app_name_plus">Tomato+</string>
<string name="get_plus">Get Tomato+</string>
<string name="dynamic_color">Dynamic color</string>
<string name="dynamic_color_desc">Adapt theme colors from your wallpaper</string>
<string name="tomato_foss">Tomato FOSS</string>
<string name="tomato_foss_desc">All features are unlocked in this version. If my app made a difference in your life, please consider supporting me by donating on %1$s.</string>
<string name="language">Language</string>
<string name="choose_language">Choose language</string>
<string name="rate_on_google_play">Rate on Google Play</string>
<string name="bmc">BuyMeACoffee</string>
<string name="selected">Selected</string>
<string name="help_with_translation">Help with translation</string>
<string name="timer_settings_reset_info">Reset the timer to change settings</string>
<string name="about">About</string>
<string name="help_with_translation_desc">Translate Tomato into your language</string>
<string name="rate_on_google_play_desc">Liked the app? Write a review!</string>
<string name="bmc_desc">Support me with a small donation</string>
<string name="tomato_plus_desc">Customize further with Tomato+</string>
<string name="license">License</string>
<string name="media_volume_for_alarm">Headphone mode</string>
<string name="media_volume_for_alarm_desc">Plays on headphones only. If headphones are disconnected, alarm plays through speaker at media volume.</string>
<string name="session_only_progress">Session-only progress</string>
<string name="session_only_progress_desc">Show progress for the current session only in notifications, rather than the full sequence.</string>
</resources>

View File

@@ -17,17 +17,12 @@
package org.nsh07.pomodoro.ui.settingsScreen.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.painterResource
@@ -37,56 +32,43 @@ import org.nsh07.pomodoro.R
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun TopButton(
buttonColors: ButtonColors,
modifier: Modifier = Modifier
) {
fun TopButton(modifier: Modifier = Modifier) {
val uriHandler = LocalUriHandler.current
Button(
colors = buttonColors,
onClick = { uriHandler.openUri("https://hosted.weblate.org/engage/tomato/") },
shapes = ButtonDefaults.shapes(),
modifier = modifier
) {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
ClickableListItem(
leadingContent = {
Icon(
painterResource(R.drawable.weblate),
tint = colorScheme.primary,
contentDescription = null,
modifier = Modifier.size(24.dp)
)
Text(text = stringResource(R.string.help_with_translation))
}
}
},
headlineContent = { Text(stringResource(R.string.help_with_translation)) },
supportingContent = { Text(stringResource(R.string.help_with_translation_desc)) },
trailingContent = { Icon(painterResource(R.drawable.open_in_browser), null) },
items = 2,
index = 0,
modifier = modifier
) { uriHandler.openUri("https://hosted.weblate.org/engage/tomato/") }
}
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun BottomButton(
buttonColors: ButtonColors,
modifier: Modifier = Modifier
) {
fun BottomButton(modifier: Modifier = Modifier) {
val uriHandler = LocalUriHandler.current
Button(
colors = buttonColors,
onClick = { uriHandler.openUri("https://play.google.com/store/apps/details?id=org.nsh07.pomodoro") },
shapes = ButtonDefaults.shapes(),
modifier = modifier
) {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
ClickableListItem(
leadingContent = {
Icon(
painterResource(R.drawable.play_store),
tint = colorScheme.secondary,
contentDescription = null,
modifier = Modifier.size(24.dp)
)
Text(text = stringResource(R.string.rate_on_google_play))
}
}
},
headlineContent = { Text(stringResource(R.string.rate_on_google_play)) },
supportingContent = { Text(stringResource(R.string.rate_on_google_play_desc)) },
items = 2,
index = 1,
modifier = modifier
) { uriHandler.openUri("https://play.google.com/store/apps/details?id=org.nsh07.pomodoro") }
}

View File

@@ -1,12 +1,23 @@
/*
* Copyright (c) 2025 Nishant Mishra
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* This file is part of Tomato - a minimalist pomodoro timer for Android.
*
* Tomato is free software: you can redistribute it and/or modify it under the terms of the GNU
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Tomato is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tomato.
* If not, see <https://www.gnu.org/licenses/>.
*/
package org.nsh07.pomodoro.utils
import androidx.compose.ui.graphics.Color
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertTrue
import org.junit.Assert.assertThrows
@@ -162,4 +173,23 @@ class UtilsKtTest {
assertEquals("2562047788015h 12m", millisecondsToHoursMinutes(Long.MAX_VALUE))
}
@Test
fun `toColor with a standard valid color string`() {
assertEquals(Color.Black.toString().toColor(), Color.Black)
}
@Test
fun `toColor with color components at maximum valid values`() {
assertEquals(Color.White.toString().toColor(), Color.White)
}
@Test
fun `toColor with floating point values having multiple decimal places`() {
assertEquals(
Color(0.12345f, 0.23456f, 0.34567f, 0.45678f)
.toString()
.toColor(),
Color(0.12345f, 0.23456f, 0.34567f, 0.45678f)
)
}
}

View File

@@ -0,0 +1,12 @@
New features:
- New app icon
- New redesigned navigation bar with new animations
- The clock now uses a new font
- New clutter-free settings screen
- New option to only play alarm on headphones if connected
- New option to only show current session's progress (Android 16+ only)
Fixes:
- Significantly improved stats saving system
- AOD movement is now more subtle
- Navigation bar colors now reflect the current mode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 707 KiB

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 KiB

After

Width:  |  Height:  |  Size: 707 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 KiB

View File

@@ -1 +1,12 @@
<p><i>Tomato</i> es un temporizador Pomodoro minimalista para Android basado en "Material 3 Expressive". </p><p><br><b>Características:</b></p><ul><li>Interfaz de usuario sencilla y minimalista basada en las últimas directrices de "Material 3 Expressive".</li><li>Estadísticas detalladas e intuitivas en los tiempos de trabajo/estudio.<ul><li>Estadísticas simples y accesibles del día en curso.</li><li>Estadísticas de la última semana y del último mes mostradas en un gráfico sencillo.</li><li>Estadísticas adicionales de la última semana y del último mes que muestran a qué hora del día eres más productivo.</li></ul></li><li>Parámetros de temporizador personalizables.</li></ul>
<i>Tomato</i> es un temporizador Pomodoro minimalista para Android basado en Material 3 Expressive.
Tomato es totalmente gratuito y de código abierto, para siempre. Puedes encontrar el código fuente e informar de errores o sugerir funciones en https://github.com/nsh07/Tomato.
<b>Características:</b>
- Interfaz de usuario sencilla y minimalista basada en las últimas directrices de Material 3 Expressive.
- Estadísticas detalladas de los tiempos de trabajo/estudio de forma fácil de entender
- Estadísticas del día actual visibles de un vistazo
- Estadísticas de la última semana y del último mes mostradas en un gráfico claro y fácil de leer
- Estadísticas adicionales de la última semana y del último mes que muestran a qué hora del día eres más productivo
- Parámetros del temporizador personalizables
- Compatibilidad con las Actualizaciones en Directo de Android 16

View File

@@ -0,0 +1,13 @@
<i>Tomato</i> یک تایمر پومودورو مینیمالیستی برای اندروید است که بر پایه Material 3 Expressive ساخته شده است.
Tomato کاملاً رایگان و متن‌باز است، برای همیشه. می‌توانید سورس‌کد را مشاهده کرده و باگ‌ها را گزارش دهید یا ویژگی‌های جدید پیشنهاد کنید: https://github.com/nsh07/Tomato
<b>ویژگی‌ها:</b>
* رابط کاربری ساده و مینیمالیستی بر اساس آخرین راهنماهای Material 3 Expressive
* آمار دقیق زمان‌های کار/مطالعه به شکلی قابل فهم
- آمار مربوط به امروز در یک نگاه
- آمار مربوط به هفته و ماه گذشته در قالب نمودار تمیز و خوانا
- آمار تکمیلی برای هفته و ماه گذشته که نشان می‌دهد در چه زمانی از روز بیشترین بهره‌وری را دارید
* امکان شخصی‌سازی پارامترهای تایمر
* پشتیبانی از Android 16 Live Updates

View File

@@ -0,0 +1 @@
تایمر پومودرو مینیمال

View File

@@ -0,0 +1,12 @@
Ko <i>Tomato</i> tētehi kaitaki ā-Pomodoro māmā mā Android e whai ana i te tikanga hoahoa o Material 3 Expressive.
He mea “utu-kore, waehere-wātea” (FOSS) a Tomato, mō ake tonu. E taea ana te kite tōna waehere, te whakapānui ngāngara, me te inoi āheinga atu anō ki https://github.com/nsh07/Tomato
<b>Ōna āhuatanga:</b>
- Hoahoanga māmā e whai ana i te tikanga Material 3 Expressive o te wā
- He tatauranga o ngā wā mahi/ako e āta mārama ana
- He tatauranga mō te rā, e ngāwari ana te kite tere
- He tatauranga mō te wiki me te marama o muri, e horahia ki te kauwhata
- He whakamōhiotanga ā-tatauranga hoki nō te wiki me te marama o muri e pānui ana i ngā wā o te rā e tino pukumahi ai koe
- He tautuhina ā-kaitaki e taea te whakahāngai ki āu hiahia
- He tautoko i te Android 16 Live Updates

View File

@@ -0,0 +1 @@
Kaitaki Pomodoro māmā

View File

@@ -0,0 +1 @@
Минималист Помодорогийн техник

View File

@@ -0,0 +1,12 @@
<i>Tomato</i> to minimalistyczny timer Pomodoro dla systemu Android oparty na Material 3 Expressive.
Tomato jest całkowicie wolny i otwartoźródłowy, na zawsze. Kod źródłowy oraz możliwość zgłaszania błędów lub sugerowania nowych funkcji można znaleźć na stronie https://github.com/nsh07/Tomato
<b>Funkcje:</b>
- Prosty, minimalistyczny interfejs użytkownika oparty na najnowszych wytycznych Material 3 Expressive
- Szczegółowe statystyki czasu pracy/nauki przedstawione w przystępny sposób
- Statystyki za bieżący dzień widoczne na pierwszy rzut oka
- Statystyki za ostatni tydzień i ostatni miesiąc przedstawione w przejrzystym, czytelnym wykresie
- Dodatkowe statystyki za ostatni tydzień i miesiąc pokazujące, o której porze dnia jesteś najbardziej produktywny
- Konfigurowalne parametry timera
- Wsparcie dla Android 16 Live Updates

View File

@@ -1,8 +1,8 @@
[versions]
activityCompose = "1.12.0"
activityCompose = "1.12.1"
adaptive = "1.2.0"
agp = "8.13.1"
composeBom = "2025.11.01"
composeBom = "2025.12.00"
coreKtx = "1.17.0"
espressoCore = "3.7.0"
junit = "4.13.2"
@@ -12,7 +12,7 @@ ksp = "2.3.3"
lifecycleRuntimeKtx = "2.10.0"
materialKolor = "4.0.5"
navigation3 = "1.0.0"
revenuecat = "9.14.1"
revenuecat = "9.15.1"
room = "2.8.4"
vico = "2.3.6"