Skip to content

Commit

Permalink
[FEATURE] #125 : 설문 응답 화면 전환 애니메이션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 16, 2024
1 parent 3bad560 commit 013e11f
Showing 1 changed file with 40 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
)
}
}
}
}

0 comments on commit 013e11f

Please sign in to comment.