From 92df55cade3aaa1c5a832d45116f004cbc397bb0 Mon Sep 17 00:00:00 2001 From: koreatlwls Date: Mon, 22 Jul 2024 22:08:01 +0900 Subject: [PATCH 1/6] =?UTF-8?q?#170=20feat=20:=20=EB=8B=A4=EA=B5=AD?= =?UTF-8?q?=EC=96=B4=20=EB=8C=80=EC=9D=91=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/values-ko-rKR/strings.xml | 3 +++ .../src/main/res/values-zh/strings.xml | 3 +++ .../src/main/res/values/strings.xml | 5 ++++- .../feature/setting/model/FeaturesUiState.kt | 10 ++++++---- .../feature/setting/ui/FeaturesListScreen.kt | 19 ++++++++++++++----- .../setting/ui/FeaturesListViewModel.kt | 6 ++++++ .../app/feature/setting/ui/SettingScreen.kt | 2 +- .../feature/setting/ui/UpdatesListScreen.kt | 3 ++- .../titi/app/feature/webview/WebViewScreen.kt | 4 ++-- 9 files changed, 41 insertions(+), 14 deletions(-) diff --git a/core/designsystem/src/main/res/values-ko-rKR/strings.xml b/core/designsystem/src/main/res/values-ko-rKR/strings.xml index e584fdcc..83b630ae 100644 --- a/core/designsystem/src/main/res/values-ko-rKR/strings.xml +++ b/core/designsystem/src/main/res/values-ko-rKR/strings.xml @@ -61,4 +61,7 @@ 알림 측정이 진행 중 입니다. 기록 시작! + 개발자 + 새로운 기록 설정 + Daily 수정/생성 \ No newline at end of file diff --git a/core/designsystem/src/main/res/values-zh/strings.xml b/core/designsystem/src/main/res/values-zh/strings.xml index 34d0d39f..13f9782f 100644 --- a/core/designsystem/src/main/res/values-zh/strings.xml +++ b/core/designsystem/src/main/res/values-zh/strings.xml @@ -61,4 +61,7 @@ 告示 测量正在进行中. 开始录制! + "开发者 " + 新建日志设置 + "每日修改/创建 " \ No newline at end of file diff --git a/core/designsystem/src/main/res/values/strings.xml b/core/designsystem/src/main/res/values/strings.xml index dd220315..b337b09a 100644 --- a/core/designsystem/src/main/res/values/strings.xml +++ b/core/designsystem/src/main/res/values/strings.xml @@ -61,9 +61,12 @@ Do you want to allow it? Saving to gallery failed. Please select Task. - Create task plz + Create task Finish Time : %1$s Notification Measurement is in progress. Start Recording! + Developer + Setting New Record + Daily Modify/Create \ No newline at end of file diff --git a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/model/FeaturesUiState.kt b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/model/FeaturesUiState.kt index b9dc0b40..58e89ba3 100644 --- a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/model/FeaturesUiState.kt +++ b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/model/FeaturesUiState.kt @@ -1,9 +1,11 @@ package com.titi.app.feature.setting.model +import android.content.Context import com.airbnb.mvrx.MavericksState +import com.titi.app.core.designsystem.R data class FeaturesUiState( - val features: List = makeFeatures(), + val features: List = emptyList(), ) : MavericksState { data class Feature( val title: String, @@ -11,10 +13,10 @@ data class FeaturesUiState( ) } -internal fun makeFeatures(): List { +internal fun Context.makeFeatures(): List { return listOf( FeaturesUiState.Feature( - title = "새로운 기록 설정", + title = this.getString(R.string.recording_text_setnewrecordtitle), url = "https://www.notion.so/timertiti/2501881bb0ef49c29a1c2cee29b7f48e?pvs=4", ), FeaturesUiState.Feature( @@ -39,7 +41,7 @@ internal fun makeFeatures(): List { url = "https://www.notion.so/timertiti/Daily-d60dc90f3c104744a74985ea221e5691?pvs=4", ), FeaturesUiState.Feature( - title = "Daily 수정/생성", + title = this.getString(R.string.settings_text_dailyeditcreate), url = "https://timertiti.notion.site/Daily-f3b7898bcda541dda3ac526ea6a56313?pvs=4", ), ) diff --git a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/FeaturesListScreen.kt b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/FeaturesListScreen.kt index 52b26591..5a8e306a 100644 --- a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/FeaturesListScreen.kt +++ b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/FeaturesListScreen.kt @@ -7,16 +7,19 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.safeDrawingPadding +import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold -import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext 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.unit.sp @@ -38,6 +41,7 @@ fun FeaturesListScreen( onNavigateUp: () -> Unit, onNavigateWebView: (title: String, url: String) -> Unit, ) { + val context = LocalContext.current val uiState by viewModel.collectAsState() val containerColor = if (isSystemInDarkTheme()) { @@ -46,10 +50,14 @@ fun FeaturesListScreen( 0xFFF2F2F7 } + LaunchedEffect(Unit) { + viewModel.updateFeatures(context.makeFeatures()) + } + Scaffold( containerColor = Color(containerColor), topBar = { - TopAppBar( + CenterAlignedTopAppBar( colors = TopAppBarDefaults.topAppBarColors( containerColor = TdsColor.GROUPED_BACKGROUND.getColor(), ), @@ -64,7 +72,7 @@ fun FeaturesListScreen( }, title = { TdsText( - text = "TiTi 기능들", + text = stringResource(R.string.settings_button_functions), textStyle = TdsTextStyle.EXTRA_BOLD_TEXT_STYLE, fontSize = 24.sp, color = TdsColor.TEXT, @@ -115,10 +123,11 @@ fun FeaturesListScreen( @Preview private fun FeaturesListScreenPreview() { TiTiTheme { + val context = LocalContext.current FeaturesListScreen( modifier = Modifier.fillMaxSize(), - uiState = FeaturesUiState(features = makeFeatures()), - onClick = { title, url -> }, + uiState = FeaturesUiState(features = context.makeFeatures()), + onClick = { _, _ -> }, ) } } diff --git a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/FeaturesListViewModel.kt b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/FeaturesListViewModel.kt index b3ccf8eb..baa700bd 100644 --- a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/FeaturesListViewModel.kt +++ b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/FeaturesListViewModel.kt @@ -13,6 +13,12 @@ class FeaturesListViewModel @AssistedInject constructor( @Assisted initialState: FeaturesUiState, ) : MavericksViewModel(initialState) { + fun updateFeatures(features: List) { + setState { + copy(features = features) + } + } + @AssistedFactory interface Factory : AssistedViewModelFactory { override fun create(state: FeaturesUiState): FeaturesListViewModel diff --git a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/SettingScreen.kt b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/SettingScreen.kt index ba5d22bf..017bd96a 100644 --- a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/SettingScreen.kt +++ b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/SettingScreen.kt @@ -404,7 +404,7 @@ internal fun DeveloperSection(onSettingActions: (SettingActions) -> Unit) { TdsText( modifier = Modifier.padding(start = 16.dp), - text = "개발자", + text = stringResource(R.string.setting_text_develop), textStyle = TdsTextStyle.SEMI_BOLD_TEXT_STYLE, fontSize = 14.sp, color = TdsColor.TEXT, diff --git a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/UpdatesListScreen.kt b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/UpdatesListScreen.kt index 1c34b96c..a274c103 100644 --- a/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/UpdatesListScreen.kt +++ b/feature/setting/src/main/kotlin/com/titi/app/feature/setting/ui/UpdatesListScreen.kt @@ -27,6 +27,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color 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.unit.sp @@ -92,7 +93,7 @@ fun UpdatesListScreen(onNavigateUp: () -> Unit) { }, title = { TdsText( - text = "업데이트 내역", + text = stringResource(R.string.settings_button_updatehistory), textStyle = TdsTextStyle.EXTRA_BOLD_TEXT_STYLE, fontSize = 24.sp, color = TdsColor.TEXT, diff --git a/feature/webview/src/main/kotlin/com/titi/app/feature/webview/WebViewScreen.kt b/feature/webview/src/main/kotlin/com/titi/app/feature/webview/WebViewScreen.kt index 861f502a..ca1fc79c 100644 --- a/feature/webview/src/main/kotlin/com/titi/app/feature/webview/WebViewScreen.kt +++ b/feature/webview/src/main/kotlin/com/titi/app/feature/webview/WebViewScreen.kt @@ -7,10 +7,10 @@ import android.webkit.WebViewClient import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.safeDrawingPadding +import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold -import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -31,7 +31,7 @@ fun WebViewScreen(title: String, url: String, onNavigateUp: () -> Unit) { containerColor = Color.White, modifier = Modifier.fillMaxSize(), topBar = { - TopAppBar( + CenterAlignedTopAppBar( colors = TopAppBarDefaults.topAppBarColors( containerColor = TdsColor.GROUPED_BACKGROUND.getColor(), ), From 663558b785f3cbad0023625a76e475f5d4d5e9ea Mon Sep 17 00:00:00 2001 From: koreatlwls Date: Mon, 22 Jul 2024 22:15:15 +0900 Subject: [PATCH 2/6] =?UTF-8?q?#170=20fix=20:=20stopwatch=20=EC=B8=A1?= =?UTF-8?q?=EC=A0=95=20=EC=A3=BD=EB=8A=94=20=ED=98=84=EC=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/titi/app/feature/measure/ui/MeasuringScreen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/measure/src/main/kotlin/com/titi/app/feature/measure/ui/MeasuringScreen.kt b/feature/measure/src/main/kotlin/com/titi/app/feature/measure/ui/MeasuringScreen.kt index b9b5ceb8..d0a7194f 100644 --- a/feature/measure/src/main/kotlin/com/titi/app/feature/measure/ui/MeasuringScreen.kt +++ b/feature/measure/src/main/kotlin/com/titi/app/feature/measure/ui/MeasuringScreen.kt @@ -108,7 +108,7 @@ fun MeasuringScreen(splashResultState: String, onFinish: (isFinish: Boolean) -> val isFinish by remember { derivedStateOf { - uiState.measuringRecordTimes.savedTime <= 0L + uiState.recordTimes.recordingMode == 1 && uiState.measuringRecordTimes.savedTime <= 0L } } From 2b2cdc9aa442e4d64f1a00e95b229db259bf20b3 Mon Sep 17 00:00:00 2001 From: koreatlwls Date: Mon, 22 Jul 2024 22:23:24 +0900 Subject: [PATCH 3/6] #170 update : EditTaskHistoryTimeDialog --- .../edit/ui/EditTaskHistoryTimeDialog.kt | 34 +++++-------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditTaskHistoryTimeDialog.kt b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditTaskHistoryTimeDialog.kt index 0a87f71c..a2f68a03 100644 --- a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditTaskHistoryTimeDialog.kt +++ b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditTaskHistoryTimeDialog.kt @@ -3,9 +3,7 @@ package com.titi.app.feature.edit.ui import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -75,12 +73,8 @@ fun EditTaskHistoryTimeDialog( ), onShowDialog = onShowDialog, ) { - Column(modifier = Modifier.width(270.dp)) { - Row( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp), - ) { + Row { + Column(horizontalAlignment = Alignment.CenterHorizontally) { TdsText( text = stringResource(R.string.editdaily_text_startat), textStyle = TdsTextStyle.SEMI_BOLD_TEXT_STYLE, @@ -88,22 +82,8 @@ fun EditTaskHistoryTimeDialog( fontSize = 14.sp, ) - Spacer(modifier = Modifier.weight(1f)) + Spacer(modifier = Modifier.height(4.dp)) - TdsText( - text = stringResource(R.string.editdaily_text_endat), - textStyle = TdsTextStyle.SEMI_BOLD_TEXT_STYLE, - color = TdsColor.TEXT, - fontSize = 14.sp, - ) - } - - Spacer(modifier = Modifier.height(8.dp)) - - Row( - modifier = Modifier.fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - ) { TdsTimePicker( themeColor = themeColor, localDateTime = startLocalDateTime, @@ -116,17 +96,19 @@ fun EditTaskHistoryTimeDialog( } }, ) + } - Spacer(modifier = Modifier.weight(1f)) + Spacer(modifier = Modifier.width(24.dp)) + Column(horizontalAlignment = Alignment.CenterHorizontally) { TdsText( - text = "~", + text = stringResource(R.string.editdaily_text_endat), textStyle = TdsTextStyle.SEMI_BOLD_TEXT_STYLE, color = TdsColor.TEXT, fontSize = 14.sp, ) - Spacer(modifier = Modifier.weight(1f)) + Spacer(modifier = Modifier.height(4.dp)) TdsTimePicker( themeColor = themeColor, From fefe51d4af4828c79ee639362758f0312838466c Mon Sep 17 00:00:00 2001 From: koreatlwls Date: Tue, 23 Jul 2024 00:21:34 +0900 Subject: [PATCH 4/6] =?UTF-8?q?#170=20feat=20:=20=EB=8D=B0=EC=9D=BC?= =?UTF-8?q?=EB=A6=AC=20=ED=9E=88=EC=8A=A4=ED=86=A0=EB=A6=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80,=20=EC=88=98=EC=A0=95=20ux=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/designsystem/build.gradle.kts | 2 - .../designsystem/component/TdsTimePicker.kt | 114 ++++++++---------- .../src/main/res/values-ko-rKR/strings.xml | 11 +- .../src/main/res/values-zh/strings.xml | 33 ++--- .../src/main/res/values/strings.xml | 1 + feature/edit/build.gradle.kts | 2 - .../app/feature/edit/mapper/TimeMapper.kt | 27 ----- .../titi/app/feature/edit/ui/EditScreen.kt | 55 +++++++-- .../edit/ui/EditTaskHistoryTimeDialog.kt | 46 ++++--- .../app/feature/edit/util/TaskHistoryUtil.kt | 15 --- gradle/libs.versions.toml | 2 - 11 files changed, 141 insertions(+), 167 deletions(-) delete mode 100644 feature/edit/src/main/kotlin/com/titi/app/feature/edit/mapper/TimeMapper.kt diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index f39f5178..a7899da6 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -11,6 +11,4 @@ dependencies { implementation(project(":core:util")) implementation(libs.threetenabp) - implementation(libs.balloon) - implementation(libs.picker) } diff --git a/core/designsystem/src/main/kotlin/com/titi/app/core/designsystem/component/TdsTimePicker.kt b/core/designsystem/src/main/kotlin/com/titi/app/core/designsystem/component/TdsTimePicker.kt index 38bec2a4..90c4a8d2 100644 --- a/core/designsystem/src/main/kotlin/com/titi/app/core/designsystem/component/TdsTimePicker.kt +++ b/core/designsystem/src/main/kotlin/com/titi/app/core/designsystem/component/TdsTimePicker.kt @@ -1,89 +1,81 @@ package com.titi.app.core.designsystem.component -import android.annotation.SuppressLint import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.TimePicker +import androidx.compose.material3.TimePickerState import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.chargemap.compose.numberpicker.AMPMHours -import com.chargemap.compose.numberpicker.HoursNumberPicker -import com.skydoves.balloon.ArrowPositionRules -import com.skydoves.balloon.BalloonAnimation -import com.skydoves.balloon.BalloonSizeSpec -import com.skydoves.balloon.compose.Balloon -import com.skydoves.balloon.compose.rememberBalloonBuilder -import com.skydoves.balloon.compose.setBackgroundColor +import com.titi.app.core.designsystem.R +import com.titi.app.core.designsystem.model.TdsDialogInfo import com.titi.app.core.designsystem.theme.TdsColor import com.titi.app.core.designsystem.theme.TdsTextStyle import com.titi.app.core.util.toOnlyTime import java.time.LocalDateTime -@SuppressLint("DefaultLocale") +@OptIn(ExperimentalMaterial3Api::class) @Composable fun TdsTimePicker( + state: TimePickerState, themeColor: TdsColor, localDateTime: LocalDateTime, - pickerValue: AMPMHours, - onValueChange: (AMPMHours) -> Unit, + onTimeChanged: (LocalDateTime) -> Unit, ) { - val builder = rememberBalloonBuilder { - setArrowSize(10) - setArrowPosition(0.5f) - setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR) - setWidth(BalloonSizeSpec.WRAP) - setHeight(BalloonSizeSpec.WRAP) - setPadding(12) - setMarginHorizontal(12) - setCornerRadius(8f) - setBackgroundColor(color = Color(0xCCFFFFFF)) - setBalloonAnimation(BalloonAnimation.ELASTIC) + var showTimePicker by remember { + mutableStateOf(false) } - Balloon( - builder = builder, - balloonContent = { - HoursNumberPicker( - modifier = Modifier - .width(180.dp) - .height(120.dp), - value = pickerValue, - dividersColor = Color.Transparent, - onValueChange = { - onValueChange(it as AMPMHours) + if (showTimePicker) { + TdsDialog( + tdsDialogInfo = TdsDialogInfo.Confirm( + title = "", + positiveText = stringResource(R.string.common_text_ok), + negativeText = stringResource(R.string.common_text_cancel), + onPositive = { + onTimeChanged( + localDateTime.withHour(state.hour).withMinute(state.minute), + ) }, - ) - }, - ) { balloonWindow -> - TdsText( - modifier = Modifier - .width(90.dp) - .background( - color = themeColor - .getColor() - .copy(0.5f), - shape = RoundedCornerShape(4.dp), - ) - .border( - width = 2.dp, - color = themeColor.getColor(), - shape = RoundedCornerShape(4.dp), - ) - .padding(vertical = 4.dp) - .clickable { balloonWindow.showAlignBottom() }, - text = localDateTime.toOnlyTime(), - textStyle = TdsTextStyle.SEMI_BOLD_TEXT_STYLE, - color = TdsColor.TEXT, - fontSize = 22.sp, - textAlign = TextAlign.Center, - ) + ), + onShowDialog = { showTimePicker = it }, + ) { + TimePicker(state = state) + } } + + TdsText( + modifier = Modifier + .width(90.dp) + .background( + color = themeColor + .getColor() + .copy(0.5f), + shape = RoundedCornerShape(4.dp), + ) + .border( + width = 2.dp, + color = themeColor.getColor(), + shape = RoundedCornerShape(4.dp), + ) + .padding(vertical = 4.dp) + .clickable { showTimePicker = true }, + text = localDateTime.toOnlyTime(), + textStyle = TdsTextStyle.SEMI_BOLD_TEXT_STYLE, + color = TdsColor.TEXT, + fontSize = 22.sp, + textAlign = TextAlign.Center, + ) } diff --git a/core/designsystem/src/main/res/values-ko-rKR/strings.xml b/core/designsystem/src/main/res/values-ko-rKR/strings.xml index 83b630ae..181e97aa 100644 --- a/core/designsystem/src/main/res/values-ko-rKR/strings.xml +++ b/core/designsystem/src/main/res/values-ko-rKR/strings.xml @@ -9,7 +9,7 @@ 배경 텍스트 새로운 Task - 12자리 내의 새로운 Task명을 입력하세요 + 12자리 내의 새로운 Task명을 입력하세요. Task명 수정 목표시간 설정 타이머 시간 설정 @@ -19,14 +19,14 @@ 확인 완료 편집 - 알람을 설정하기 위해 권한이 필요로 합니다 + 알람을 설정하기 위해 권한이 필요로 합니다. 설정 하러 가시겠습니까? 컬러 - 그래프의 컬러를 설정합니다 + 그래프의 컬러를 설정합니다. 컬러 방향 - 컬러 조합의 방향을 설정합니다 + 컬러 조합의 방향을 설정합니다. 목표 시간 - 원형 프로그래스바의 목표 시간을 설정합니다 + 원형 프로그래스바의 목표 시간을 설정합니다. Month의 목표 시간을 입력해주세요 (시간 단위) Week의 목표 시간을 입력해주세요 (시간 단위) 모든 사진이 갤러리에 저장되었습니다. @@ -64,4 +64,5 @@ 개발자 새로운 기록 설정 Daily 수정/생성 + 중복된 내역이 존재 합니다. \ No newline at end of file diff --git a/core/designsystem/src/main/res/values-zh/strings.xml b/core/designsystem/src/main/res/values-zh/strings.xml index 13f9782f..43dbd7af 100644 --- a/core/designsystem/src/main/res/values-zh/strings.xml +++ b/core/designsystem/src/main/res/values-zh/strings.xml @@ -9,7 +9,7 @@ 后台 文本 新 Task - Task名称的最大长度为 12 + Task名称的最大长度为 12。 修改 Task 名称 设定目标时间 定时器时间设置 @@ -19,18 +19,18 @@ 确认 结束 编辑 - 您需要权限来设置闹钟 + 您需要权限来设置闹钟。 "您要去设置吗? " 颜色 - 设置图表的颜色 + 设置图表的颜色。 颜色方向 - 设置颜色组合的方向 + 设置颜色组合的方向。 目标时间 - 设置圆形程序栏的目标时间 + 设置圆形程序栏的目标时间。 请输入 Month 的目标时间\\n(以小时为单位) 请输入 Week 的目标时间\\n(以小时为单位) - 所有的照片都保存在画廊里了. - 没有选中的图表. + 所有的照片都保存在画廊里了。 + 没有选中的图表。 新建记录 选择 Task 修改记录后\n请按 SAVE 起始时刻 @@ -47,21 +47,22 @@ 更新细目 "确定要设置相应的颜色作为背景色吗? " "不保存变更事项就出去吗? " - 请输入Task名. + 请输入Task名。 结束 - "计时器已结束 ! " - 还剩5分钟. - 时间已经过去了 - 您需要一个权限来保存您的照片 . + "计时器已结束! " + 还剩5分钟。 + 时间已经过去了。 + 您需要一个权限来保存您的照片。 "允许吗? " - 保存到画廊失败 - 请选择Task. - 请生成Task. + 保存到画廊失败。 + 请选择Task。 + 请生成Task。 即将结束 : %1$s 告示 - 测量正在进行中. + 测量正在进行中。 开始录制! "开发者 " 新建日志设置 "每日修改/创建 " + 重复的历史存在。 \ No newline at end of file diff --git a/core/designsystem/src/main/res/values/strings.xml b/core/designsystem/src/main/res/values/strings.xml index b337b09a..09c9ff95 100644 --- a/core/designsystem/src/main/res/values/strings.xml +++ b/core/designsystem/src/main/res/values/strings.xml @@ -69,4 +69,5 @@ Developer Setting New Record Daily Modify/Create + Duplicate history exists. \ No newline at end of file diff --git a/feature/edit/build.gradle.kts b/feature/edit/build.gradle.kts index d8321ac1..8f8db236 100644 --- a/feature/edit/build.gradle.kts +++ b/feature/edit/build.gradle.kts @@ -9,6 +9,4 @@ android { dependencies { implementation(project(":domain:daily")) implementation(project(":domain:color")) - - implementation(libs.picker) } diff --git a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/mapper/TimeMapper.kt b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/mapper/TimeMapper.kt deleted file mode 100644 index ecf28a42..00000000 --- a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/mapper/TimeMapper.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.titi.app.feature.edit.mapper - -import com.chargemap.compose.numberpicker.AMPMHours -import java.time.LocalDate -import java.time.LocalDateTime - -fun AMPMHours.toLocalDateTime(currentDate: LocalDate): LocalDateTime { - val adjustedHours = when { - dayTime == AMPMHours.DayTime.AM && hours == 12 -> 0 - dayTime == AMPMHours.DayTime.PM && hours == 12 -> 12 - dayTime == AMPMHours.DayTime.PM -> hours + 12 - else -> hours - } - return currentDate.atTime(adjustedHours, minutes) -} - -fun LocalDateTime.toAMPMHours(): AMPMHours { - return AMPMHours( - hours = when { - hour == 0 -> 12 - hour > 12 -> hour - 12 - else -> hour - }, - minutes = minute, - dayTime = if (hour < 12) AMPMHours.DayTime.AM else AMPMHours.DayTime.PM, - ) -} diff --git a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditScreen.kt b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditScreen.kt index 1634d3f9..fd8b7e2b 100644 --- a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditScreen.kt +++ b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditScreen.kt @@ -27,12 +27,15 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.OutlinedCard import androidx.compose.material3.Scaffold +import androidx.compose.material3.SnackbarHost +import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -65,7 +68,9 @@ import com.titi.app.feature.edit.mapper.toFeatureModel import com.titi.app.feature.edit.model.DateTimeTaskHistory import com.titi.app.feature.edit.model.EditActions import com.titi.app.feature.edit.model.EditUiState +import com.titi.app.feature.edit.util.isTaskHistoryOverlap import java.time.LocalDate +import kotlinx.coroutines.launch @Composable fun EditScreen(currentDate: String, onBack: () -> Unit) { @@ -130,6 +135,8 @@ private fun EditScreen(uiState: EditUiState, onEditActions: (EditActions) -> Uni 0xFFFFFFFF } val scrollState = rememberScrollState() + val snackState = remember { SnackbarHostState() } + val snackScope = rememberCoroutineScope() BackHandler { onEditActions(EditActions.Navigates.Back) @@ -177,6 +184,9 @@ private fun EditScreen(uiState: EditUiState, onEditActions: (EditActions) -> Uni }, ) }, + snackbarHost = { + SnackbarHost(hostState = snackState) + }, ) { Column( modifier = Modifier @@ -222,6 +232,7 @@ private fun EditScreen(uiState: EditUiState, onEditActions: (EditActions) -> Uni if (uiState.clickedTaskName != null) { EditTaskContent( + currentDate = uiState.currentDate, themeColor = uiState.graphColors.first(), taskName = uiState.clickedTaskName, taskHistories = uiState.currentDaily @@ -236,6 +247,11 @@ private fun EditScreen(uiState: EditUiState, onEditActions: (EditActions) -> Uni ?.map { it.toFeatureModel() } ?: emptyList(), onEditActions = onEditActions, + onShowSnackbar = { + snackScope.launch { + snackState.showSnackbar(it) + } + }, ) } else { Box( @@ -257,11 +273,13 @@ private fun EditScreen(uiState: EditUiState, onEditActions: (EditActions) -> Uni @Composable private fun EditTaskContent( + currentDate: LocalDate, themeColor: TdsColor, taskName: String, taskHistories: List, fullTaskHistories: List, onEditActions: (EditActions) -> Unit, + onShowSnackbar: (String) -> Unit, ) { var showEditTaskNameDialog by remember { mutableStateOf(false) @@ -307,24 +325,34 @@ private fun EditTaskContent( } } + val message = stringResource(R.string.edit_text_duplicatehistory) if (showEditTaskHistoryDialog) { EditTaskHistoryTimeDialog( themeColor = themeColor, - startDateTime = selectedTaskHistory?.startDateTime ?: LocalDate.now().atStartOfDay(), - endDateTime = selectedTaskHistory?.endDateTime ?: LocalDate.now().atStartOfDay(), - fullTaskHistories = fullTaskHistories - .toMutableList() - .apply { remove(selectedTaskHistory) } - .toList(), + startDateTime = selectedTaskHistory?.startDateTime ?: currentDate.atStartOfDay(), + endDateTime = selectedTaskHistory?.endDateTime ?: currentDate.atStartOfDay(), onShowDialog = { showEditTaskHistoryDialog = it }, onPositive = { dateTimeTaskHistory -> - onEditActions( - EditActions.Updates.UpsertTaskHistory( - taskName = taskName, - currentTaskHistory = selectedTaskHistory, - updateTaskHistory = dateTimeTaskHistory, - ), - ) + if ( + !isTaskHistoryOverlap( + startDateTime = dateTimeTaskHistory.startDateTime, + endDateTime = dateTimeTaskHistory.endDateTime, + taskHistories = fullTaskHistories + .toMutableList() + .apply { remove(selectedTaskHistory) } + .toList(), + ) + ) { + onEditActions( + EditActions.Updates.UpsertTaskHistory( + taskName = taskName, + currentTaskHistory = selectedTaskHistory, + updateTaskHistory = dateTimeTaskHistory, + ), + ) + } else { + onShowSnackbar(message) + } }, ) } @@ -456,6 +484,7 @@ private fun EditTaskContent( Row( modifier = Modifier .fillMaxWidth() + .padding(bottom = 30.dp) .clickable { selectedTaskHistory = null showEditTaskHistoryDialog = true diff --git a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditTaskHistoryTimeDialog.kt b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditTaskHistoryTimeDialog.kt index a2f68a03..3f8ac702 100644 --- a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditTaskHistoryTimeDialog.kt +++ b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/ui/EditTaskHistoryTimeDialog.kt @@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.width +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.rememberTimePickerState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -23,37 +25,31 @@ import com.titi.app.core.designsystem.extension.getTimeString import com.titi.app.core.designsystem.model.TdsDialogInfo import com.titi.app.core.designsystem.theme.TdsColor import com.titi.app.core.designsystem.theme.TdsTextStyle -import com.titi.app.feature.edit.mapper.toAMPMHours -import com.titi.app.feature.edit.mapper.toLocalDateTime import com.titi.app.feature.edit.model.DateTimeTaskHistory -import com.titi.app.feature.edit.util.isStartTimeTaskHistoryOverlap -import com.titi.app.feature.edit.util.isTaskHistoryOverlap import java.time.Duration import java.time.LocalDateTime +@OptIn(ExperimentalMaterial3Api::class) @Composable fun EditTaskHistoryTimeDialog( themeColor: TdsColor, startDateTime: LocalDateTime, endDateTime: LocalDateTime, - fullTaskHistories: List, onShowDialog: (Boolean) -> Unit, onPositive: (DateTimeTaskHistory) -> Unit, ) { - var startPickerValue by remember { - mutableStateOf(startDateTime.toAMPMHours()) - } var startLocalDateTime by remember { mutableStateOf(startDateTime) } - - var endPickerValue by remember { - mutableStateOf(endDateTime.toAMPMHours()) - } var endLocalDateTime by remember { mutableStateOf(endDateTime) } + val timePickerState = rememberTimePickerState( + initialHour = startLocalDateTime.hour, + initialMinute = startLocalDateTime.minute, + ) + TdsDialog( tdsDialogInfo = TdsDialogInfo.Confirm( title = (Duration.between(startLocalDateTime, endLocalDateTime).toMillis() / 1000) @@ -85,14 +81,15 @@ fun EditTaskHistoryTimeDialog( Spacer(modifier = Modifier.height(4.dp)) TdsTimePicker( + state = timePickerState, themeColor = themeColor, localDateTime = startLocalDateTime, - pickerValue = startPickerValue, - onValueChange = { - startPickerValue = it - val start = it.toLocalDateTime(startLocalDateTime.toLocalDate()) - if (!isStartTimeTaskHistoryOverlap(start, fullTaskHistories)) { - startLocalDateTime = start + onTimeChanged = { + startLocalDateTime = it + endLocalDateTime = if (it > endLocalDateTime) { + it + } else { + endLocalDateTime } }, ) @@ -111,15 +108,16 @@ fun EditTaskHistoryTimeDialog( Spacer(modifier = Modifier.height(4.dp)) TdsTimePicker( + state = timePickerState, themeColor = themeColor, localDateTime = endLocalDateTime, - pickerValue = endPickerValue, - onValueChange = { - endPickerValue = it - val end = it.toLocalDateTime(endLocalDateTime.toLocalDate()) - if (!isTaskHistoryOverlap(startLocalDateTime, end, fullTaskHistories)) { - endLocalDateTime = end + onTimeChanged = { + startLocalDateTime = if (startLocalDateTime > it) { + it + } else { + startLocalDateTime } + endLocalDateTime = it }, ) } diff --git a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/util/TaskHistoryUtil.kt b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/util/TaskHistoryUtil.kt index a206777b..ff771ca5 100644 --- a/feature/edit/src/main/kotlin/com/titi/app/feature/edit/util/TaskHistoryUtil.kt +++ b/feature/edit/src/main/kotlin/com/titi/app/feature/edit/util/TaskHistoryUtil.kt @@ -3,21 +3,6 @@ package com.titi.app.feature.edit.util import com.titi.app.feature.edit.model.DateTimeTaskHistory import java.time.LocalDateTime -fun isStartTimeTaskHistoryOverlap( - startDateTime: LocalDateTime, - taskHistories: List, -): Boolean { - for (taskHistory in taskHistories) { - if ( - startDateTime >= taskHistory.startDateTime && - startDateTime <= taskHistory.endDateTime - ) { - return true - } - } - return false -} - fun isTaskHistoryOverlap( startDateTime: LocalDateTime, endDateTime: LocalDateTime, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d5cbd8e2..f7604055 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -49,7 +49,6 @@ firebaseBom = "33.1.1" ktlint = "12.1.0" calendar = "2.5.0-beta01" -picker = "1.0.3" lottie = "6.4.1" [libraries] @@ -122,7 +121,6 @@ firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashly firebase-database = { group = "com.google.firebase", name = "firebase-database-ktx" } calendar = { group = "com.kizitonwose.calendar", name = "compose", version.ref = "calendar" } -picker = { group = "com.chargemap.compose", name = "numberpicker", version.ref = "picker" } lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "lottie" } [plugins] From 364b4fca6f80887e1af8113c05d4e4d7deac961b Mon Sep 17 00:00:00 2001 From: koreatlwls Date: Tue, 23 Jul 2024 00:24:30 +0900 Subject: [PATCH 5/6] update : version --- build-logic/src/main/kotlin/com/titi/common/BuildInfo.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-logic/src/main/kotlin/com/titi/common/BuildInfo.kt b/build-logic/src/main/kotlin/com/titi/common/BuildInfo.kt index 4547a443..f5825f41 100644 --- a/build-logic/src/main/kotlin/com/titi/common/BuildInfo.kt +++ b/build-logic/src/main/kotlin/com/titi/common/BuildInfo.kt @@ -9,7 +9,7 @@ object BuildType { object AppConfig { const val APP_ID = "com.titi.app" - const val APP_VERSION_NAME = "1.3.0" - const val APP_VERSION_CODE = 38 + const val APP_VERSION_NAME = "1.3.1" + const val APP_VERSION_CODE = 39 const val APP_NAME = "TiTi" } \ No newline at end of file From ec6f3db028d4267064ed0f015fbce03bb0e78a10 Mon Sep 17 00:00:00 2001 From: koreatlwls Date: Tue, 23 Jul 2024 00:25:06 +0900 Subject: [PATCH 6/6] docs : release-note --- release-note.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-note.txt b/release-note.txt index a8424e19..cd9e99c0 100644 --- a/release-note.txt +++ b/release-note.txt @@ -1,2 +1,2 @@ -TiTi android dev 1.3.0 -- TLR #84 \ No newline at end of file +TiTi android dev 1.3.1 +- \ No newline at end of file