diff --git a/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/AlarmDialog.kt b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/AlarmDialog.kt index 7d13fa7..1adb99a 100644 --- a/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/AlarmDialog.kt +++ b/app/src/main/java/org/nsh07/pomodoro/ui/timerScreen/AlarmDialog.kt @@ -17,29 +17,35 @@ package org.nsh07.pomodoro.ui.timerScreen +import androidx.compose.foundation.background import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column 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.wrapContentHeight -import androidx.compose.foundation.layout.wrapContentWidth -import androidx.compose.material3.AlertDialogDefaults -import androidx.compose.material3.BasicAlertDialog +import androidx.compose.foundation.layout.size +import androidx.compose.material3.Button import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme.colorScheme import androidx.compose.material3.MaterialTheme.typography -import androidx.compose.material3.Surface import androidx.compose.material3.Text -import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.Dialog +import androidx.compose.ui.window.DialogProperties import org.nsh07.pomodoro.R +import org.nsh07.pomodoro.ui.theme.TomatoTheme @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -47,42 +53,57 @@ fun AlarmDialog( modifier: Modifier = Modifier, stopAlarm: () -> Unit ) { - BasicAlertDialog( + Dialog( onDismissRequest = stopAlarm, - modifier = modifier + properties = DialogProperties( + usePlatformDefaultWidth = false, + decorFitsSystemWindows = false + ) ) { - Surface( - modifier = Modifier - .wrapContentWidth() - .wrapContentHeight() - .clickable(onClick = stopAlarm), - shape = MaterialTheme.shapes.extraLarge, - tonalElevation = AlertDialogDefaults.TonalElevation, + Box( + contentAlignment = Alignment.Center, + modifier = modifier + .fillMaxSize() + .background(colorScheme.primaryContainer) + .clickable(onClick = stopAlarm) ) { - Column(modifier = Modifier.padding(24.dp)) { - Icon( - painter = painterResource(R.drawable.alarm), - contentDescription = stringResource(R.string.alarm), - modifier = Modifier.align(Alignment.CenterHorizontally) - ) - Spacer(Modifier.height(16.dp)) - Text( - text = stringResource(R.string.stop_alarm_question), - style = typography.headlineSmall, - modifier = Modifier.align(Alignment.CenterHorizontally) - ) - Spacer(Modifier.height(16.dp)) - Text( - text = stringResource(R.string.stop_alarm_dialog_text) - ) - Spacer(modifier = Modifier.height(24.dp)) - TextButton( - onClick = stopAlarm, - modifier = Modifier.align(Alignment.End), - ) { - Text(stringResource(R.string.stop_alarm)) + CompositionLocalProvider(LocalContentColor provides colorScheme.onPrimaryContainer) { + Column(modifier = Modifier.padding(24.dp)) { + Icon( + painter = painterResource(R.drawable.alarm), + contentDescription = stringResource(R.string.alarm), + modifier = Modifier + .align(Alignment.CenterHorizontally) + .size(40.dp) + ) + Spacer(Modifier.height(16.dp)) + Text( + text = stringResource(R.string.stop_alarm_question), + style = typography.headlineSmall, + modifier = Modifier.align(Alignment.CenterHorizontally) + ) + Spacer(Modifier.height(16.dp)) + Text( + text = stringResource(R.string.stop_alarm_dialog_text), + textAlign = TextAlign.Center + ) + Spacer(modifier = Modifier.height(24.dp)) + Button( + onClick = stopAlarm, + modifier = Modifier.align(Alignment.End), + ) { + Text(stringResource(R.string.stop_alarm)) + } } } } } } + +@Preview +@Composable +fun AlarmDialogPreview() { + TomatoTheme { + AlarmDialog(stopAlarm = {}) + } +} diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e4112f4..4d1c4df 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -66,7 +66,7 @@ Activer le mode ne pas déranger pendant un minuteur de concentration Couleur dynamique Adapter les couleurs à celles de votre fond d\'écran - Toutes les fonctionnalités sont déverrouillées dans cette version. Si mon application a fait une différence dans votre vie, veuillez envisager de me soutenir en faisant un don de %1$s. + Toutes les fonctionnalités sont déverrouillées dans cette version. Si mon application a fait une différence dans votre vie, veuillez envisager de me soutenir en faisant un don sur %1$s. Tomato+ Obtenir Tomato+ Tomato FOSS diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 53dfcb2..978ace8 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -64,4 +64,9 @@ 声音 勿扰模式 运行「专注」计时器时打开勿扰 + 获取 Tomato+ + 动态颜色 + 采用壁纸主题色 + Tomato FOSS + 所有功能在此版本中处于解锁状态。如果我的应用让你的生活有所不同,请考虑在 %1$s 上捐款支持我。 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index c1941b4..ee01984 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -32,7 +32,7 @@ 暫停 已暫停 開始 - 一個「循環」是由多個番茄工作階段組成,包含專注時間、短休息與長休息。每個循環的最後一段休息都會是長休息。 + 「循環」是一系列番茄工作階段的組合,包含專注時間、短休息與長休息。每個循環的最後一段休息都是長休息。 生產力分析 分析一天中不同時段的專注時長 重新開始 @@ -64,7 +64,7 @@ 時長 聲音 請勿打擾 - 執行專注計時器時開啟請勿打擾模式 + 執行專注計時器時自動開啟請勿打擾模式 Tomato+ 取得 Tomato+ 動態配色