Skip to content

Commit 1b08cab

Browse files
committed
FIX: 기기의 높이가 600.dp를 넘지 못하는 경우, 기존 감정구슬 선택화면이 표시되도록 수정
1 parent 7c76a1a commit 1b08cab

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

presentation/src/main/java/com/threegap/bitnagil/presentation/common/dimension/PxToDp.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ import androidx.compose.ui.platform.LocalDensity
55

66
@Composable
77
fun Float.pxToDp() = with(LocalDensity.current) { this@pxToDp.toDp() }
8+
9+
@Composable
10+
fun Int.pxToDp() = with(LocalDensity.current) { this@pxToDp.toDp() }

presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
package com.threegap.bitnagil.presentation.emotion
22

33
import androidx.activity.compose.BackHandler
4+
import androidx.compose.foundation.layout.BoxWithConstraints
5+
import androidx.compose.foundation.layout.fillMaxWidth
46
import androidx.compose.runtime.Composable
57
import androidx.compose.runtime.collectAsState
68
import androidx.compose.runtime.getValue
79
import androidx.compose.runtime.remember
10+
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.unit.dp
812
import androidx.hilt.navigation.compose.hiltViewModel
13+
import com.threegap.bitnagil.presentation.common.dimension.pxToDp
914
import com.threegap.bitnagil.presentation.common.flow.collectAsEffect
1015
import com.threegap.bitnagil.presentation.common.toast.GlobalBitnagilToast
1116
import com.threegap.bitnagil.presentation.emotion.component.template.EmotionRecommendRoutineScreen
17+
import com.threegap.bitnagil.presentation.emotion.component.template.SimpleEmotionSelectionScreen
1218
import com.threegap.bitnagil.presentation.emotion.component.template.SwipeEmotionSelectionScreen
1319
import com.threegap.bitnagil.presentation.emotion.model.EmotionScreenStep
1420
import com.threegap.bitnagil.presentation.emotion.model.mvi.EmotionSideEffect
@@ -32,15 +38,27 @@ fun EmotionScreenContainer(
3238
}
3339

3440
when (state.step) {
35-
EmotionScreenStep.Emotion -> SwipeEmotionSelectionScreen(
36-
state = state,
37-
onClickPreviousButton = navigateToBack,
38-
onSelectEmotion = remember {
39-
{ emotionType ->
40-
viewModel.selectEmotion(emotionType = emotionType, minimumDelay = 1000)
41-
}
42-
},
43-
)
41+
EmotionScreenStep.Emotion -> BoxWithConstraints(modifier = Modifier.fillMaxWidth()) {
42+
val height = constraints.maxHeight.pxToDp()
43+
44+
if (height > 600.dp) {
45+
SwipeEmotionSelectionScreen(
46+
state = state,
47+
onClickPreviousButton = navigateToBack,
48+
onSelectEmotion = remember {
49+
{ emotionType ->
50+
viewModel.selectEmotion(emotionType = emotionType, minimumDelay = 1000)
51+
}
52+
},
53+
)
54+
} else {
55+
SimpleEmotionSelectionScreen(
56+
state = state,
57+
onClickPreviousButton = navigateToBack,
58+
onClickEmotion = viewModel::selectEmotion,
59+
)
60+
}
61+
}
4462
EmotionScreenStep.RecommendRoutines -> EmotionRecommendRoutineScreen(
4563
state = state,
4664
onClickRoutine = viewModel::selectRecommendRoutine,

0 commit comments

Comments
 (0)