diff --git a/app/src/foss/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutButtons.kt b/app/src/foss/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutButtons.kt index 60f4dc2..e36d110 100644 --- a/app/src/foss/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutButtons.kt +++ b/app/src/foss/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutButtons.kt @@ -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/") } } \ No newline at end of file diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/mergePaddingValues.kt b/app/src/main/java/org/nsh07/pomodoro/ui/mergePaddingValues.kt new file mode 100644 index 0000000..dfbbf10 --- /dev/null +++ b/app/src/main/java/org/nsh07/pomodoro/ui/mergePaddingValues.kt @@ -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 . + */ + +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) + ) +} \ No newline at end of file diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/SettingsScreen.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/SettingsScreen.kt index 64b8b5f..e32b1c3 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/SettingsScreen.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/SettingsScreen.kt @@ -29,8 +29,6 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.calculateEndPadding -import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -58,7 +56,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll 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 @@ -70,6 +67,7 @@ import androidx.navigation3.runtime.entryProvider import androidx.navigation3.ui.NavDisplay import org.nsh07.pomodoro.R import org.nsh07.pomodoro.ui.Screen +import org.nsh07.pomodoro.ui.mergePaddingValues import org.nsh07.pomodoro.ui.settingsScreen.components.AboutCard import org.nsh07.pomodoro.ui.settingsScreen.components.ClickableListItem import org.nsh07.pomodoro.ui.settingsScreen.components.LocaleBottomSheet @@ -153,7 +151,6 @@ private fun SettingsScreen( modifier: Modifier = Modifier ) { val context = LocalContext.current - val layoutDirection = LocalLayoutDirection.current val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() val currentLocales = @@ -210,12 +207,7 @@ private fun SettingsScreen( }, modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection) ) { innerPadding -> - val insets = PaddingValues( - bottom = contentPadding.calculateBottomPadding(), - top = innerPadding.calculateTopPadding(), - start = innerPadding.calculateStartPadding(layoutDirection), - end = innerPadding.calculateEndPadding(layoutDirection) - ) + val insets = mergePaddingValues(innerPadding, contentPadding) LazyColumn( verticalArrangement = Arrangement.spacedBy(2.dp), contentPadding = insets, diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutCard.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutCard.kt index 580350a..f734c67 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutCard.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutCard.kt @@ -26,7 +26,6 @@ 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 @@ -67,11 +66,6 @@ fun AboutCard( ), shape = shapes.extraLarge ) { - val buttonColors = ButtonDefaults.buttonColors( - containerColor = colorScheme.onPrimaryContainer, - contentColor = colorScheme.primaryContainer - ) - Row( modifier = Modifier .padding(16.dp) @@ -122,8 +116,8 @@ fun AboutCard( modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp) ) { - TopButton(buttonColors) - BottomButton(buttonColors) +// TopButton(buttonColors) +// BottomButton(buttonColors) } } } \ No newline at end of file diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AboutScreen.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AboutScreen.kt new file mode 100644 index 0000000..1e8a347 --- /dev/null +++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AboutScreen.kt @@ -0,0 +1,270 @@ +/* + * 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 . + */ + +package org.nsh07.pomodoro.ui.settingsScreen.screens + +import android.widget.Toast +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.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll +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.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.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.pinnedScrollBehavior() + val context = LocalContext.current + 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") + ) + } + + 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 = { + Toast.makeText(context, "Coming soon...", Toast.LENGTH_SHORT) + .show() + }, + 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() } + } + } +} + +@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 +) diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AlarmSettings.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AlarmSettings.kt index b070f26..15051e7 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AlarmSettings.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AlarmSettings.kt @@ -30,8 +30,6 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.calculateEndPadding -import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -60,7 +58,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.input.nestedscroll.nestedScroll 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.tooling.preview.Preview @@ -69,6 +66,7 @@ import androidx.core.net.toUri 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 @@ -91,7 +89,6 @@ fun AlarmSettings( ) { val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() val context = LocalContext.current - val layoutDirection = LocalLayoutDirection.current var alarmName by remember { mutableStateOf("...") } @@ -181,12 +178,7 @@ fun AlarmSettings( }, modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection) ) { innerPadding -> - val insets = PaddingValues( - bottom = contentPadding.calculateBottomPadding(), - top = innerPadding.calculateTopPadding(), - start = innerPadding.calculateStartPadding(layoutDirection), - end = innerPadding.calculateEndPadding(layoutDirection) - ) + val insets = mergePaddingValues(innerPadding, contentPadding) LazyColumn( verticalArrangement = Arrangement.spacedBy(2.dp), contentPadding = insets, diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AppearanceSettings.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AppearanceSettings.kt index 5da1ec9..32aaa87 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AppearanceSettings.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/AppearanceSettings.kt @@ -21,8 +21,6 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.calculateEndPadding -import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -44,12 +42,12 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.input.nestedscroll.nestedScroll -import androidx.compose.ui.platform.LocalLayoutDirection 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 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 @@ -76,7 +74,6 @@ fun AppearanceSettings( modifier: Modifier = Modifier ) { val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() - val layoutDirection = LocalLayoutDirection.current Scaffold( topBar = { @@ -105,12 +102,7 @@ fun AppearanceSettings( }, modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection) ) { innerPadding -> - val insets = PaddingValues( - bottom = contentPadding.calculateBottomPadding(), - top = innerPadding.calculateTopPadding(), - start = innerPadding.calculateStartPadding(layoutDirection), - end = innerPadding.calculateEndPadding(layoutDirection) - ) + val insets = mergePaddingValues(innerPadding, contentPadding) LazyColumn( verticalArrangement = Arrangement.spacedBy(2.dp), contentPadding = insets, diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/TimerSettings.kt b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/TimerSettings.kt index 38a75a9..ebee852 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/TimerSettings.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/settingsScreen/screens/TimerSettings.kt @@ -30,8 +30,6 @@ 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.calculateEndPadding -import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height @@ -75,13 +73,13 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.input.nestedscroll.nestedScroll 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.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 @@ -115,7 +113,6 @@ fun TimerSettings( ) { val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() val context = LocalContext.current - val layoutDirection = LocalLayoutDirection.current val appName = stringResource(R.string.app_name) val notificationManagerService = remember { context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager } @@ -175,12 +172,7 @@ fun TimerSettings( }, modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection) ) { innerPadding -> - val insets = PaddingValues( - bottom = contentPadding.calculateBottomPadding(), - top = innerPadding.calculateTopPadding(), - start = innerPadding.calculateStartPadding(layoutDirection), - end = innerPadding.calculateEndPadding(layoutDirection) - ) + val insets = mergePaddingValues(innerPadding, contentPadding) LazyColumn( verticalArrangement = Arrangement.spacedBy(2.dp), contentPadding = insets, diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/StatsScreen.kt b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/StatsScreen.kt index 7a182bf..18195b3 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/StatsScreen.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/statsScreen/StatsScreen.kt @@ -27,8 +27,6 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.calculateEndPadding -import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -64,7 +62,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.rotate import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalFontFamilyResolver -import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview @@ -80,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 @@ -133,7 +131,6 @@ fun StatsScreen( modifier: Modifier = Modifier ) { val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() - val layoutDirection = LocalLayoutDirection.current val hoursFormat = stringResource(R.string.hours_format) val hoursMinutesFormat = stringResource(R.string.hours_and_minutes_format) @@ -200,12 +197,7 @@ fun StatsScreen( }, modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection) ) { innerPadding -> - val insets = PaddingValues( - bottom = contentPadding.calculateBottomPadding(), - top = innerPadding.calculateTopPadding(), - start = innerPadding.calculateStartPadding(layoutDirection), - end = innerPadding.calculateEndPadding(layoutDirection) - ) + val insets = mergePaddingValues(innerPadding, contentPadding) LazyColumn( horizontalAlignment = Alignment.CenterHorizontally, contentPadding = insets, diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/TimerScreen.kt b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/TimerScreen.kt index 555ef59..359bce6 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/TimerScreen.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/TimerScreen.kt @@ -41,8 +41,6 @@ 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.calculateEndPadding -import androidx.compose.foundation.layout.calculateStartPadding import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height @@ -87,7 +85,6 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalHapticFeedback -import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.TextStyle @@ -98,6 +95,7 @@ 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.mergePaddingValues import org.nsh07.pomodoro.ui.theme.AppFonts.googleFlex600 import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTopBar import org.nsh07.pomodoro.ui.theme.TomatoTheme @@ -118,7 +116,6 @@ fun SharedTransitionScope.TimerScreen( ) { val motionScheme = motionScheme val haptic = LocalHapticFeedback.current - val layoutDirection = LocalLayoutDirection.current val color by animateColorAsState( if (timerState.timerMode == TimerMode.FOCUS) colorScheme.primary @@ -221,12 +218,7 @@ fun SharedTransitionScope.TimerScreen( modifier = modifier .nestedScroll(scrollBehavior.nestedScrollConnection) ) { innerPadding -> - val insets = PaddingValues( - bottom = contentPadding.calculateBottomPadding(), - top = innerPadding.calculateTopPadding(), - start = innerPadding.calculateStartPadding(layoutDirection), - end = innerPadding.calculateEndPadding(layoutDirection) - ) + val insets = mergePaddingValues(innerPadding, contentPadding) LazyColumn( verticalArrangement = Arrangement.Center, horizontalAlignment = CenterHorizontally, diff --git a/app/src/main/res/drawable/arrow_forward_big.xml b/app/src/main/res/drawable/arrow_forward_big.xml index eac1368..48805c3 100644 --- a/app/src/main/res/drawable/arrow_forward_big.xml +++ b/app/src/main/res/drawable/arrow_forward_big.xml @@ -22,5 +22,5 @@ android:viewportHeight="960"> + 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" /> diff --git a/app/src/main/res/drawable/email.xml b/app/src/main/res/drawable/email.xml new file mode 100644 index 0000000..0301630 --- /dev/null +++ b/app/src/main/res/drawable/email.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/app/src/main/res/drawable/globe.xml b/app/src/main/res/drawable/globe.xml new file mode 100644 index 0000000..ed04c11 --- /dev/null +++ b/app/src/main/res/drawable/globe.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/app/src/main/res/drawable/open_in_browser.xml b/app/src/main/res/drawable/open_in_browser.xml new file mode 100644 index 0000000..0d36045 --- /dev/null +++ b/app/src/main/res/drawable/open_in_browser.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/app/src/main/res/drawable/pfp.xml b/app/src/main/res/drawable/pfp.xml new file mode 100644 index 0000000..6475af5 --- /dev/null +++ b/app/src/main/res/drawable/pfp.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/app/src/main/res/drawable/x.xml b/app/src/main/res/drawable/x.xml new file mode 100644 index 0000000..2f4a6a7 --- /dev/null +++ b/app/src/main/res/drawable/x.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 341610a..52ec1f8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -45,7 +45,7 @@ Focus focus per day (avg) Get Tomato+ - Help with translation + Help translate Tomato %dh %dm %dh Language @@ -97,4 +97,8 @@ Vibration Vibrate when a timer completes Weekly productivity analysis + About + Translate Tomato into your language + Liked the app? Write a review! + Support me with a small donation \ No newline at end of file diff --git a/app/src/play/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutButtons.kt b/app/src/play/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutButtons.kt index 4b4d724..20e170d 100644 --- a/app/src/play/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutButtons.kt +++ b/app/src/play/java/org/nsh07/pomodoro/ui/settingsScreen/components/AboutButtons.kt @@ -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") } } \ No newline at end of file