From d8632aae0bab74e9a7857a17e0116e34a739e470 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Wed, 14 Feb 2024 01:19:35 +0900 Subject: [PATCH 01/55] =?UTF-8?q?[CHORE]=20#125=20:=20=EC=9D=BC=EC=A0=95?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=ED=99=94=EB=A9=B4=20BottomNaivgatoin=20?= =?UTF-8?q?=EC=95=88=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetDropDown.xml | 2 +- app/src/main/java/com/wap/wapp/MainActivity.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index e76ed3f3..860451c3 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -15,7 +15,7 @@ - + diff --git a/app/src/main/java/com/wap/wapp/MainActivity.kt b/app/src/main/java/com/wap/wapp/MainActivity.kt index 8f737474..8b6e9df7 100644 --- a/app/src/main/java/com/wap/wapp/MainActivity.kt +++ b/app/src/main/java/com/wap/wapp/MainActivity.kt @@ -28,6 +28,7 @@ import com.wap.wapp.core.domain.usecase.auth.SignInUseCase import com.wap.wapp.feature.attendance.management.navigation.attendanceManagementNavigationRoute import com.wap.wapp.feature.auth.signin.navigation.signInNavigationRoute import com.wap.wapp.feature.auth.signup.navigation.signUpNavigationRoute +import com.wap.wapp.feature.management.event.navigation.eventEditNavigationRoute import com.wap.wapp.feature.management.event.navigation.eventRegistrationNavigationRoute import com.wap.wapp.feature.management.survey.navigation.ManagementSurveyRoute import com.wap.wapp.feature.profile.profilesetting.navigation.profileSettingNavigationRoute @@ -114,6 +115,7 @@ private fun handleBottomBarState( ManagementSurveyRoute.surveyFormRegistrationRoute -> setBottomBarState(false) ManagementSurveyRoute.surveyFormEditRoute("{id}") -> setBottomBarState(false) eventRegistrationNavigationRoute -> setBottomBarState(false) + eventEditNavigationRoute -> setBottomBarState(false) SurveyRoute.answerRoute("{id}") -> setBottomBarState(false) surveyCheckRoute -> setBottomBarState(false) SurveyCheckRoute.surveyDetailRoute("{id}") -> setBottomBarState(false) From 27d0d66cdb26a46efe7d0bff94f42a52dc86e8b6 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 17:04:38 +0900 Subject: [PATCH 02/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=84=A4=EB=AC=B8?= =?UTF-8?q?=20=ED=99=95=EC=9D=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20Top=20Bar?= =?UTF-8?q?=20=EC=98=A4=EB=A5=B8=EC=AA=BD=EC=9C=BC=EB=A1=9C=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EB=B0=B1=EC=8A=A4=ED=83=9D=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetDropDown.xml | 12 ++++++------ .../java/com/wap/wapp/navigation/WappNavHost.kt | 13 ++++++++++++- .../wapp/feature/survey/check/SurveyCheckScreen.kt | 7 +++++-- .../check/navigation/SurveyCheckNavigation.kt | 2 ++ 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 860451c3..02da711d 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -4,18 +4,18 @@ - + - + - - + + - - + + diff --git a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt index 0c8c407c..e1a5c3f6 100644 --- a/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt +++ b/app/src/main/java/com/wap/wapp/navigation/WappNavHost.kt @@ -93,6 +93,11 @@ fun WappNavHost( ) }, navigateToSurveyDetail = navController::navigateToSurveyDetail, + navigateToSurvey = { + navController.navigateToSurvey( + navOptions { popUpTo(surveyCheckRoute) { inclusive = true } }, + ) + }, ) managementSurveyNavGraph( navigateToManagement = navController::navigateToManagement, @@ -109,7 +114,13 @@ fun WappNavHost( ) attendanceScreen( navigateToSignIn = { - navController.navigateToSignIn(navOptions { popUpTo(attendanceNavigationRoute) }) + navController.navigateToSignIn( + navOptions { + popUpTo( + attendanceNavigationRoute, + ) + }, + ) }, navigateToAttendanceManagement = navController::navigateToAttendanceManagement, ) diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt index a2a313c7..ee94e829 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt @@ -18,7 +18,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.wap.designsystem.WappTheme import com.wap.designsystem.component.CircleLoader -import com.wap.designsystem.component.WappLeftMainTopBar +import com.wap.designsystem.component.WappRightMainTopBar import com.wap.wapp.core.commmon.extensions.toSupportingText import kotlinx.coroutines.flow.collectLatest @@ -26,6 +26,7 @@ import kotlinx.coroutines.flow.collectLatest internal fun SurveyCheckScreen( viewModel: SurveyCheckViewModel = hiltViewModel(), navigateToSurveyDetail: (String) -> Unit, + navigateToSurvey: () -> Unit, ) { val surveyListUiState = viewModel.surveyListUiState.collectAsStateWithLifecycle().value val snackBarHostState = remember { SnackbarHostState() } @@ -41,9 +42,11 @@ internal fun SurveyCheckScreen( containerColor = WappTheme.colors.backgroundBlack, snackbarHost = { SnackbarHost(snackBarHostState) }, topBar = { - WappLeftMainTopBar( + WappRightMainTopBar( titleRes = R.string.survey_check, contentRes = R.string.survey_check_content, + showBackButton = true, + onClickBackButton = navigateToSurvey, ) }, contentWindowInsets = WindowInsets(0.dp), diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/navigation/SurveyCheckNavigation.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/navigation/SurveyCheckNavigation.kt index d853fc4e..57961327 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/navigation/SurveyCheckNavigation.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/navigation/SurveyCheckNavigation.kt @@ -21,10 +21,12 @@ fun NavController.navigateToSurveyCheck(navOptions: NavOptions? = navOptions {}) fun NavGraphBuilder.surveyCheckNavGraph( navigateToSurveyDetail: (String) -> Unit, navigateToSurveyCheck: () -> Unit, + navigateToSurvey: () -> Unit, ) { composable(route = SurveyCheckRoute.surveyCheckRoute) { SurveyCheckScreen( navigateToSurveyDetail = navigateToSurveyDetail, + navigateToSurvey = navigateToSurvey, ) } From a8dddee39804e9b11f0ac50b8281793e81c36cbb Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 18:20:50 +0900 Subject: [PATCH 03/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20Github=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20TextField=20Maxline=201=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wap/wapp/feature/auth/signin/SignInScreen.kt | 7 +++++++ .../feature/survey/check/detail/SurveyDetailTopBar.kt | 8 ++++---- .../feature/survey/check/detail/SurveyInformationCard.kt | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt index 89436552..49361c23 100644 --- a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt +++ b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt @@ -83,6 +83,7 @@ internal fun SignInScreen( color = WappTheme.colors.white, fontSize = 18.sp, ) + Spacer(modifier = Modifier.height(16.dp)) Text( @@ -90,11 +91,13 @@ internal fun SignInScreen( color = WappTheme.colors.white, style = WappTheme.typography.labelRegular, ) + Spacer(modifier = Modifier.height(4.dp)) OutlinedTextField( modifier = Modifier.fillMaxWidth(), value = email, + maxLines = 1, onValueChange = { email = it }, placeholder = { Text( @@ -150,13 +153,16 @@ internal fun SignInScreen( style = WappTheme.typography.contentMedium, ) } + Spacer(modifier = Modifier.height(16.dp)) Divider( color = WappTheme.colors.white, thickness = 1.dp, ) + Spacer(modifier = Modifier.height(8.dp)) + Text( modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center, @@ -164,6 +170,7 @@ internal fun SignInScreen( style = WappTheme.typography.captionMedium, color = WappTheme.colors.yellow34, ) + Spacer(modifier = Modifier.height(32.dp)) } }, diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailTopBar.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailTopBar.kt index ec08152d..173cab53 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailTopBar.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailTopBar.kt @@ -32,21 +32,21 @@ internal fun SurveyDetailTopBar( textAlign = TextAlign.Center, modifier = Modifier.fillMaxWidth(), style = WappTheme.typography.contentBold, + color = WappTheme.colors.white, ) }, navigationIcon = { Icon( painter = painterResource(id = drawable.ic_back), - contentDescription = stringResource( - id = com.wap.wapp.core.designsystem.R.string.back_button, - ), + contentDescription = + stringResource(com.wap.wapp.core.designsystem.R.string.back_button), modifier = Modifier .padding(start = 16.dp) .clickable { onBackButtonClicked() }, ) }, colors = TopAppBarDefaults.topAppBarColors( - containerColor = WappTheme.colors.yellow34, + containerColor = WappTheme.colors.black25, ), ) } diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyInformationCard.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyInformationCard.kt index bb29d5ce..5b37a088 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyInformationCard.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyInformationCard.kt @@ -45,6 +45,7 @@ internal fun SurveyInformationCard( color = WappTheme.colors.white, textAlign = TextAlign.Start, ) + Divider() } From 1901a3220b527fc1dcbedfe90ab25afbe9e1f55e Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 18:44:45 +0900 Subject: [PATCH 04/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20Github=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EA=B8=B0=EC=9E=85=20TextField=20=EC=99=84=EB=A3=8C=20=EB=88=84?= =?UTF-8?q?=EB=A5=B4=EB=A9=B4=20=ED=82=A4=EB=B3=B4=EB=93=9C=20=EC=88=A8?= =?UTF-8?q?=EA=B8=B0=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wap/wapp/feature/auth/signin/SignInScreen.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt index 49361c23..7c709843 100644 --- a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt +++ b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.BottomSheetScaffold import androidx.compose.material3.Button @@ -27,8 +28,11 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp @@ -53,7 +57,7 @@ internal fun SignInRoute( ) } -@OptIn(ExperimentalMaterial3Api::class) +@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class) @Composable internal fun SignInScreen( signInUseCase: SignInUseCase, @@ -64,6 +68,7 @@ internal fun SignInScreen( val scaffoldState = rememberBottomSheetScaffoldState() val snackBarHostState = remember { SnackbarHostState() } var email by rememberSaveable { mutableStateOf("") } + val keyboardController = LocalSoftwareKeyboardController.current BottomSheetScaffold( scaffoldState = scaffoldState, @@ -106,6 +111,10 @@ internal fun SignInScreen( }, keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Email, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions( + onDone = { keyboardController?.hide() }, ), colors = OutlinedTextFieldDefaults.colors( focusedTextColor = WappTheme.colors.white, From c34ea5fd25037fb9a522944d0abd62b5fcbee738 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 19:00:15 +0900 Subject: [PATCH 05/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=B2=AB=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EA=B0=80=EC=9E=85=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20maxLines=201=20=EB=B0=8F=20TextField=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=20=EB=88=84=EB=A5=B4=EB=A9=B4=20=ED=82=A4=EB=B3=B4?= =?UTF-8?q?=EB=93=9C=20=EC=88=A8=EA=B8=B0=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wapp/feature/auth/signup/SignUpScreen.kt | 24 ++++++++++++++++--- .../feature/auth/signup/SignUpTextField.kt | 4 ++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt index c30008d3..bbc16f8d 100644 --- a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt +++ b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt @@ -10,6 +10,7 @@ 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.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.Text import androidx.compose.material3.Button @@ -22,8 +23,11 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -51,6 +55,7 @@ internal fun SignUpRoute( ) } +@OptIn(ExperimentalComposeUiApi::class) @Composable internal fun SignUpScreen( viewModel: SignUpViewModel, @@ -58,6 +63,7 @@ internal fun SignUpScreen( navigateToSignIn: () -> Unit, ) { val snackBarHostState = remember { SnackbarHostState() } + val keyboardController = LocalSoftwareKeyboardController.current LaunchedEffect(true) { viewModel.signUpEventFlow.collectLatest { @@ -119,7 +125,11 @@ internal fun SignUpScreen( supportingText = stringResource(id = string.sign_up_name_caption), icon = R.drawable.ic_profile, modifier = Modifier.fillMaxWidth(), - keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text), + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Text, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), ) SignUpTextField( @@ -133,7 +143,11 @@ internal fun SignUpScreen( supportingText = stringResource(id = string.sign_up_student_id_caption), icon = ic_card, modifier = Modifier.fillMaxWidth(), - keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Number, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), ) Row( @@ -153,7 +167,11 @@ internal fun SignUpScreen( ), icon = ic_door, modifier = Modifier.width(150.dp), - keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Number, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), ) SignUpChip( diff --git a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpTextField.kt b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpTextField.kt index b688d18c..8a72caa6 100644 --- a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpTextField.kt +++ b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpTextField.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.Icon import androidx.compose.material.Text @@ -28,6 +29,7 @@ internal fun SignUpTextField( supportingText: String, icon: Int, keyboardOptions: KeyboardOptions, + keyboardActions: KeyboardActions, modifier: Modifier, ) { Column { @@ -57,10 +59,12 @@ internal fun SignUpTextField( focusedIndicatorColor = WappTheme.colors.white, unfocusedIndicatorColor = WappTheme.colors.white, ), + maxLines = 1, placeholder = { Text(text = hint, color = WappTheme.colors.grayA2) }, keyboardOptions = keyboardOptions, + keyboardActions = keyboardActions, ) Spacer(modifier = Modifier.height(8.dp)) Text( From 204a99c57085be77858e3c3d59b2ff798efcfa41 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 19:01:48 +0900 Subject: [PATCH 06/55] =?UTF-8?q?[CHORE]=20#125=20:=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt index bbc16f8d..cf1cfbb8 100644 --- a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt +++ b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt @@ -133,9 +133,7 @@ internal fun SignUpScreen( ) SignUpTextField( - iconDescription = stringResource( - id = string.sign_up_student_id_description, - ), + iconDescription = stringResource(id = string.sign_up_student_id_description), text = viewModel.signUpStudentId.collectAsState().value, title = stringResource(id = string.sign_up_student_id_title), onValueChanged = { name -> viewModel.setStudentId(name) }, @@ -162,9 +160,7 @@ internal fun SignUpScreen( title = stringResource(id = string.sign_up_registered_at_title), onValueChanged = { name -> viewModel.setYear(name) }, hint = stringResource(id = string.sign_up_registered_at_hint), - supportingText = stringResource( - id = string.sign_up_registered_at_caption, - ), + supportingText = stringResource(id = string.sign_up_registered_at_caption), icon = ic_door, modifier = Modifier.width(150.dp), keyboardOptions = KeyboardOptions( From f03976b7981bbc5266dafc0c442aa46aa1cb53c0 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 19:06:46 +0900 Subject: [PATCH 07/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=82=A4=EB=B3=B4?= =?UTF-8?q?=EB=93=9C=20=EC=99=84=EB=A3=8C=20=EB=88=84=EB=A5=B4=EB=A9=B4=20?= =?UTF-8?q?=ED=82=A4=EB=B3=B4=EB=93=9C=20=EC=88=A8=EA=B8=B0=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wap/designsystem/component/TextField.kt | 10 ++++++++++ .../wap/wapp/feature/auth/signup/SignUpTextField.kt | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/core/designsystem/src/main/java/com/wap/designsystem/component/TextField.kt b/core/designsystem/src/main/java/com/wap/designsystem/component/TextField.kt index d389ebb4..619d7a0f 100644 --- a/core/designsystem/src/main/java/com/wap/designsystem/component/TextField.kt +++ b/core/designsystem/src/main/java/com/wap/designsystem/component/TextField.kt @@ -2,12 +2,17 @@ package com.wap.designsystem.component import androidx.annotation.StringRes import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardActions +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Text import androidx.compose.material3.TextField import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import com.wap.designsystem.WappTheme @@ -46,6 +51,7 @@ fun WappTextField( ) } +@OptIn(ExperimentalComposeUiApi::class) @Composable fun WappRoundedTextField( value: String, @@ -53,6 +59,8 @@ fun WappRoundedTextField( modifier: Modifier = Modifier, @StringRes placeholder: Int, ) { + val keyboardController = LocalSoftwareKeyboardController.current + TextField( value = value, onValueChange = onValueChange, @@ -72,6 +80,8 @@ fun WappRoundedTextField( color = WappTheme.colors.gray82, ) }, + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), shape = RoundedCornerShape(10.dp), ) } diff --git a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpTextField.kt b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpTextField.kt index 8a72caa6..ff6245a1 100644 --- a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpTextField.kt +++ b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpTextField.kt @@ -42,13 +42,16 @@ internal fun SignUpTextField( tint = WappTheme.colors.white, modifier = Modifier.size(20.dp), ) + Spacer(modifier = Modifier.width(8.dp)) + Text( text = title, color = WappTheme.colors.white, style = WappTheme.typography.contentBold, ) } + TextField( value = text, onValueChange = onValueChanged, @@ -66,7 +69,9 @@ internal fun SignUpTextField( keyboardOptions = keyboardOptions, keyboardActions = keyboardActions, ) + Spacer(modifier = Modifier.height(8.dp)) + Text( text = supportingText, color = WappTheme.colors.yellow34, From 4bcafca44b73b014c6f3df14ae464bcd36f2d87e Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 21:05:34 +0900 Subject: [PATCH 08/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=B6=9C?= =?UTF-8?q?=EC=84=9D=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=8B=A4=EC=9D=B4?= =?UTF-8?q?=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EC=99=84=EB=A3=8C=20=EB=88=84?= =?UTF-8?q?=EB=A5=BC=20=EC=8B=9C=20=ED=82=A4=EB=B3=B4=EB=93=9C=20=EC=88=A8?= =?UTF-8?q?=EA=B8=B0=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance/component/AttendanceDialog.kt | 13 ++++++++++++- .../component/AttendanceManagementDialog.kt | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/component/AttendanceDialog.kt b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/component/AttendanceDialog.kt index 4536cc5d..f380d12c 100644 --- a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/component/AttendanceDialog.kt +++ b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/component/AttendanceDialog.kt @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -18,11 +19,14 @@ import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration @@ -34,6 +38,7 @@ import androidx.compose.ui.window.DialogProperties import com.wap.designsystem.WappTheme import com.wap.wapp.feature.attendance.R +@OptIn(ExperimentalComposeUiApi::class) @Composable internal fun AttendanceDialog( attendanceCode: String, @@ -42,6 +47,8 @@ internal fun AttendanceDialog( onDismissRequest: () -> Unit, onAttendanceCodeChanged: (String) -> Unit, ) { + val keyboardController = LocalSoftwareKeyboardController.current + Dialog( onDismissRequest = onDismissRequest, properties = DialogProperties( @@ -79,7 +86,11 @@ internal fun AttendanceDialog( value = attendanceCode, onValueChange = onAttendanceCodeChanged, textStyle = WappTheme.typography.titleRegular.copy(textAlign = TextAlign.Center), - keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Number, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), shape = RoundedCornerShape(8.dp), colors = OutlinedTextFieldDefaults.colors( focusedTextColor = WappTheme.colors.white, diff --git a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/management/component/AttendanceManagementDialog.kt b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/management/component/AttendanceManagementDialog.kt index 3dacc32e..f011a093 100644 --- a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/management/component/AttendanceManagementDialog.kt +++ b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/management/component/AttendanceManagementDialog.kt @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -18,11 +19,14 @@ import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration @@ -34,6 +38,7 @@ import androidx.compose.ui.window.DialogProperties import com.wap.designsystem.WappTheme import com.wap.wapp.feature.attendance.R +@OptIn(ExperimentalComposeUiApi::class) @Composable internal fun AttendanceManagementDialog( attendanceCode: String, @@ -42,6 +47,8 @@ internal fun AttendanceManagementDialog( onDismissRequest: () -> Unit, onAttendanceCodeChanged: (String) -> Unit, ) { + val keyboardController = LocalSoftwareKeyboardController.current + Dialog( onDismissRequest = onDismissRequest, properties = DialogProperties( @@ -79,7 +86,11 @@ internal fun AttendanceManagementDialog( value = attendanceCode, onValueChange = onAttendanceCodeChanged, textStyle = WappTheme.typography.titleRegular.copy(textAlign = TextAlign.Center), - keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Number, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), shape = RoundedCornerShape(8.dp), colors = OutlinedTextFieldDefaults.colors( focusedTextColor = WappTheme.colors.white, From 2b2d8ce321f0154a4035594907b9f868006c9f5c Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 21:21:56 +0900 Subject: [PATCH 09/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=EC=B2=B4=ED=81=AC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?LazyColumn=20=EC=88=98=EC=A7=81=20=EB=A7=88=EC=A7=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt | 4 ++-- .../java/com/wap/wapp/feature/survey/check/SurveyItemCard.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt index ee94e829..5f14eb35 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt @@ -58,10 +58,10 @@ internal fun SurveyCheckScreen( is SurveyCheckViewModel.SurveyListUiState.Success -> { LazyColumn( - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(20.dp), modifier = Modifier .fillMaxSize() - .padding(start = 16.dp, end = 16.dp, bottom = 16.dp) + .padding(start = 16.dp, end = 16.dp, bottom = 16.dp, top = 40.dp) .padding(paddingValues), ) { val surveyList = surveyListUiState.surveyList diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyItemCard.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyItemCard.kt index e958b9a0..8853e0b9 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyItemCard.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyItemCard.kt @@ -30,7 +30,7 @@ internal fun SurveyItemCard( ) { Column( verticalArrangement = Arrangement.spacedBy(16.dp), - modifier = Modifier.padding(16.dp), + modifier = Modifier.padding(horizontal = 16.dp), ) { Row( horizontalArrangement = Arrangement.End, From 12f3cb19364aee3c3bdc768804408ec307ff5ee2 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 22:06:11 +0900 Subject: [PATCH 10/55] =?UTF-8?q?[CHORE]=20#125=20:=20=EC=9D=BC=EC=A0=95?= =?UTF-8?q?=20=EB=93=B1=EB=A1=9D=20=EB=A7=88=EA=B0=90=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/EventRegistrationScreen.kt | 7 +---- .../EventRegistrationViewModel.kt | 27 ++++++++++++++----- .../feature/survey/check/SurveyCheckScreen.kt | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt index 16a53c44..48bd84d1 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt @@ -159,12 +159,7 @@ internal fun EventRegistrationScreen( EventRegistrationContent( eventRegistrationState = currentRegistrationState, modifier = Modifier - .padding( - top = 50.dp, - start = 20.dp, - end = 20.dp, - bottom = 20.dp, - ), + .padding(top = 50.dp, start = 20.dp, end = 20.dp, bottom = 20.dp), eventTitle = title, eventContent = content, location = location, diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt index 2f0217db..927f4ba8 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt @@ -54,11 +54,17 @@ class EventRegistrationViewModel @Inject constructor( MutableStateFlow(generateNowTime().plusHours(1)) val eventEndTime = _eventEndTime.asStateFlow() - fun setEventTitle(eventTitle: String) { _eventTitle.value = eventTitle } + fun setEventTitle(eventTitle: String) { + _eventTitle.value = eventTitle + } - fun setEventContent(eventContent: String) { _eventContent.value = eventContent } + fun setEventContent(eventContent: String) { + _eventContent.value = eventContent + } - fun setEventLocation(eventLocation: String) { _eventLocation.value = eventLocation } + fun setEventLocation(eventLocation: String) { + _eventLocation.value = eventLocation + } fun setEventStartDate(eventDate: LocalDate) { if (!isValidStartDate(eventDate)) { @@ -68,7 +74,9 @@ class EventRegistrationViewModel @Inject constructor( _eventStartDate.value = eventDate } - fun setEventStartTime(eventTime: LocalTime) { _eventStartTime.value = eventTime } + fun setEventStartTime(eventTime: LocalTime) { + _eventStartTime.value = eventTime + } fun setEventEndDate(eventDate: LocalDate) { if (!isValidEndDate(eventDate)) { @@ -122,8 +130,15 @@ class EventRegistrationViewModel @Inject constructor( } } - private fun isValidEndTime(eventTime: LocalTime): Boolean = - _eventEndDate.value == _eventStartDate.value && eventTime > _eventStartTime.value + private fun isValidEndTime(eventTime: LocalTime): Boolean { + if (_eventEndDate.value > _eventStartDate.value) { + return true + } + if (_eventEndDate.value == _eventStartDate.value && eventTime > _eventStartTime.value) { + return true + } + return false + } private fun isValidEndDate(eventDate: LocalDate): Boolean = eventDate >= _eventStartDate.value diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt index 5f14eb35..e67338fe 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/SurveyCheckScreen.kt @@ -61,7 +61,7 @@ internal fun SurveyCheckScreen( verticalArrangement = Arrangement.spacedBy(20.dp), modifier = Modifier .fillMaxSize() - .padding(start = 16.dp, end = 16.dp, bottom = 16.dp, top = 40.dp) + .padding(start = 16.dp, end = 16.dp, bottom = 16.dp, top = 20.dp) .padding(paddingValues), ) { val surveyList = surveyListUiState.surveyList From 56b532ea8276f795b7296299482308c83d2332a8 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 22:07:45 +0900 Subject: [PATCH 11/55] =?UTF-8?q?[CHORE]=20#125=20:=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/EventRegistrationViewModel.kt | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt index 927f4ba8..507562ce 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt @@ -54,17 +54,11 @@ class EventRegistrationViewModel @Inject constructor( MutableStateFlow(generateNowTime().plusHours(1)) val eventEndTime = _eventEndTime.asStateFlow() - fun setEventTitle(eventTitle: String) { - _eventTitle.value = eventTitle - } + fun setEventTitle(eventTitle: String) { _eventTitle.value = eventTitle } - fun setEventContent(eventContent: String) { - _eventContent.value = eventContent - } + fun setEventContent(eventContent: String) { _eventContent.value = eventContent } - fun setEventLocation(eventLocation: String) { - _eventLocation.value = eventLocation - } + fun setEventLocation(eventLocation: String) { _eventLocation.value = eventLocation } fun setEventStartDate(eventDate: LocalDate) { if (!isValidStartDate(eventDate)) { @@ -74,9 +68,7 @@ class EventRegistrationViewModel @Inject constructor( _eventStartDate.value = eventDate } - fun setEventStartTime(eventTime: LocalTime) { - _eventStartTime.value = eventTime - } + fun setEventStartTime(eventTime: LocalTime) { _eventStartTime.value = eventTime } fun setEventEndDate(eventDate: LocalDate) { if (!isValidEndDate(eventDate)) { From 4db0093e4dfee3c56c53ede87e34561bb3f73583 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 22:11:55 +0900 Subject: [PATCH 12/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=83=81=EB=8B=A8=20?= =?UTF-8?q?=EB=B0=94=EB=8F=84=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/registration/EventRegistrationViewModel.kt | 8 ++++---- .../wap/wapp/feature/management/ManagementScreen.kt | 11 +++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt index 507562ce..6407792e 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationViewModel.kt @@ -62,7 +62,7 @@ class EventRegistrationViewModel @Inject constructor( fun setEventStartDate(eventDate: LocalDate) { if (!isValidStartDate(eventDate)) { - emitValidationErrorMessage("최소 하루 이상 일정 날짜를 지정하세요.") + emitValidationErrorMessage("최소 하루 이상 일정 날짜를 지정 하세요.") return } _eventStartDate.value = eventDate @@ -89,11 +89,11 @@ class EventRegistrationViewModel @Inject constructor( fun setEventRegistrationState() { if (_currentRegistrationState.value == EVENT_DETAILS) { if (!isValidTitle()) { - emitValidationErrorMessage("행사 이름을 입력하세요.") + emitValidationErrorMessage("행사 이름을 입력 하세요.") return } if (!isValidContent()) { - emitValidationErrorMessage("행사 내용을 입력하세요.") + emitValidationErrorMessage("행사 내용을 입력 하세요.") return } _currentRegistrationState.value = EVENT_SCHEDULE @@ -102,7 +102,7 @@ class EventRegistrationViewModel @Inject constructor( fun registerEvent() { if (!isValidLocation()) { - emitValidationErrorMessage("장소를 입력하세요.") + emitValidationErrorMessage("장소를 입력 하세요.") return } viewModelScope.launch { diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementScreen.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementScreen.kt index 23202bcf..462291d2 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementScreen.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementScreen.kt @@ -101,15 +101,14 @@ internal fun ManagementScreen( containerColor = WappTheme.colors.backgroundBlack, snackbarHost = { SnackbarHost(snackBarHostState) }, contentWindowInsets = WindowInsets(0.dp), - topBar = { - WappLeftMainTopBar( - titleRes = R.string.management, - contentRes = R.string.management_content, - ) - }, ) { paddingValues -> LazyColumn(modifier = Modifier.padding(paddingValues)) { item { + WappLeftMainTopBar( + titleRes = R.string.management, + contentRes = R.string.management_content, + ) + ManagementEventCard( eventsState = eventsState, onCardClicked = navigateToEventEdit, From 974b87dee00393a5f91e01f3ab6641987af14261 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 22:16:07 +0900 Subject: [PATCH 13/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20Main=20Bar=20?= =?UTF-8?q?=ED=95=98=EB=8B=A8=20=EB=A7=88=EC=A7=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/wap/designsystem/component/MainTopBar.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/designsystem/src/main/java/com/wap/designsystem/component/MainTopBar.kt b/core/designsystem/src/main/java/com/wap/designsystem/component/MainTopBar.kt index 5dfff653..b8e6904b 100644 --- a/core/designsystem/src/main/java/com/wap/designsystem/component/MainTopBar.kt +++ b/core/designsystem/src/main/java/com/wap/designsystem/component/MainTopBar.kt @@ -35,7 +35,7 @@ fun WappLeftMainTopBar( verticalArrangement = Arrangement.spacedBy(16.dp), horizontalAlignment = Alignment.Start, modifier = modifier - .padding(top = 40.dp, start = 24.dp, end = 24.dp, bottom = 20.dp) + .padding(top = 40.dp, start = 24.dp, end = 24.dp, bottom = 40.dp) .fillMaxWidth() .wrapContentHeight(), ) { @@ -79,7 +79,7 @@ fun WappRightMainTopBar( verticalArrangement = Arrangement.spacedBy(16.dp), horizontalAlignment = Alignment.End, modifier = modifier - .padding(top = 40.dp, start = 24.dp, end = 24.dp, bottom = 20.dp) + .padding(top = 40.dp, start = 24.dp, end = 24.dp, bottom = 40.dp) .fillMaxWidth() .wrapContentHeight(), ) { From 721106c37e1a42f2b5b2c953163cb1a5e7059eb9 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 22:37:34 +0900 Subject: [PATCH 14/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=ED=99=95=EC=9D=B8=20=ED=83=91=EB=B0=94=20=EB=92=A4?= =?UTF-8?q?=EB=A1=9C=EA=B0=80=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20=EC=83=89?= =?UTF-8?q?=EC=83=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/deploymentTargetDropDown.xml | 15 +-------------- .../survey/check/detail/SurveyDetailTopBar.kt | 4 ++-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 02da711d..0c0c3383 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -3,20 +3,7 @@ - - - - - - - - - - - - - - + diff --git a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailTopBar.kt b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailTopBar.kt index 173cab53..5028b1ca 100644 --- a/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailTopBar.kt +++ b/feature/survey-check/src/main/java/com/wap/wapp/feature/survey/check/detail/SurveyDetailTopBar.kt @@ -16,7 +16,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.wap.designsystem.WappTheme -import com.wap.wapp.core.designresource.R.drawable import com.wap.wapp.feature.survey.check.R @OptIn(ExperimentalMaterial3Api::class) @@ -37,9 +36,10 @@ internal fun SurveyDetailTopBar( }, navigationIcon = { Icon( - painter = painterResource(id = drawable.ic_back), + painter = painterResource(id = com.wap.wapp.core.designsystem.R.drawable.ic_back), contentDescription = stringResource(com.wap.wapp.core.designsystem.R.string.back_button), + tint = WappTheme.colors.white, modifier = Modifier .padding(start = 16.dp) .clickable { onBackButtonClicked() }, From add34aa13f2dfb48ec61d7ada46f9781bfe4134e Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 22:53:55 +0900 Subject: [PATCH 15/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=EC=9D=91=EB=8B=B5=20OverView=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20UI=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/survey/answer/SurveyOverview.kt | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyOverview.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyOverview.kt index 3fd8a217..f15afbdd 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyOverview.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyOverview.kt @@ -1,15 +1,21 @@ package com.wap.wapp.feature.survey.answer +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.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape 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.stringResource -import androidx.compose.ui.text.SpanStyle -import androidx.compose.ui.text.buildAnnotatedString -import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp import com.wap.designsystem.WappTheme import com.wap.designsystem.component.WappButton @@ -59,19 +65,29 @@ internal fun SurveyOverview( @Composable private fun SurveyOverviewText(category: String, content: String) { - Text( - text = buildAnnotatedString { - withStyle( - SpanStyle(color = WappTheme.colors.white), - ) { - append("$category : ") - } - withStyle( - SpanStyle(color = WappTheme.colors.yellow34), - ) { - append(content) - } - }, - style = WappTheme.typography.titleBold, - ) + Row(modifier = Modifier.fillMaxWidth()) { + Text( + text = category, + color = WappTheme.colors.white, + style = WappTheme.typography.titleBold, + ) + + Spacer(modifier = Modifier.weight(1f)) + + Box( + modifier = Modifier + .width(200.dp) + .clip(RoundedCornerShape(8.dp)) + .background(WappTheme.colors.black25), + ) { + Text( + text = content, + color = WappTheme.colors.white, + style = WappTheme.typography.contentMedium, + modifier = Modifier + .align(Alignment.Center) + .padding(vertical = 10.dp), + ) + } + } } From 84144eb5c5e701ae15887c5193f159108cfd879d Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 23:04:15 +0900 Subject: [PATCH 16/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=9D=BC?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EC=84=A4=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20Dialog=20=EB=A7=88=EC=A7=84=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wapp/feature/management/event/edit/EventEditScreen.kt | 6 +++--- .../profilesetting/component/ProfileSettingDialog.kt | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt index 93475723..93a59fe8 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt @@ -287,7 +287,7 @@ private fun DeleteEventDialog( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier .wrapContentSize() - .padding(horizontal = 30.dp) + .padding(horizontal = 20.dp) .clip(RoundedCornerShape(8.dp)) .background(WappTheme.colors.black25), ) { @@ -307,7 +307,7 @@ private fun DeleteEventDialog( text = generateDialogContentString(), style = WappTheme.typography.contentRegular, color = WappTheme.colors.white, - modifier = Modifier.padding(top = 12.dp, start = 12.dp, end = 12.dp), + modifier = Modifier.padding(horizontal = 12.dp), ) Row( @@ -361,7 +361,7 @@ private fun DeleteEventDialog( @Composable private fun generateDialogContentString() = buildAnnotatedString { - append("정말로 해당 일정을 삭제하시겠습니까?\n") + append("정말로 해당 일정을 삭제하시겠습니까?\n\n") withStyle( style = SpanStyle( textDecoration = TextDecoration.Underline, diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/ProfileSettingDialog.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/ProfileSettingDialog.kt index 0796aa7a..2f85bac7 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/ProfileSettingDialog.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/ProfileSettingDialog.kt @@ -7,8 +7,9 @@ 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.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentSize +import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -46,7 +47,8 @@ internal fun ProfileSettingDialog( verticalArrangement = Arrangement.spacedBy(16.dp), horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier - .wrapContentSize() + .wrapContentHeight() + .fillMaxWidth() .padding(horizontal = 30.dp) .clip(RoundedCornerShape(8.dp)) .background(WappTheme.colors.black25), From 943ad409641d1d119881e74a6878dd5f63a45ce4 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 23:06:51 +0900 Subject: [PATCH 17/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=95=84=EC=9B=83=20=EB=B0=8F=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=ED=83=88=ED=87=B4=20Dialog=20=EB=A7=88=EC=A7=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/profilesetting/component/ProfileSettingDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/ProfileSettingDialog.kt b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/ProfileSettingDialog.kt index 2f85bac7..c0e6bd3d 100644 --- a/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/ProfileSettingDialog.kt +++ b/feature/profile/src/main/java/com/wap/wapp/feature/profile/profilesetting/component/ProfileSettingDialog.kt @@ -49,7 +49,7 @@ internal fun ProfileSettingDialog( modifier = Modifier .wrapContentHeight() .fillMaxWidth() - .padding(horizontal = 30.dp) + .padding(horizontal = 20.dp) .clip(RoundedCornerShape(8.dp)) .background(WappTheme.colors.black25), ) { From c73ff35862d7e90493092d744c0b338f4571426d Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 23:09:57 +0900 Subject: [PATCH 18/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=EC=9D=91=EB=8B=B5=20Indicator=20=EC=83=89=EC=83=81?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/survey/answer/SurveyAnswerStateIndicator.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt index c341a737..13568264 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt @@ -45,11 +45,12 @@ private fun SurveyAnswerStateText(index: Int, size: Int) { @Composable private fun SurveyAnswerStateProgressBar(index: Int, size: Int) { LinearProgressIndicator( - modifier = Modifier - .fillMaxWidth() - .height(10.dp), color = WappTheme.colors.yellow34, + trackColor = WappTheme.colors.white, progress = index.toFloat() / size.toFloat(), strokeCap = StrokeCap.Round, + modifier = Modifier + .fillMaxWidth() + .height(10.dp), ) } From 6f960dff714317aa9cff512cee268c7bc58b2259 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 23:19:54 +0900 Subject: [PATCH 19/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=EC=9D=91=EB=8B=B5=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=A3=BC=EA=B4=80=EC=8B=9D=20UI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/survey/answer/SubjectiveSurveyForm.kt | 11 +++++------ .../wapp/feature/survey/answer/SurveyAnswerForm.kt | 5 +---- .../survey/answer/SurveyAnswerStateIndicator.kt | 5 +++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SubjectiveSurveyForm.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SubjectiveSurveyForm.kt index 84e427c3..d01e0fe6 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SubjectiveSurveyForm.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SubjectiveSurveyForm.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -23,20 +24,18 @@ internal fun SubjectiveSurveyForm( onAnswerChanged: (String) -> Unit, modifier: Modifier = Modifier, ) { - Column( - modifier = modifier, - verticalArrangement = Arrangement.spacedBy(40.dp), - ) { + Column(modifier = modifier) { Text( text = questionTitle, - style = WappTheme.typography.titleRegular, + style = WappTheme.typography.titleMedium, color = WappTheme.colors.white, fontSize = 22.sp, + modifier = Modifier.padding(bottom = 40.dp), ) Column( modifier = Modifier.fillMaxWidth(), - verticalArrangement = Arrangement.spacedBy(4.dp), + verticalArrangement = Arrangement.spacedBy(10.dp), ) { WappRoundedTextField( value = answer, diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt index 61582b85..9a1d8195 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt @@ -24,10 +24,7 @@ internal fun SurveyAnswerForm( onNextQuestionButtonClicked: () -> Unit, onPreviousQuestionButtonClicked: () -> Unit, ) { - Column( - verticalArrangement = Arrangement.spacedBy(40.dp), - modifier = modifier, - ) { + Column(modifier = modifier) { val surveyQuestion = surveyForm.surveyQuestionList[questionNumber] val lastQuestionNumber = surveyForm.surveyQuestionList.lastIndex diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt index 13568264..da16a291 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt @@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -20,6 +22,9 @@ internal fun SurveyAnswerStateIndicator(index: Int, size: Int) { Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier + .wrapContentSize() + .padding(bottom = 40.dp), ) { SurveyAnswerStateProgressBar(index = index, size = size) SurveyAnswerStateText(index = index, size = size) From fe230b9e43b6e98310f053c53e90f08ca3446951 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 23:22:16 +0900 Subject: [PATCH 20/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=EC=9D=91=EB=8B=B5=20=EA=B0=9D=EA=B4=80=EC=8B=9D=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20UI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wap/wapp/feature/survey/answer/ObjectiveSurveyForm.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/ObjectiveSurveyForm.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/ObjectiveSurveyForm.kt index 5f5ddbf3..8a1f03a2 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/ObjectiveSurveyForm.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/ObjectiveSurveyForm.kt @@ -29,7 +29,7 @@ internal fun ObjectiveSurveyForm( ) { Column( modifier = modifier, - verticalArrangement = Arrangement.spacedBy(32.dp), + verticalArrangement = Arrangement.spacedBy(40.dp), ) { Text( text = questionTitle, From d09185ad1bbf4348e1075d7280dd02d1b97c6a76 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 23:35:56 +0900 Subject: [PATCH 21/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=EC=9D=91=EB=8B=B5=20ProgressBar=20Animation?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/answer/SurveyAnswerStateIndicator.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt index da16a291..e00d723c 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerStateIndicator.kt @@ -1,5 +1,8 @@ package com.wap.wapp.feature.survey.answer +import androidx.compose.animation.core.Spring +import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.animation.core.spring import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -10,6 +13,7 @@ import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.StrokeCap @@ -49,10 +53,18 @@ private fun SurveyAnswerStateText(index: Int, size: Int) { @Composable private fun SurveyAnswerStateProgressBar(index: Int, size: Int) { + val progress by animateFloatAsState( + targetValue = index.toFloat() / size.toFloat(), + animationSpec = spring( + stiffness = Spring.StiffnessMediumLow, + dampingRatio = Spring.DampingRatioMediumBouncy, + ), + ) + LinearProgressIndicator( color = WappTheme.colors.yellow34, trackColor = WappTheme.colors.white, - progress = index.toFloat() / size.toFloat(), + progress = progress, strokeCap = StrokeCap.Round, modifier = Modifier .fillMaxWidth() From 8e0c8ea60bc4cfdf3c958ee4fdc19833240683c5 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Fri, 16 Feb 2024 23:38:49 +0900 Subject: [PATCH 22/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EB=AA=A8?= =?UTF-8?q?=EB=93=A0=20ProgressBar=20Animation=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../management/event/edit/EventEditScreen.kt | 13 ++++++++++++- .../event/registration/EventRegistrationScreen.kt | 13 ++++++++++++- .../management/survey/SurveyFormStateIndicator.kt | 14 +++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt index 93a59fe8..ec1a0e55 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt @@ -1,5 +1,8 @@ package com.wap.wapp.feature.management.event.edit +import androidx.compose.animation.core.Spring +import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.animation.core.spring import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement @@ -260,13 +263,21 @@ private fun EventEditStateText( private fun EventEditStateProgressBar( currentRegistrationProgress: Float, ) { + val progress by animateFloatAsState( + targetValue = currentRegistrationProgress, + animationSpec = spring( + stiffness = Spring.StiffnessMediumLow, + dampingRatio = Spring.DampingRatioMediumBouncy, + ), + ) + LinearProgressIndicator( modifier = Modifier .fillMaxWidth() .height(10.dp), color = WappTheme.colors.yellow34, trackColor = WappTheme.colors.white, - progress = currentRegistrationProgress, + progress = progress, strokeCap = StrokeCap.Round, ) } diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt index 48bd84d1..973942e8 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt @@ -1,5 +1,8 @@ package com.wap.wapp.feature.management.event.registration +import androidx.compose.animation.core.Spring +import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.animation.core.spring import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -227,13 +230,21 @@ private fun EventRegistrationStateText( private fun EventRegistrationStateProgressBar( currentRegistrationProgress: Float, ) { + val progress by animateFloatAsState( + targetValue = currentRegistrationProgress, + animationSpec = spring( + stiffness = Spring.StiffnessMediumLow, + dampingRatio = Spring.DampingRatioMediumBouncy, + ), + ) + LinearProgressIndicator( modifier = Modifier .fillMaxWidth() .height(10.dp), color = WappTheme.colors.yellow34, trackColor = WappTheme.colors.white, - progress = currentRegistrationProgress, + progress = progress, strokeCap = StrokeCap.Round, ) } diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormStateIndicator.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormStateIndicator.kt index 48696ba9..1ebd8d6d 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormStateIndicator.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormStateIndicator.kt @@ -1,5 +1,8 @@ package com.wap.wapp.feature.management.survey +import androidx.compose.animation.core.Spring +import androidx.compose.animation.core.animateFloatAsState +import androidx.compose.animation.core.spring import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -8,6 +11,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.StrokeCap @@ -52,13 +56,21 @@ private fun SurveyRegistrationStateText( private fun SurveyRegistrationStateProgressBar( currentRegistrationProgress: Float, ) { + val progress by animateFloatAsState( + targetValue = currentRegistrationProgress, + animationSpec = spring( + stiffness = Spring.StiffnessMediumLow, + dampingRatio = Spring.DampingRatioMediumBouncy, + ), + ) + LinearProgressIndicator( modifier = Modifier .fillMaxWidth() .height(10.dp), color = WappTheme.colors.yellow34, trackColor = WappTheme.colors.white, - progress = currentRegistrationProgress, + progress = progress, strokeCap = StrokeCap.Round, ) } From 6c472a6693bf3e45910f1a3cab6e8ce63f783ccc Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 01:05:51 +0900 Subject: [PATCH 23/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EB=B3=91?= =?UTF-8?q?=EB=A0=AC=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EB=B0=9B=EC=95=84=EC=84=9C=20=EA=B0=80=EB=81=94=20?= =?UTF-8?q?Loading=20=EC=83=81=ED=83=9C=20=EA=B0=B1=EC=8B=A0=20=EC=95=88?= =?UTF-8?q?=EB=90=9C=EB=8D=98=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../management/event/edit/EventEditScreen.kt | 7 +++ .../registration/EventRegistrationContent.kt | 13 ++---- .../registration/EventRegistrationScreen.kt | 7 +++ .../management/survey/SurveyEventContent.kt | 6 ++- .../management/survey/SurveyFormContent.kt | 8 +--- .../survey/SurveyInformationContent.kt | 8 +--- .../survey/SurveyQuestionContent.kt | 6 +-- .../survey/edit/SurveyFormEditScreen.kt | 46 +++++++++++++------ .../management/ManagementSurveyCard.kt | 6 +-- .../feature/management/ManagementViewModel.kt | 44 ++++++++++-------- 10 files changed, 85 insertions(+), 66 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt index ec1a0e55..2eeeda5f 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/edit/EventEditScreen.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets @@ -15,7 +16,9 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentSize +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Divider @@ -159,6 +162,7 @@ internal fun EventEditScreen( var showEndTimePicker by remember { mutableStateOf(false) } var showDeleteEventDialog by remember { mutableStateOf(false) } val timePickerState = rememberTimePickerState() + val scrollState = rememberScrollState() Scaffold( snackbarHost = { SnackbarHost(snackBarHostState) }, @@ -177,6 +181,8 @@ internal fun EventEditScreen( Column( modifier = Modifier .fillMaxSize() + .verticalScroll(scrollState) + .height(IntrinsicSize.Max) .padding(paddingValues) .padding(vertical = 16.dp), ) { @@ -203,6 +209,7 @@ internal fun EventEditScreen( startTime = startTime, endDate = endDate, endTime = endTime, + scrollState = scrollState, showStartDatePicker = showStartDatePicker, showStartTimePicker = showStartTimePicker, showEndDatePicker = showEndDatePicker, diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt index 759a93fa..93f00935 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt @@ -1,16 +1,14 @@ package com.wap.wapp.feature.management.event.registration +import androidx.compose.foundation.ScrollState import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.material3.TimePickerState @@ -50,6 +48,7 @@ internal fun EventRegistrationContent( showStartTimePicker: Boolean, showEndDatePicker: Boolean, showEndTimePicker: Boolean, + scrollState: ScrollState, timePickerState: TimePickerState, onTitleChanged: (String) -> Unit, onContentChanged: (String) -> Unit, @@ -65,15 +64,9 @@ internal fun EventRegistrationContent( onNextButtonClicked: () -> Unit, onRegisterButtonClicked: () -> Unit, ) { - val scrollState = rememberScrollState() val coroutineScope = rememberCoroutineScope() - Column( - modifier = modifier - .fillMaxSize() - .verticalScroll(scrollState) - .height(IntrinsicSize.Max), - ) { + Column(modifier = modifier.fillMaxSize()) { when (eventRegistrationState) { EventRegistrationState.EVENT_DETAILS -> EventDetailsContent( eventTitle = eventTitle, diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt index 973942e8..ab8fb5ab 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationScreen.kt @@ -5,12 +5,15 @@ import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.spring import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.Scaffold @@ -134,6 +137,7 @@ internal fun EventRegistrationScreen( var showEndDatePicker by remember { mutableStateOf(false) } var showEndTimePicker by remember { mutableStateOf(false) } val timePickerState = rememberTimePickerState() + val scrollState = rememberScrollState() Scaffold( snackbarHost = { SnackbarHost(snackBarHostState) }, @@ -145,6 +149,8 @@ internal fun EventRegistrationScreen( Column( modifier = Modifier .fillMaxSize() + .verticalScroll(scrollState) + .height(IntrinsicSize.Max) .padding(paddingValues) // paddingValue padding .padding(top = 20.dp), // dp value padding ) { @@ -170,6 +176,7 @@ internal fun EventRegistrationScreen( startTime = startTime, endDate = endDate, endTime = endTime, + scrollState = scrollState, showStartDatePicker = showStartDatePicker, showStartTimePicker = showStartTimePicker, showEndDatePicker = showEndDatePicker, diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyEventContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyEventContent.kt index db8409d3..12701cf2 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyEventContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyEventContent.kt @@ -4,8 +4,10 @@ import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items @@ -38,7 +40,9 @@ internal fun SurveyEventContent( LazyColumn( verticalArrangement = Arrangement.spacedBy(16.dp), - modifier = Modifier.weight(1f), + modifier = Modifier + .fillMaxWidth() + .height(IntrinsicSize.Max), ) { when (eventsState) { is EventsState.Loading -> item { diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormContent.kt index ce2a49fc..cae6a975 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormContent.kt @@ -87,9 +87,7 @@ internal fun SurveyFormContent( onAddSurveyQuestionButtonClicked = onAddQuestionButtonClicked, currentQuestionNumber = currentQuestionNumber, totalQuestionNumber = totalQuestionNumber, - onPreviousButtonClicked = { - onPreviousButtonClicked(SurveyFormState.INFORMATION) - }, + onPreviousButtonClicked = { onPreviousButtonClicked(SurveyFormState.INFORMATION) }, onNextButtonClicked = { onNextButtonClicked( SurveyFormState.QUESTION, @@ -113,9 +111,7 @@ internal fun SurveyFormContent( onTimeChanged = onTimeChanged, onRegisterButtonClicked = onRegisterButtonClicked, onDatePickerStateChanged = onDatePickerStateChanged, - onPreviousButtonClicked = { - onPreviousButtonClicked(SurveyFormState.QUESTION) - }, + onPreviousButtonClicked = { onPreviousButtonClicked(SurveyFormState.QUESTION) }, ) } } diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt index ba91f118..14af03fc 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt @@ -8,8 +8,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -29,13 +27,9 @@ internal fun SurveyInformationContent( onPreviousButtonClicked: () -> Unit, onNextButtonClicked: () -> Unit, ) { - val scrollState = rememberScrollState() - Column( verticalArrangement = Arrangement.spacedBy(16.dp), - modifier = Modifier - .fillMaxSize() - .verticalScroll(scrollState), + modifier = Modifier.fillMaxSize(), ) { WappTitle( title = stringResource(R.string.survey_information_title), diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyQuestionContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyQuestionContent.kt index 1b1f6adf..5076a4c7 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyQuestionContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyQuestionContent.kt @@ -51,13 +51,9 @@ internal fun SurveyQuestionContent( onNextButtonClicked: () -> Unit, onAddSurveyQuestionButtonClicked: () -> Unit, ) { - val scrollState = rememberScrollState() - Column( verticalArrangement = Arrangement.spacedBy(10.dp), - modifier = Modifier - .fillMaxSize() - .verticalScroll(scrollState), + modifier = Modifier.fillMaxSize() ) { WappTitle( title = stringResource(R.string.survey_question_title), diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt index 04f812d6..df946301 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt @@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost @@ -17,6 +19,10 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.input.nestedscroll.NestedScrollConnection +import androidx.compose.ui.input.nestedscroll.NestedScrollSource +import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -55,9 +61,22 @@ internal fun SurveyFormEditScreen( val timePickerState = rememberTimePickerState() var showDatePicker by remember { mutableStateOf(false) } var showTimePicker by remember { mutableStateOf(false) } - + val scrollState = rememberScrollState() var showDeleteSurveyDialog by remember { mutableStateOf(false) } + val nestedScrollConnection = remember { + object : NestedScrollConnection { + override fun onPreScroll( + available: Offset, + source: NestedScrollSource, + ): Offset { + + return Offset.Zero + } + } + } + + LaunchedEffect(true) { viewModel.getSurveyForm(surveyFormId) @@ -83,21 +102,12 @@ internal fun SurveyFormEditScreen( containerColor = WappTheme.colors.backgroundBlack, modifier = Modifier.fillMaxSize(), contentWindowInsets = WindowInsets(0.dp), - topBar = { - WappSubTopBar( - titleRes = R.string.survey_edit, - showLeftButton = true, - showRightButton = true, - leftButtonDrawableRes = drawable.ic_close, - modifier = Modifier.padding(top = 16.dp), - onClickLeftButton = navigateToManagement, - onClickRightButton = { showDeleteSurveyDialog = true }, - ) - }, ) { paddingValues -> Column( modifier = Modifier .fillMaxSize() + .nestedScroll(nestedScrollConnection) + .verticalScroll(scrollState) .padding(paddingValues) // paddingValue padding .padding(vertical = 16.dp, horizontal = 20.dp), // dp value padding verticalArrangement = Arrangement.spacedBy(20.dp), @@ -109,10 +119,18 @@ internal fun SurveyFormEditScreen( ) } - SurveyFormStateIndicator( - surveyRegistrationState = currentRegistrationState, + WappSubTopBar( + titleRes = R.string.survey_edit, + showLeftButton = true, + showRightButton = true, + leftButtonDrawableRes = drawable.ic_close, + modifier = Modifier.padding(top = 16.dp), + onClickLeftButton = navigateToManagement, + onClickRightButton = { showDeleteSurveyDialog = true }, ) + SurveyFormStateIndicator(surveyRegistrationState = currentRegistrationState) + SurveyFormContent( surveyRegistrationState = currentRegistrationState, eventsState = eventList, diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementSurveyCard.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementSurveyCard.kt index 89deda34..3e114b6e 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementSurveyCard.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementSurveyCard.kt @@ -40,9 +40,7 @@ internal fun ManagementSurveyCard( ) { Card( shape = RoundedCornerShape(10.dp), - colors = CardDefaults.cardColors( - containerColor = WappTheme.colors.black25, - ), + colors = CardDefaults.cardColors(containerColor = WappTheme.colors.black25), modifier = Modifier .padding(vertical = 20.dp) .padding(horizontal = 8.dp), @@ -73,7 +71,7 @@ private fun ManagementSurveyContent( onAddSurveyButtonClicked: () -> Unit, ) { when (surveyFormsState) { - is ManagementViewModel.SurveyFormsState.Init -> { } + is ManagementViewModel.SurveyFormsState.Init -> {} is ManagementViewModel.SurveyFormsState.Loading -> CircleLoader( modifier = Modifier .fillMaxWidth() diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementViewModel.kt index 30f88485..8d940ff4 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementViewModel.kt @@ -10,6 +10,7 @@ import com.wap.wapp.core.model.event.Event import com.wap.wapp.core.model.survey.SurveyForm import com.wap.wapp.core.model.user.UserRole import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.async import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharedFlow @@ -50,31 +51,36 @@ class ManagementViewModel @Inject constructor( } fun getEventSurveyList() = viewModelScope.launch { - launch { getMonthEventList() } - getSurveyFormList() - } - - private suspend fun getMonthEventList() { _eventList.value = EventsState.Loading + _surveyFormList.value = SurveyFormsState.Loading - getMonthEventListUseCase(generateNowDate()).onSuccess { events -> - _eventList.value = EventsState.Success(events) - }.onFailure { exception -> - _errorFlow.emit(exception) - _eventList.value = EventsState.Failure(exception) - } + val monthEventList = async { getMonthEventList() } + val surveyFormList = async { getSurveyFormList() } + + _eventList.value = monthEventList.await() + _surveyFormList.value = surveyFormList.await() } - private suspend fun getSurveyFormList() { - _surveyFormList.value = SurveyFormsState.Loading + private suspend fun getMonthEventList(): EventsState = + getMonthEventListUseCase(generateNowDate()).fold( + onSuccess = { events -> + EventsState.Success(events) + }, + onFailure = { exception -> + _errorFlow.emit(exception) + EventsState.Failure(exception) + }, + ) - getSurveyFormListUseCase().onSuccess { surveyForms -> - _surveyFormList.value = SurveyFormsState.Success(surveyForms) - }.onFailure { exception -> + private suspend fun getSurveyFormList(): SurveyFormsState = getSurveyFormListUseCase().fold( + onSuccess = { surveyForms -> + SurveyFormsState.Success(surveyForms) + }, + onFailure = { exception -> _errorFlow.emit(exception) - _eventList.value = EventsState.Failure(exception) - } - } + SurveyFormsState.Failure(exception) + }, + ) sealed class UserRoleUiState { data object Init : UserRoleUiState() From 424ade0c07d5136df8384c6c52f6ac2d9c4ac5d1 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 01:20:21 +0900 Subject: [PATCH 24/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EB=B3=91?= =?UTF-8?q?=EB=A0=AC=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EB=B0=9B=EC=95=84=EC=84=9C=20=EA=B0=80=EB=81=94=20?= =?UTF-8?q?Loading=20=EC=83=81=ED=83=9C=20=EA=B0=B1=EC=8B=A0=20=EC=95=88?= =?UTF-8?q?=EB=90=9C=EB=8D=98=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/SurveyDeadlineContent.kt | 8 ++- .../survey/SurveyInformationContent.kt | 8 ++- .../survey/SurveyQuestionContent.kt | 8 ++- .../survey/edit/SurveyFormEditScreen.kt | 22 -------- .../feature/management/ManagementEventCard.kt | 1 - .../management/ManagementSurveyCard.kt | 5 +- .../feature/management/ManagementViewModel.kt | 52 ++++++++----------- 7 files changed, 44 insertions(+), 60 deletions(-) diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyDeadlineContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyDeadlineContent.kt index 89bb23cc..3ab0a169 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyDeadlineContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyDeadlineContent.kt @@ -8,7 +8,9 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.ExperimentalMaterial3Api @@ -66,9 +68,13 @@ internal fun SurveyDeadlineContent( ) } + val scrollState = rememberScrollState() + Column( - modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(20.dp), + modifier = Modifier + .fillMaxSize() + .verticalScroll(scrollState), ) { WappTitle( title = stringResource(R.string.survey_deadline_title), diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt index 14af03fc..ba91f118 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt @@ -8,6 +8,8 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -27,9 +29,13 @@ internal fun SurveyInformationContent( onPreviousButtonClicked: () -> Unit, onNextButtonClicked: () -> Unit, ) { + val scrollState = rememberScrollState() + Column( verticalArrangement = Arrangement.spacedBy(16.dp), - modifier = Modifier.fillMaxSize(), + modifier = Modifier + .fillMaxSize() + .verticalScroll(scrollState), ) { WappTitle( title = stringResource(R.string.survey_information_title), diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyQuestionContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyQuestionContent.kt index 5076a4c7..076036df 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyQuestionContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyQuestionContent.kt @@ -30,11 +30,11 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp -import com.wap.wapp.core.designresource.R.drawable import com.wap.designsystem.WappTheme import com.wap.designsystem.component.WappButton import com.wap.designsystem.component.WappRoundedTextField import com.wap.designsystem.component.WappTitle +import com.wap.wapp.core.designresource.R.drawable import com.wap.wapp.core.model.survey.QuestionType @Composable @@ -51,9 +51,13 @@ internal fun SurveyQuestionContent( onNextButtonClicked: () -> Unit, onAddSurveyQuestionButtonClicked: () -> Unit, ) { + val scrollState = rememberScrollState() + Column( verticalArrangement = Arrangement.spacedBy(10.dp), - modifier = Modifier.fillMaxSize() + modifier = Modifier + .fillMaxSize() + .verticalScroll(scrollState), ) { WappTitle( title = stringResource(R.string.survey_question_title), diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt index df946301..0df168cc 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt @@ -5,8 +5,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost @@ -19,10 +17,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.input.nestedscroll.NestedScrollConnection -import androidx.compose.ui.input.nestedscroll.NestedScrollSource -import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -61,22 +55,8 @@ internal fun SurveyFormEditScreen( val timePickerState = rememberTimePickerState() var showDatePicker by remember { mutableStateOf(false) } var showTimePicker by remember { mutableStateOf(false) } - val scrollState = rememberScrollState() var showDeleteSurveyDialog by remember { mutableStateOf(false) } - val nestedScrollConnection = remember { - object : NestedScrollConnection { - override fun onPreScroll( - available: Offset, - source: NestedScrollSource, - ): Offset { - - return Offset.Zero - } - } - } - - LaunchedEffect(true) { viewModel.getSurveyForm(surveyFormId) @@ -106,8 +86,6 @@ internal fun SurveyFormEditScreen( Column( modifier = Modifier .fillMaxSize() - .nestedScroll(nestedScrollConnection) - .verticalScroll(scrollState) .padding(paddingValues) // paddingValue padding .padding(vertical = 16.dp, horizontal = 20.dp), // dp value padding verticalArrangement = Arrangement.spacedBy(20.dp), diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementEventCard.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementEventCard.kt index 3e0f89ad..565ff8ba 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementEventCard.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementEventCard.kt @@ -69,7 +69,6 @@ private fun ManagementEventContent( onAddEventButtonClicked: () -> Unit, ) { when (eventsState) { - is ManagementViewModel.EventsState.Init -> {} is ManagementViewModel.EventsState.Loading -> CircleLoader( modifier = Modifier .fillMaxWidth() diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementSurveyCard.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementSurveyCard.kt index 3e114b6e..60f27981 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementSurveyCard.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementSurveyCard.kt @@ -47,7 +47,9 @@ internal fun ManagementSurveyCard( ) { Column( verticalArrangement = Arrangement.spacedBy(16.dp), - modifier = Modifier.padding(16.dp), + modifier = Modifier + .padding(16.dp) + .fillMaxWidth(), ) { Text( text = stringResource(string.survey), @@ -71,7 +73,6 @@ private fun ManagementSurveyContent( onAddSurveyButtonClicked: () -> Unit, ) { when (surveyFormsState) { - is ManagementViewModel.SurveyFormsState.Init -> {} is ManagementViewModel.SurveyFormsState.Loading -> CircleLoader( modifier = Modifier .fillMaxWidth() diff --git a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementViewModel.kt b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementViewModel.kt index 8d940ff4..96daae7a 100644 --- a/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementViewModel.kt +++ b/feature/management/src/main/java/com/wap/wapp/feature/management/ManagementViewModel.kt @@ -10,7 +10,6 @@ import com.wap.wapp.core.model.event.Event import com.wap.wapp.core.model.survey.SurveyForm import com.wap.wapp.core.model.user.UserRole import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.async import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharedFlow @@ -34,10 +33,10 @@ class ManagementViewModel @Inject constructor( val userRole: StateFlow = _userRole.asStateFlow() private val _surveyFormList: MutableStateFlow = - MutableStateFlow(SurveyFormsState.Init) + MutableStateFlow(SurveyFormsState.Loading) val surveyFormList: StateFlow = _surveyFormList.asStateFlow() - private val _eventList: MutableStateFlow = MutableStateFlow(EventsState.Init) + private val _eventList: MutableStateFlow = MutableStateFlow(EventsState.Loading) val eventList: StateFlow = _eventList.asStateFlow() fun getUserRole() = viewModelScope.launch { @@ -51,36 +50,29 @@ class ManagementViewModel @Inject constructor( } fun getEventSurveyList() = viewModelScope.launch { - _eventList.value = EventsState.Loading - _surveyFormList.value = SurveyFormsState.Loading - - val monthEventList = async { getMonthEventList() } - val surveyFormList = async { getSurveyFormList() } - - _eventList.value = monthEventList.await() - _surveyFormList.value = surveyFormList.await() + getMonthEventList() + getSurveyFormList() } - private suspend fun getMonthEventList(): EventsState = - getMonthEventListUseCase(generateNowDate()).fold( - onSuccess = { events -> - EventsState.Success(events) - }, - onFailure = { exception -> - _errorFlow.emit(exception) - EventsState.Failure(exception) - }, - ) + private suspend fun getMonthEventList() { + _eventList.value = EventsState.Loading + getMonthEventListUseCase(generateNowDate()).onSuccess { events -> + _eventList.value = EventsState.Success(events) + }.onFailure { exception -> + _errorFlow.emit(exception) + _eventList.value = EventsState.Failure(exception) + } + } - private suspend fun getSurveyFormList(): SurveyFormsState = getSurveyFormListUseCase().fold( - onSuccess = { surveyForms -> - SurveyFormsState.Success(surveyForms) - }, - onFailure = { exception -> + private suspend fun getSurveyFormList() { + _surveyFormList.value = SurveyFormsState.Loading + getSurveyFormListUseCase().onSuccess { surveyForms -> + _surveyFormList.value = SurveyFormsState.Success(surveyForms) + }.onFailure { exception -> _errorFlow.emit(exception) - SurveyFormsState.Failure(exception) - }, - ) + _eventList.value = EventsState.Failure(exception) + } + } sealed class UserRoleUiState { data object Init : UserRoleUiState() @@ -88,14 +80,12 @@ class ManagementViewModel @Inject constructor( } sealed class EventsState { - data object Init : EventsState() data object Loading : EventsState() data class Success(val events: List) : EventsState() data class Failure(val throwable: Throwable) : EventsState() } sealed class SurveyFormsState { - data object Init : SurveyFormsState() data object Loading : SurveyFormsState() data class Success(val surveyForms: List) : SurveyFormsState() data class Failure(val throwable: Throwable) : SurveyFormsState() From fb9ed0b796aa17190dbc252992940ae70a34b4b3 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 01:22:58 +0900 Subject: [PATCH 25/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=EC=AA=BD=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wap/wapp/feature/management/survey/SurveyEventContent.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyEventContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyEventContent.kt index 12701cf2..070bbf85 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyEventContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyEventContent.kt @@ -4,10 +4,8 @@ import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items @@ -42,7 +40,7 @@ internal fun SurveyEventContent( verticalArrangement = Arrangement.spacedBy(16.dp), modifier = Modifier .fillMaxWidth() - .height(IntrinsicSize.Max), + .weight(1f), ) { when (eventsState) { is EventsState.Loading -> item { From 83503623b40ae4ba3595b2bb67b52360af189cde Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 01:31:28 +0900 Subject: [PATCH 26/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=EC=AA=BD=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/edit/SurveyFormEditScreen.kt | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt index 0df168cc..3aabcf9c 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt @@ -80,6 +80,17 @@ internal fun SurveyFormEditScreen( Scaffold( snackbarHost = { SnackbarHost(snackBarHostState) }, containerColor = WappTheme.colors.backgroundBlack, + topBar = { + WappSubTopBar( + titleRes = R.string.survey_edit, + showLeftButton = true, + showRightButton = true, + leftButtonDrawableRes = drawable.ic_close, + modifier = Modifier.padding(top = 16.dp), + onClickLeftButton = navigateToManagement, + onClickRightButton = { showDeleteSurveyDialog = true }, + ) + }, modifier = Modifier.fillMaxSize(), contentWindowInsets = WindowInsets(0.dp), ) { paddingValues -> @@ -97,16 +108,6 @@ internal fun SurveyFormEditScreen( ) } - WappSubTopBar( - titleRes = R.string.survey_edit, - showLeftButton = true, - showRightButton = true, - leftButtonDrawableRes = drawable.ic_close, - modifier = Modifier.padding(top = 16.dp), - onClickLeftButton = navigateToManagement, - onClickRightButton = { showDeleteSurveyDialog = true }, - ) - SurveyFormStateIndicator(surveyRegistrationState = currentRegistrationState) SurveyFormContent( From 7c35a6e6c399733c056111ef25319fa79abc082b Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 01:58:16 +0900 Subject: [PATCH 27/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=20=ED=99=94=EB=A9=B4=20=EC=A0=84=ED=99=98=20=EC=95=A0?= =?UTF-8?q?=EB=8B=88=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../management/survey/SurveyFormContent.kt | 157 ++++++++++-------- 1 file changed, 89 insertions(+), 68 deletions(-) diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormContent.kt index cae6a975..f9498a28 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyFormContent.kt @@ -1,5 +1,11 @@ package com.wap.wapp.feature.management.survey +import androidx.compose.animation.AnimatedContent +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideInHorizontally +import androidx.compose.animation.slideOutHorizontally +import androidx.compose.animation.togetherWith import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.TimePickerState import androidx.compose.runtime.Composable @@ -42,77 +48,92 @@ internal fun SurveyFormContent( onAddQuestionButtonClicked: () -> Unit, onRegisterButtonClicked: () -> Unit, ) { - when (surveyRegistrationState) { - SurveyFormState.EVENT_SELECTION -> { - onEventContentInitialized() - SurveyEventContent( - eventsState = eventsState, - selectedEvent = eventSelection, - onEventSelected = onEventSelected, - onNextButtonClicked = { - onNextButtonClicked( - SurveyFormState.EVENT_SELECTION, - SurveyFormState.INFORMATION, - ) - }, - ) - } + AnimatedContent( + targetState = surveyRegistrationState, + transitionSpec = { + if (targetState.ordinal > initialState.ordinal) { + slideInHorizontally(initialOffsetX = { it }) + fadeIn() togetherWith + slideOutHorizontally(targetOffsetX = { -it }) + fadeOut() + } else { + slideInHorizontally(initialOffsetX = { -it }) + fadeIn() togetherWith + slideOutHorizontally(targetOffsetX = { it }) + fadeOut() + } + }, + ) { registrationState -> + when (registrationState) { + SurveyFormState.EVENT_SELECTION -> { + onEventContentInitialized() + SurveyEventContent( + eventsState = eventsState, + selectedEvent = eventSelection, + onEventSelected = onEventSelected, + onNextButtonClicked = { + onNextButtonClicked( + SurveyFormState.EVENT_SELECTION, + SurveyFormState.INFORMATION, + ) + }, + ) + } - SurveyFormState.INFORMATION -> { - SurveyInformationContent( - title = title, - onTitleChanged = onTitleChanged, - content = content, - onContentChanged = onContentChanged, - onPreviousButtonClicked = { - onPreviousButtonClicked(SurveyFormState.EVENT_SELECTION) - }, - onNextButtonClicked = { - onNextButtonClicked( - SurveyFormState.INFORMATION, - SurveyFormState.QUESTION, - ) - }, - ) - } + SurveyFormState.INFORMATION -> { + SurveyInformationContent( + title = title, + onTitleChanged = onTitleChanged, + content = content, + onContentChanged = onContentChanged, + onPreviousButtonClicked = { + onPreviousButtonClicked(SurveyFormState.EVENT_SELECTION) + }, + onNextButtonClicked = { + onNextButtonClicked( + SurveyFormState.INFORMATION, + SurveyFormState.QUESTION, + ) + }, + ) + } - SurveyFormState.QUESTION -> { - SurveyQuestionContent( - questionTitle = questionTitle, - questionType = questionType, - onQuestionTypeChanged = { defaultQuestionType -> - onQuestionTypeChanged(defaultQuestionType) - }, - onQuestionChanged = onQuestionTitleChanged, - onAddSurveyQuestionButtonClicked = onAddQuestionButtonClicked, - currentQuestionNumber = currentQuestionNumber, - totalQuestionNumber = totalQuestionNumber, - onPreviousButtonClicked = { onPreviousButtonClicked(SurveyFormState.INFORMATION) }, - onNextButtonClicked = { - onNextButtonClicked( - SurveyFormState.QUESTION, - SurveyFormState.DEADLINE, - ) - }, - onPreviousQuestionButtonClicked = onPreviousQuestionButtonClicked, - onNextQuestionButtonClicked = onNextQuestionButtonClicked, - ) - } + SurveyFormState.QUESTION -> { + SurveyQuestionContent( + questionTitle = questionTitle, + questionType = questionType, + onQuestionTypeChanged = { defaultQuestionType -> + onQuestionTypeChanged(defaultQuestionType) + }, + onQuestionChanged = onQuestionTitleChanged, + onAddSurveyQuestionButtonClicked = onAddQuestionButtonClicked, + currentQuestionNumber = currentQuestionNumber, + totalQuestionNumber = totalQuestionNumber, + onPreviousButtonClicked = { + onPreviousButtonClicked(SurveyFormState.INFORMATION) + }, + onNextButtonClicked = { + onNextButtonClicked( + SurveyFormState.QUESTION, + SurveyFormState.DEADLINE, + ) + }, + onPreviousQuestionButtonClicked = onPreviousQuestionButtonClicked, + onNextQuestionButtonClicked = onNextQuestionButtonClicked, + ) + } - SurveyFormState.DEADLINE -> { - SurveyDeadlineContent( - timeDeadline = timeDeadline, - dateDeadline = dateDeadline, - timePickerState = timePickerState, - showDatePicker = showDatePicker, - showTimePicker = showTimePicker, - onDateChanged = onDateChanged, - onTimePickerStateChanged = onTimePickerStateChanged, - onTimeChanged = onTimeChanged, - onRegisterButtonClicked = onRegisterButtonClicked, - onDatePickerStateChanged = onDatePickerStateChanged, - onPreviousButtonClicked = { onPreviousButtonClicked(SurveyFormState.QUESTION) }, - ) + SurveyFormState.DEADLINE -> { + SurveyDeadlineContent( + timeDeadline = timeDeadline, + dateDeadline = dateDeadline, + timePickerState = timePickerState, + showDatePicker = showDatePicker, + showTimePicker = showTimePicker, + onDateChanged = onDateChanged, + onTimePickerStateChanged = onTimePickerStateChanged, + onTimeChanged = onTimeChanged, + onRegisterButtonClicked = onRegisterButtonClicked, + onDatePickerStateChanged = onDatePickerStateChanged, + onPreviousButtonClicked = { onPreviousButtonClicked(SurveyFormState.QUESTION) }, + ) + } } } } From b5db58ed1b029a6598de99677eceb5aeaee29e3c Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:00:36 +0900 Subject: [PATCH 28/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=9D=BC?= =?UTF-8?q?=EC=A0=95=20=ED=99=94=EB=A9=B4=20=EC=A0=84=ED=99=98=20=EC=95=A0?= =?UTF-8?q?=EB=8B=88=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/EventRegistrationContent.kt | 91 +++++++++++-------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt index 93f00935..f2e60d9f 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt @@ -1,5 +1,11 @@ package com.wap.wapp.feature.management.event.registration +import androidx.compose.animation.AnimatedContent +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideInHorizontally +import androidx.compose.animation.slideOutHorizontally +import androidx.compose.animation.togetherWith import androidx.compose.foundation.ScrollState import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -22,12 +28,12 @@ import androidx.compose.ui.unit.dp import com.wap.designsystem.WappTheme import com.wap.designsystem.component.WappButton import com.wap.wapp.core.commmon.util.DateUtil +import com.wap.wapp.feature.management.event.R import com.wap.wapp.feature.management.event.component.DeadlineCard import com.wap.wapp.feature.management.event.component.RegistrationTextField import com.wap.wapp.feature.management.event.component.RegistrationTitle import com.wap.wapp.feature.management.event.component.WappDatePickerDialog import com.wap.wapp.feature.management.event.component.WappTimePickerDialog -import com.wap.wapp.feature.management.event.R import kotlinx.coroutines.launch import java.time.LocalDate import java.time.LocalTime @@ -67,42 +73,55 @@ internal fun EventRegistrationContent( val coroutineScope = rememberCoroutineScope() Column(modifier = modifier.fillMaxSize()) { - when (eventRegistrationState) { - EventRegistrationState.EVENT_DETAILS -> EventDetailsContent( - eventTitle = eventTitle, - eventContent = eventContent, - onTitleChanged = onTitleChanged, - onContentChanged = onContentChanged, - onNextButtonClicked = { - coroutineScope.launch { - scrollState.scrollTo(0) - } - onNextButtonClicked() - }, - ) + AnimatedContent( + targetState = eventRegistrationState, + transitionSpec = { + if (targetState.ordinal > initialState.ordinal) { + slideInHorizontally(initialOffsetX = { it }) + fadeIn() togetherWith + slideOutHorizontally(targetOffsetX = { -it }) + fadeOut() + } else { + slideInHorizontally(initialOffsetX = { -it }) + fadeIn() togetherWith + slideOutHorizontally(targetOffsetX = { it }) + fadeOut() + } + }, + ) { eventState -> + when (eventState) { + EventRegistrationState.EVENT_DETAILS -> EventDetailsContent( + eventTitle = eventTitle, + eventContent = eventContent, + onTitleChanged = onTitleChanged, + onContentChanged = onContentChanged, + onNextButtonClicked = { + coroutineScope.launch { + scrollState.scrollTo(0) + } + onNextButtonClicked() + }, + ) - EventRegistrationState.EVENT_SCHEDULE -> EventScheduleContent( - location = location, - startDate = startDate, - startTime = startTime, - endDate = endDate, - endTime = endTime, - timePickerState = timePickerState, - onLocationChanged = onLocationChanged, - onEndDateChanged = onEndDateChanged, - onEndTimeChanged = onEndTimeChanged, - onStartDateChanged = onStartDateChanged, - onStartTimeChanged = onStartTimeChanged, - showStartDatePicker = showStartDatePicker, - showStartTimePicker = showStartTimePicker, - showEndDatePicker = showEndDatePicker, - showEndTimePicker = showEndTimePicker, - onStartDatePickerStateChanged = onStartDatePickerStateChanged, - onStartTimePickerStateChanged = onStartTimePickerStateChanged, - onEndDatePickerStateChanged = onEndDatePickerStateChanged, - onEndTimePickerStateChanged = onEndTimePickerStateChanged, - onRegisterButtonClicked = onRegisterButtonClicked, - ) + EventRegistrationState.EVENT_SCHEDULE -> EventScheduleContent( + location = location, + startDate = startDate, + startTime = startTime, + endDate = endDate, + endTime = endTime, + timePickerState = timePickerState, + onLocationChanged = onLocationChanged, + onEndDateChanged = onEndDateChanged, + onEndTimeChanged = onEndTimeChanged, + onStartDateChanged = onStartDateChanged, + onStartTimeChanged = onStartTimeChanged, + showStartDatePicker = showStartDatePicker, + showStartTimePicker = showStartTimePicker, + showEndDatePicker = showEndDatePicker, + showEndTimePicker = showEndTimePicker, + onStartDatePickerStateChanged = onStartDatePickerStateChanged, + onStartTimePickerStateChanged = onStartTimePickerStateChanged, + onEndDatePickerStateChanged = onEndDatePickerStateChanged, + onEndTimePickerStateChanged = onEndTimePickerStateChanged, + onRegisterButtonClicked = onRegisterButtonClicked, + ) + } } } } From b51e14dc44b17e84ef84506560a448c76260deaf Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:16:25 +0900 Subject: [PATCH 29/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EC=9D=BC?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EC=88=98=EC=A0=95=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=20TextField=20=EB=86=92=EC=9D=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/registration/EventRegistrationContent.kt | 4 +--- .../feature/management/survey/SurveyInformationContent.kt | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt index f2e60d9f..e4f76b32 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt @@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text @@ -170,9 +169,8 @@ private fun EventDetailsContent( placeholder = stringResource(R.string.event_content_hint), modifier = Modifier .fillMaxWidth() - .height(200.dp), + .weight(1f), ) - Spacer(modifier = Modifier.weight(1.0F)) WappButton( onClick = onNextButtonClicked, diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt index ba91f118..e51cb3b3 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/SurveyInformationContent.kt @@ -3,10 +3,8 @@ package com.wap.wapp.feature.management.survey import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll @@ -69,13 +67,12 @@ internal fun SurveyInformationContent( placeholder = R.string.survey_introduce_hint, modifier = Modifier .fillMaxWidth() - .height(200.dp), + .weight(1f), ) - Spacer(modifier = Modifier.weight(1f)) - Row( horizontalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier.padding(top = 4.dp), ) { WappButton( textRes = R.string.previous, From 503d695d80cc902d582652677087665f0bc6eca3 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:32:02 +0900 Subject: [PATCH 30/55] =?UTF-8?q?[FEATURE]=20#125=20:=20TextField=20?= =?UTF-8?q?=EC=99=B8=EB=B6=80=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20Focus=20?= =?UTF-8?q?=ED=95=B4=EC=A0=9C=EB=90=98=EB=8A=94=20Modifier=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wap/designsystem/modifier/ModifierUtil.kt | 17 +++++++++++++++++ .../event/component/RegistrationTextField.kt | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 core/designsystem/src/main/java/com/wap/designsystem/modifier/ModifierUtil.kt diff --git a/core/designsystem/src/main/java/com/wap/designsystem/modifier/ModifierUtil.kt b/core/designsystem/src/main/java/com/wap/designsystem/modifier/ModifierUtil.kt new file mode 100644 index 00000000..2152086a --- /dev/null +++ b/core/designsystem/src/main/java/com/wap/designsystem/modifier/ModifierUtil.kt @@ -0,0 +1,17 @@ +package com.wap.designsystem.modifier + +import androidx.compose.foundation.gestures.detectTapGestures +import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusManager +import androidx.compose.ui.input.pointer.pointerInput + +fun Modifier.addFocusCleaner(focusManager: FocusManager, doOnClear: () -> Unit = {}): Modifier { + return this.pointerInput(Unit) { + detectTapGestures( + onTap = { + doOnClear() + focusManager.clearFocus() + }, + ) + } +} diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/component/RegistrationTextField.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/component/RegistrationTextField.kt index 3848324b..8a352653 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/component/RegistrationTextField.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/component/RegistrationTextField.kt @@ -1,16 +1,22 @@ package com.wap.wapp.feature.management.event.component import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardActions +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.Text import androidx.compose.material3.TextField import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalSoftwareKeyboardController +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.wap.designsystem.WappTheme +@OptIn(ExperimentalComposeUiApi::class) @Composable internal fun RegistrationTextField( value: String, @@ -19,6 +25,8 @@ internal fun RegistrationTextField( textAlign: TextAlign? = null, placeholder: String, ) { + val keyboardController = LocalSoftwareKeyboardController.current + TextField( value = value, onValueChange = onValueChange, @@ -42,6 +50,8 @@ internal fun RegistrationTextField( style = WappTheme.typography.contentMedium.copy(fontSize = 15.sp), ) }, + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), modifier = modifier, ) } From 56843481b0e1345deb75e15914b84e7c6f4660ac Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:36:24 +0900 Subject: [PATCH 31/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=9D=BC=EC=A0=95?= =?UTF-8?q?=20=EB=93=B1=EB=A1=9D=20TextField=20=EC=99=B8=EB=B6=80=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=EC=8B=9C=20Focus=20=ED=95=B4=EC=A0=9C?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/registration/EventRegistrationContent.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt index e4f76b32..56516d10 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt @@ -21,11 +21,13 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.wap.designsystem.WappTheme import com.wap.designsystem.component.WappButton +import com.wap.designsystem.modifier.addFocusCleaner import com.wap.wapp.core.commmon.util.DateUtil import com.wap.wapp.feature.management.event.R import com.wap.wapp.feature.management.event.component.DeadlineCard @@ -70,8 +72,13 @@ internal fun EventRegistrationContent( onRegisterButtonClicked: () -> Unit, ) { val coroutineScope = rememberCoroutineScope() + val focusManager = LocalFocusManager.current - Column(modifier = modifier.fillMaxSize()) { + Column( + modifier = modifier + .fillMaxSize() + .addFocusCleaner(focusManager), + ) { AnimatedContent( targetState = eventRegistrationState, transitionSpec = { From bc73e438a37109e8f89938c5896a8fb1f59980c1 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:38:18 +0900 Subject: [PATCH 32/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=84=A4=EB=AC=B8?= =?UTF-8?q?=20TextField=20=EC=99=B8=EB=B6=80=20=ED=81=B4=EB=A6=AD=EC=8B=9C?= =?UTF-8?q?=20Focus=20=ED=95=B4=EC=A0=9C=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/management/survey/edit/SurveyFormEditScreen.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt index 3aabcf9c..fcbb07e0 100644 --- a/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt +++ b/feature/management-survey/src/main/java/com/wap/wapp/feature/management/survey/edit/SurveyFormEditScreen.kt @@ -17,11 +17,13 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.wap.designsystem.WappTheme import com.wap.designsystem.component.WappSubTopBar +import com.wap.designsystem.modifier.addFocusCleaner import com.wap.wapp.core.commmon.extensions.toSupportingText import com.wap.wapp.core.designresource.R.drawable import com.wap.wapp.feature.management.survey.R @@ -56,6 +58,7 @@ internal fun SurveyFormEditScreen( var showDatePicker by remember { mutableStateOf(false) } var showTimePicker by remember { mutableStateOf(false) } var showDeleteSurveyDialog by remember { mutableStateOf(false) } + val focusManager = LocalFocusManager.current LaunchedEffect(true) { viewModel.getSurveyForm(surveyFormId) @@ -97,6 +100,7 @@ internal fun SurveyFormEditScreen( Column( modifier = Modifier .fillMaxSize() + .addFocusCleaner(focusManager) .padding(paddingValues) // paddingValue padding .padding(vertical = 16.dp, horizontal = 20.dp), // dp value padding verticalArrangement = Arrangement.spacedBy(20.dp), From 3bad560132300314fad8bb4735764b0a15990452 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:40:03 +0900 Subject: [PATCH 33/55] =?UTF-8?q?[FEATURE]=20#125=20:=20auth=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20TextField=20=EC=99=B8=EB=B6=80=20=ED=81=B4=EB=A6=AD?= =?UTF-8?q?=EC=8B=9C=20Focus=20=ED=95=B4=EC=A0=9C=EB=90=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wap/wapp/feature/auth/signin/SignInScreen.kt | 7 ++++++- .../java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt index 7c709843..107fc75e 100644 --- a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt +++ b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signin/SignInScreen.kt @@ -30,6 +30,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction @@ -38,6 +39,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.wap.designsystem.WappTheme +import com.wap.designsystem.modifier.addFocusCleaner import com.wap.wapp.core.commmon.extensions.toSupportingText import com.wap.wapp.core.domain.model.AuthState import com.wap.wapp.core.domain.usecase.auth.SignInUseCase @@ -69,6 +71,7 @@ internal fun SignInScreen( val snackBarHostState = remember { SnackbarHostState() } var email by rememberSaveable { mutableStateOf("") } val keyboardController = LocalSoftwareKeyboardController.current + val focusManager = LocalFocusManager.current BottomSheetScaffold( scaffoldState = scaffoldState, @@ -79,7 +82,9 @@ internal fun SignInScreen( modifier = Modifier.fillMaxSize(), sheetContent = { Column( - modifier = Modifier.padding(16.dp), + modifier = Modifier + .padding(16.dp) + .addFocusCleaner(focusManager), ) { Text( modifier = Modifier.align(Alignment.CenterHorizontally), diff --git a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt index cf1cfbb8..943c1a57 100644 --- a/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt +++ b/feature/auth/src/main/java/com/wap/wapp/feature/auth/signup/SignUpScreen.kt @@ -25,6 +25,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction @@ -34,6 +35,7 @@ import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel import com.wap.designsystem.WappTheme import com.wap.designsystem.component.WappSubTopBar +import com.wap.designsystem.modifier.addFocusCleaner import com.wap.wapp.core.commmon.extensions.toSupportingText import com.wap.wapp.core.designresource.R import com.wap.wapp.feature.auth.R.drawable.ic_card @@ -64,6 +66,7 @@ internal fun SignUpScreen( ) { val snackBarHostState = remember { SnackbarHostState() } val keyboardController = LocalSoftwareKeyboardController.current + val focusManager = LocalFocusManager.current LaunchedEffect(true) { viewModel.signUpEventFlow.collectLatest { @@ -89,6 +92,7 @@ internal fun SignUpScreen( Column( modifier = Modifier .fillMaxSize() + .addFocusCleaner(focusManager) .padding(horizontal = 16.dp), ) { WappSubTopBar( From 013e11f89eb4fa9ca6c8a0eb779fb6ffae7d0dad Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:46:57 +0900 Subject: [PATCH 34/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=84=A4=EB=AC=B8?= =?UTF-8?q?=20=EC=9D=91=EB=8B=B5=20=ED=99=94=EB=A9=B4=20=EC=A0=84=ED=99=98?= =?UTF-8?q?=20=EC=95=A0=EB=8B=88=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/answer/SurveyAnswerScreen.kt | 61 ++++++++++++------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt index 2f4f76f3..9f55ee45 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt @@ -1,5 +1,11 @@ package com.wap.wapp.feature.survey.answer +import androidx.compose.animation.AnimatedContent +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideInHorizontally +import androidx.compose.animation.slideOutHorizontally +import androidx.compose.animation.togetherWith import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding @@ -136,28 +142,41 @@ private fun SurveyAnswerContent( onPreviousQuestionButtonClicked: () -> Unit, modifier: Modifier, ) { - when (surveyAnswerState) { - SurveyAnswerState.SURVEY_OVERVIEW -> { - SurveyOverview( - surveyForm = surveyForm, - modifier = modifier.padding(top = 16.dp), - eventName = eventName, - onStartSurveyButtonClicked = onStartSurveyButtonClicked, - ) - } + AnimatedContent( + targetState = surveyAnswerState, + transitionSpec = { + if (targetState.ordinal > initialState.ordinal) { + slideInHorizontally(initialOffsetX = { it }) + fadeIn() togetherWith + slideOutHorizontally(targetOffsetX = { -it }) + fadeOut() + } else { + slideInHorizontally(initialOffsetX = { -it }) + fadeIn() togetherWith + slideOutHorizontally(targetOffsetX = { it }) + fadeOut() + } + }, + ) { answerState -> + when (answerState) { + SurveyAnswerState.SURVEY_OVERVIEW -> { + SurveyOverview( + surveyForm = surveyForm, + modifier = modifier.padding(top = 16.dp), + eventName = eventName, + onStartSurveyButtonClicked = onStartSurveyButtonClicked, + ) + } - SurveyAnswerState.SURVEY_ANSWER -> { - SurveyAnswerForm( - surveyForm = surveyForm, - modifier = modifier, - questionNumber = questionNumber, - subjectiveAnswer = subjectiveAnswer, - objectiveAnswer = objectiveAnswer, - onSubjectiveAnswerChanged = onSubjectiveAnswerChanged, - onObjectiveAnswerSelected = onObjectiveAnswerSelected, - onNextQuestionButtonClicked = onNextQuestionButtonClicked, - onPreviousQuestionButtonClicked = onPreviousQuestionButtonClicked, - ) + SurveyAnswerState.SURVEY_ANSWER -> { + SurveyAnswerForm( + surveyForm = surveyForm, + modifier = modifier, + questionNumber = questionNumber, + subjectiveAnswer = subjectiveAnswer, + objectiveAnswer = objectiveAnswer, + onSubjectiveAnswerChanged = onSubjectiveAnswerChanged, + onObjectiveAnswerSelected = onObjectiveAnswerSelected, + onNextQuestionButtonClicked = onNextQuestionButtonClicked, + onPreviousQuestionButtonClicked = onPreviousQuestionButtonClicked, + ) + } } } } From ef61f251e0b11402d58966adde7369d14c627dbc Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:54:36 +0900 Subject: [PATCH 35/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=84=A4=EB=AC=B8?= =?UTF-8?q?=20=EC=9D=91=EB=8B=B5=20=ED=99=94=EB=A9=B4=20=EC=95=A0=EB=8B=88?= =?UTF-8?q?=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20?= =?UTF-8?q?=EB=B0=94=EA=B9=A5=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20Focus=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/survey/answer/SurveyAnswerForm.kt | 104 +++++++++++------- 1 file changed, 67 insertions(+), 37 deletions(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt index 9a1d8195..6c879945 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt @@ -1,12 +1,21 @@ package com.wap.wapp.feature.survey.answer +import androidx.compose.animation.AnimatedContent +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideInHorizontally +import androidx.compose.animation.slideOutHorizontally +import androidx.compose.animation.togetherWith import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.unit.dp import com.wap.designsystem.component.WappButton +import com.wap.designsystem.modifier.addFocusCleaner import com.wap.wapp.core.model.survey.QuestionType import com.wap.wapp.core.model.survey.Rating import com.wap.wapp.core.model.survey.SurveyForm @@ -24,7 +33,13 @@ internal fun SurveyAnswerForm( onNextQuestionButtonClicked: () -> Unit, onPreviousQuestionButtonClicked: () -> Unit, ) { - Column(modifier = modifier) { + val focusManager = LocalFocusManager.current + + Column( + modifier = modifier + .fillMaxSize() + .addFocusCleaner(focusManager), + ) { val surveyQuestion = surveyForm.surveyQuestionList[questionNumber] val lastQuestionNumber = surveyForm.surveyQuestionList.lastIndex @@ -33,45 +48,60 @@ internal fun SurveyAnswerForm( size = lastQuestionNumber + 1, ) - when (surveyQuestion.questionType) { - QuestionType.SUBJECTIVE -> { - SubjectiveSurveyForm( - questionTitle = surveyQuestion.questionTitle, - answer = subjectiveAnswer, - onAnswerChanged = onSubjectiveAnswerChanged, - modifier = Modifier.weight(1f), - ) - } + AnimatedContent( + targetState = surveyQuestion.questionType, + transitionSpec = { + if (targetState.ordinal > initialState.ordinal) { + slideInHorizontally(initialOffsetX = { it }) + fadeIn() togetherWith + slideOutHorizontally(targetOffsetX = { -it }) + fadeOut() + } else { + slideInHorizontally(initialOffsetX = { -it }) + fadeIn() togetherWith + slideOutHorizontally(targetOffsetX = { it }) + fadeOut() + } + }, + ) { questionType -> + Column() { + when (questionType) { + QuestionType.SUBJECTIVE -> { + SubjectiveSurveyForm( + questionTitle = surveyQuestion.questionTitle, + answer = subjectiveAnswer, + onAnswerChanged = onSubjectiveAnswerChanged, + modifier = Modifier.weight(1f), + ) + } - QuestionType.OBJECTIVE -> { - ObjectiveSurveyForm( - questionTitle = surveyQuestion.questionTitle, - answer = objectiveAnswer, - onAnswerSelected = onObjectiveAnswerSelected, - modifier = Modifier.weight(1f), - ) - } - } + QuestionType.OBJECTIVE -> { + ObjectiveSurveyForm( + questionTitle = surveyQuestion.questionTitle, + answer = objectiveAnswer, + onAnswerSelected = onObjectiveAnswerSelected, + modifier = Modifier.weight(1f), + ) + } + } - val isGreaterThanFirstQuestion = questionNumber > 0 - val isLastQuestion = questionNumber == lastQuestionNumber // 마지막 응답일 경우, 완료로 변경 - Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { - WappButton( - textRes = R.string.previous, - onClick = onPreviousQuestionButtonClicked, - isEnabled = isGreaterThanFirstQuestion, - modifier = Modifier.weight(1f), - ) + val isGreaterThanFirstQuestion = questionNumber > 0 + val isLastQuestion = questionNumber == lastQuestionNumber // 마지막 응답일 경우, 완료로 변경 + Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { + WappButton( + textRes = R.string.previous, + onClick = onPreviousQuestionButtonClicked, + isEnabled = isGreaterThanFirstQuestion, + modifier = Modifier.weight(1f), + ) - SurveyAnswerButton( - isLastQuestion = isLastQuestion, - onButtonClicked = onNextQuestionButtonClicked, - isEnabled = checkQuestionTypeAndSubjectiveAnswer( - questionType = surveyQuestion.questionType, - subjectiveAnswer = subjectiveAnswer, - ), - modifier = Modifier.weight(1f), - ) + SurveyAnswerButton( + isLastQuestion = isLastQuestion, + onButtonClicked = onNextQuestionButtonClicked, + isEnabled = checkQuestionTypeAndSubjectiveAnswer( + questionType = surveyQuestion.questionType, + subjectiveAnswer = subjectiveAnswer, + ), + modifier = Modifier.weight(1f), + ) + } + } } } } From 6cbec6cd95aef4b7781dfc48f82df68c03b03287 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 02:58:43 +0900 Subject: [PATCH 36/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=84=A4=EB=AC=B8?= =?UTF-8?q?=20=EC=9D=91=EB=8B=B5=20=ED=99=94=EB=A9=B4=20=EC=95=A0=EB=8B=88?= =?UTF-8?q?=EB=A9=94=EC=9D=B4=EC=85=98=20=EB=B3=B4=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wap/wapp/feature/survey/answer/SurveyAnswerForm.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt index 6c879945..c731833e 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt @@ -49,9 +49,9 @@ internal fun SurveyAnswerForm( ) AnimatedContent( - targetState = surveyQuestion.questionType, + targetState = questionNumber, transitionSpec = { - if (targetState.ordinal > initialState.ordinal) { + if (targetState > initialState) { slideInHorizontally(initialOffsetX = { it }) + fadeIn() togetherWith slideOutHorizontally(targetOffsetX = { -it }) + fadeOut() } else { @@ -59,9 +59,9 @@ internal fun SurveyAnswerForm( slideOutHorizontally(targetOffsetX = { it }) + fadeOut() } }, - ) { questionType -> - Column() { - when (questionType) { + ) { questionNumber -> + Column { + when (surveyForm.surveyQuestionList[questionNumber].questionType) { QuestionType.SUBJECTIVE -> { SubjectiveSurveyForm( questionTitle = surveyQuestion.questionTitle, From ef1fd1e3b38d76d86bc42d4e427be64021c93dd0 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 03:07:25 +0900 Subject: [PATCH 37/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=84=A4=EB=AC=B8?= =?UTF-8?q?=20=EC=9D=91=EB=8B=B5=20=ED=99=94=EB=A9=B4=20=EB=A7=88=EC=A7=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt index 9f55ee45..b03d7a24 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerScreen.kt @@ -120,7 +120,7 @@ internal fun SurveyAnswerScreen( modifier = Modifier .fillMaxSize() .padding(paddingValues) - .padding(16.dp), + .padding(top = 16.dp, bottom = 20.dp, start = 20.dp, end = 20.dp), ) } } From 145110bce27e81ee22445d4f0a7805767be99ea0 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 15:33:50 +0900 Subject: [PATCH 38/55] =?UTF-8?q?[REFACTOR]=20#125=20:=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20TextField=20=ED=81=AC=EA=B8=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/component/RegistrationTextField.kt | 57 +++++++++++-------- .../registration/EventRegistrationContent.kt | 1 + .../src/main/res/values/strings.xml | 2 +- .../feature/survey/answer/SurveyAnswerForm.kt | 4 +- 4 files changed, 39 insertions(+), 25 deletions(-) diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/component/RegistrationTextField.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/component/RegistrationTextField.kt index 8a352653..2f45f119 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/component/RegistrationTextField.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/component/RegistrationTextField.kt @@ -1,19 +1,23 @@ package com.wap.wapp.feature.management.event.component +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.Text -import androidx.compose.material3.TextField -import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import com.wap.designsystem.WappTheme @OptIn(ExperimentalComposeUiApi::class) @@ -23,35 +27,42 @@ internal fun RegistrationTextField( onValueChange: (String) -> Unit, modifier: Modifier = Modifier, textAlign: TextAlign? = null, + align: Alignment = Alignment.TopStart, placeholder: String, ) { val keyboardController = LocalSoftwareKeyboardController.current - TextField( + BasicTextField( value = value, onValueChange = onValueChange, - shape = RoundedCornerShape(10.dp), textStyle = WappTheme.typography.contentMedium.copy( textAlign = textAlign, + color = WappTheme.colors.white, ), - colors = TextFieldDefaults.colors( - focusedTextColor = WappTheme.colors.white, - unfocusedTextColor = WappTheme.colors.white, - focusedContainerColor = WappTheme.colors.black25, - unfocusedContainerColor = WappTheme.colors.black25, - focusedIndicatorColor = WappTheme.colors.black25, - unfocusedIndicatorColor = WappTheme.colors.black25, - cursorColor = WappTheme.colors.yellow34, - ), - placeholder = { - Text( - text = placeholder, - color = WappTheme.colors.gray82, - style = WappTheme.typography.contentMedium.copy(fontSize = 15.sp), - ) - }, + cursorBrush = SolidColor(WappTheme.colors.yellow34), + visualTransformation = VisualTransformation.None, keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), - modifier = modifier, - ) + singleLine = true, + modifier = modifier.background( + color = WappTheme.colors.black25, + shape = RoundedCornerShape(10.dp), + ), + ) { innerTextField -> + Box(modifier = Modifier.padding(vertical = 8.dp, horizontal = 12.dp)) { + if (value.isEmpty()) { + Text( + text = placeholder, + color = WappTheme.colors.gray82, + textAlign = TextAlign.Center, + style = WappTheme.typography.contentMedium, + modifier = Modifier.align(Alignment.Center), + ) + } + + Box(modifier = Modifier.align(align)) { + innerTextField() + } + } + } } diff --git a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt index 56516d10..f5891e02 100644 --- a/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt +++ b/feature/management-event/src/main/java/com/wap/wapp/feature/management/event/registration/EventRegistrationContent.kt @@ -284,6 +284,7 @@ private fun EventScheduleContent( placeholder = stringResource(R.string.event_location_hint), textAlign = TextAlign.Center, modifier = Modifier.weight(3f), + align = Alignment.Center, ) } diff --git a/feature/management-event/src/main/res/values/strings.xml b/feature/management-event/src/main/res/values/strings.xml index 86e3d685..27ba1196 100644 --- a/feature/management-event/src/main/res/values/strings.xml +++ b/feature/management-event/src/main/res/values/strings.xml @@ -14,7 +14,7 @@ 장소 날짜 시간 - 어디에서 진행되는 일정인가요? + 장소를 입력하세요. 시작 날짜 시작 시간 종료 날짜 diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt index c731833e..5adc920f 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/answer/SurveyAnswerForm.kt @@ -137,5 +137,7 @@ private fun checkQuestionTypeAndSubjectiveAnswer( if (questionType == QuestionType.OBJECTIVE) { return true } - return subjectiveAnswer.length >= 10 + return subjectiveAnswer.length >= MINIMUN_ANSWER_LENGTH } + +private val MINIMUN_ANSWER_LENGTH = 10 From c18af5cfce7520eea9f6b846e8a6a5cb72638f47 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 15:36:02 +0900 Subject: [PATCH 39/55] =?UTF-8?q?[CHORE]=20#125=20:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=8A=A4=EC=BD=94=ED=94=84=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wapp/feature/survey/SurveyViewModel.kt | 67 +++++++++---------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyViewModel.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyViewModel.kt index a6453d5e..9b63087a 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyViewModel.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyViewModel.kt @@ -36,48 +36,42 @@ class SurveyViewModel @Inject constructor( getUserRole() } - private fun getUserRole() { - viewModelScope.launch { - getUserRoleUseCase() - .onSuccess { userRole -> - _userRoleUiState.value = UserRoleUiState.Success(userRole) - } - .onFailure { throwable -> - _surveyEvent.emit(SurveyUiEvent.Failure(throwable)) - } - } + private fun getUserRole() = viewModelScope.launch { + getUserRoleUseCase() + .onSuccess { userRole -> + _userRoleUiState.value = UserRoleUiState.Success(userRole) + } + .onFailure { throwable -> + _surveyEvent.emit(SurveyUiEvent.Failure(throwable)) + } } - fun getSurveyFormList() { - viewModelScope.launch { - getSurveyFormListUseCase() - .onSuccess { surveyFormList -> - val filteredSurveyFormList = surveyFormList.filter { survey -> - survey.isBeforeDeadline() - } - _surveyFormListUiState.value = - SurveyFormListUiState.Success(filteredSurveyFormList) + fun getSurveyFormList() = viewModelScope.launch { + getSurveyFormListUseCase() + .onSuccess { surveyFormList -> + val filteredSurveyFormList = surveyFormList.filter { survey -> + survey.isBeforeDeadline() } - .onFailure { throwable -> - _surveyEvent.emit(SurveyUiEvent.Failure(throwable)) - } - } + _surveyFormListUiState.value = + SurveyFormListUiState.Success(filteredSurveyFormList) + } + .onFailure { throwable -> + _surveyEvent.emit(SurveyUiEvent.Failure(throwable)) + } } - fun isSubmittedSurvey(surveyFormId: String) { - viewModelScope.launch { - isSubmittedSurveyUseCase(surveyFormId) - .onSuccess { isSubmittedSurvey -> - if (isSubmittedSurvey) { - _surveyEvent.emit(SurveyUiEvent.AlreadySubmitted) - } else { - _surveyEvent.emit(SurveyUiEvent.NotSubmitted(surveyFormId)) - } - } - .onFailure { throwable -> - _surveyEvent.emit(SurveyUiEvent.Failure(throwable)) + fun isSubmittedSurvey(surveyFormId: String) = viewModelScope.launch { + isSubmittedSurveyUseCase(surveyFormId) + .onSuccess { isSubmittedSurvey -> + if (isSubmittedSurvey) { + _surveyEvent.emit(SurveyUiEvent.AlreadySubmitted) + } else { + _surveyEvent.emit(SurveyUiEvent.NotSubmitted(surveyFormId)) } - } + } + .onFailure { throwable -> + _surveyEvent.emit(SurveyUiEvent.Failure(throwable)) + } } sealed class UserRoleUiState { @@ -87,6 +81,7 @@ class SurveyViewModel @Inject constructor( sealed class SurveyFormListUiState { data object Init : SurveyFormListUiState() + data object Loading : SurveyFormListUiState() data class Success(val surveyFormList: List) : SurveyFormListUiState() } From 7ef9aac712abf4faf7329d50b9bdccfa01ccab98 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 15:40:04 +0900 Subject: [PATCH 40/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=84=A4=EB=AC=B8?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20Loading=20Lottie=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wap/wapp/feature/survey/SurveyScreen.kt | 9 ++++++++- .../java/com/wap/wapp/feature/survey/SurveyViewModel.kt | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyScreen.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyScreen.kt index f24da187..0c3951f5 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyScreen.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyScreen.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.wap.designsystem.WappTheme +import com.wap.designsystem.component.CircleLoader import com.wap.designsystem.component.WappLeftMainTopBar import com.wap.wapp.core.commmon.extensions.toSupportingText import com.wap.wapp.core.model.user.UserRole @@ -61,7 +62,9 @@ internal fun SurveyScreen( is SurveyViewModel.UserRoleUiState.Init -> {} is SurveyViewModel.UserRoleUiState.Success -> { when (userRoleUiState.userRole) { - UserRole.GUEST -> { isGuest = true } + UserRole.GUEST -> { + isGuest = true + } // 비회원이 아닌 경우, 목록 호출 UserRole.MEMBER -> viewModel.getSurveyFormList() @@ -95,6 +98,10 @@ internal fun SurveyScreen( ) { paddingValues -> when (surveyFormListUiState) { is SurveyViewModel.SurveyFormListUiState.Init -> {} + + is SurveyViewModel.SurveyFormListUiState.Loading -> + CircleLoader(modifier = Modifier.fillMaxSize()) + is SurveyViewModel.SurveyFormListUiState.Success -> { SurveyContent( surveyFormList = surveyFormListUiState.surveyFormList, diff --git a/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyViewModel.kt b/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyViewModel.kt index 9b63087a..29b0b6bc 100644 --- a/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyViewModel.kt +++ b/feature/survey/src/main/java/com/wap/wapp/feature/survey/SurveyViewModel.kt @@ -47,6 +47,8 @@ class SurveyViewModel @Inject constructor( } fun getSurveyFormList() = viewModelScope.launch { + _surveyFormListUiState.value = SurveyFormListUiState.Loading + getSurveyFormListUseCase() .onSuccess { surveyFormList -> val filteredSurveyFormList = surveyFormList.filter { survey -> From a2854fcefc9f55175befbb5deda11d08f9406ac4 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 15:43:46 +0900 Subject: [PATCH 41/55] =?UTF-8?q?[CHORE]=20#125=20:=20=EC=B6=9C=EC=84=9D?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=B4=EB=8F=99=20=ED=9B=84?= =?UTF-8?q?=20=EB=8B=A4=EB=A5=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=ED=95=98=EB=A9=B4=20=ED=99=94=EB=A9=B4=EC=9D=B4=20?= =?UTF-8?q?=EC=A2=8C=EC=B8=A1=20=EC=83=81=EB=8B=A8=20=EB=B6=80=ED=84=B0=20?= =?UTF-8?q?=ED=8E=BC=EC=B3=90=EC=A7=80=EB=8A=94=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/attendance/AttendanceScreen.kt | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/AttendanceScreen.kt b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/AttendanceScreen.kt index af5567c8..9bb72e6c 100644 --- a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/AttendanceScreen.kt +++ b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/AttendanceScreen.kt @@ -83,24 +83,27 @@ internal fun AttendanceRoute( } } - when (userRoleState) { - is UserRoleState.Loading -> CircleLoader(modifier = Modifier.fillMaxSize()) - is UserRoleState.Success -> { - when ((userRoleState as UserRoleState.Success).userRole) { - UserRole.GUEST -> AttendanceGuestScreen(onButtonClicked = navigateToSignIn) - UserRole.MANAGER, UserRole.MEMBER -> AttendanceScreen( - userRole = (userRoleState as UserRoleState.Success).userRole, - snackBarHostState = snackBarHostState, - eventsAttendanceStatusState = eventsAttendanceStatusState, - attendanceCode = attendanceCode, - selectedEventTitle = selectedEventTitle, - clearAttendanceCode = viewModel::clearAttendanceCode, - onAttendanceCodeChanged = viewModel::setAttendanceCode, - onSelectEventId = viewModel::setSelectedEventId, - onSelectEventTitle = viewModel::setSelectedEventTitle, - verifyAttendanceCode = viewModel::verifyAttendanceCode, - navigateToAttendanceManagement = navigateToAttendanceManagement, - ) + Column(modifier = Modifier.fillMaxSize()) { + when (userRoleState) { + is UserRoleState.Loading -> CircleLoader(modifier = Modifier.fillMaxSize()) + is UserRoleState.Success -> { + when ((userRoleState as UserRoleState.Success).userRole) { + UserRole.GUEST -> AttendanceGuestScreen(onButtonClicked = navigateToSignIn) + UserRole.MANAGER, UserRole.MEMBER -> + AttendanceScreen( + userRole = (userRoleState as UserRoleState.Success).userRole, + snackBarHostState = snackBarHostState, + eventsAttendanceStatusState = eventsAttendanceStatusState, + attendanceCode = attendanceCode, + selectedEventTitle = selectedEventTitle, + clearAttendanceCode = viewModel::clearAttendanceCode, + onAttendanceCodeChanged = viewModel::setAttendanceCode, + onSelectEventId = viewModel::setSelectedEventId, + onSelectEventTitle = viewModel::setSelectedEventTitle, + verifyAttendanceCode = viewModel::verifyAttendanceCode, + navigateToAttendanceManagement = navigateToAttendanceManagement, + ) + } } } } From e4699a0c26cd834e30d9f3be25d1a2e90d9aff28 Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 15:58:48 +0900 Subject: [PATCH 42/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EA=B3=B5=EC=A7=80?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=EC=9D=BC=EC=A0=95=20=ED=81=B4=EB=A6=AD?= =?UTF-8?q?=ED=95=98=EB=A9=B4=20=ED=99=95=EC=9E=A5=20/=20=EC=A0=91?= =?UTF-8?q?=ED=9E=88=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wapp/feature/notice/BottomSheetContent.kt | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/feature/notice/src/main/java/com/wap/wapp/feature/notice/BottomSheetContent.kt b/feature/notice/src/main/java/com/wap/wapp/feature/notice/BottomSheetContent.kt index b2a33ae3..026b044b 100644 --- a/feature/notice/src/main/java/com/wap/wapp/feature/notice/BottomSheetContent.kt +++ b/feature/notice/src/main/java/com/wap/wapp/feature/notice/BottomSheetContent.kt @@ -4,6 +4,7 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.animateContentSize import androidx.compose.foundation.Image 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.IntrinsicSize @@ -24,6 +25,11 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.SheetState import androidx.compose.material3.SheetValue 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.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -132,7 +138,17 @@ private fun EventItem( bottomSheetState: SheetState, event: Event, ) { - Column(modifier = Modifier.animateContentSize()) { + var eventItemToggle by remember { mutableStateOf(false) } + + LaunchedEffect(bottomSheetState.currentValue) { + eventItemToggle = bottomSheetState.currentValue == SheetValue.Expanded + } + + Column( + modifier = Modifier + .animateContentSize() + .clickable { eventItemToggle = !eventItemToggle }, + ) { Row( horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically, @@ -164,7 +180,7 @@ private fun EventItem( color = WappTheme.colors.white, ) - AnimatedVisibility(bottomSheetState.currentValue == SheetValue.Expanded) { + AnimatedVisibility(eventItemToggle) { Column(horizontalAlignment = Alignment.Start) { Text( text = event.location, From f79784c32e7aa7bd871389e00323ec878fd5f1ce Mon Sep 17 00:00:00 2001 From: tgyuu-An Date: Sat, 17 Feb 2024 17:07:56 +0900 Subject: [PATCH 43/55] =?UTF-8?q?[FEATURE]=20#125=20:=20=EC=B2=98=EC=9D=8C?= =?UTF-8?q?=20=EA=B0=80=EC=9E=85=ED=95=98=EB=8A=94=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20UI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 3 - .idea/codeStyles/Project.xml | 117 ------------ .idea/codeStyles/codeStyleConfig.xml | 5 - .idea/dictionaries/jaino.xml | 3 - .idea/gradle.xml | 4 +- .idea/inspectionProfiles/Project_Default.xml | 41 ----- .idea/jarRepositories.xml | 25 --- .idea/misc.xml | 5 + .../commmon/extensions/ThrowableExtensions.kt | 44 ++--- .../wapp/feature/auth/signup/SignUpChip.kt | 6 +- .../wapp/feature/auth/signup/SignUpScreen.kt | 172 ++++++++++-------- .../feature/auth/signup/SignUpViewModel.kt | 46 ++--- gradle.properties | 9 +- 13 files changed, 151 insertions(+), 329 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/dictionaries/jaino.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/jarRepositories.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d33521..00000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 4bec4ea8..00000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index a55e7a17..00000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/dictionaries/jaino.xml b/.idea/dictionaries/jaino.xml deleted file mode 100644 index 8bf92705..00000000 --- a/.idea/dictionaries/jaino.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 6ebf526c..34af411c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,6 +1,5 @@ -