Skip to content

Commit

Permalink
체크리스트 생성 - 종류 UI 구현, 생성 중 로딩 로띠 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
leesa-l committed Sep 20, 2023
1 parent 46050c7 commit 48c3377
Show file tree
Hide file tree
Showing 21 changed files with 283 additions and 88 deletions.
8 changes: 7 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ retrofit = "2.9.0"
# Coil
coil = "2.4.0"

# Lottie
lottie-compose = "6.1.0"

# Logger
timber = "5.0.1"
junit = "4.13.2"
Expand Down Expand Up @@ -71,7 +74,7 @@ compose-bom = { module = "androidx.compose:compose-bom", version.ref = "compose-
compose-ui = { group = "androidx.compose.ui", name = "ui" }
compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "activity" }
compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigation" }
compose-material3 = { group = "androidx.compose.material3", name = "material3" }
compose-material3 = { group = "androidx.compose.material3", name = "material3", version = "1.1.0-alpha07" }
compose-uiGraphics = { group = "androidx.compose.ui", name = "ui-graphics" }
compose-uiTooling = { group = "androidx.compose.ui", name = "ui-tooling" }
compose-uiToolingPreview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
Expand Down Expand Up @@ -123,6 +126,9 @@ hilt-ext-work = { group = "androidx.hilt", name = "hilt-work", version.ref = "hi
#Coil
coil-core = { group = "io.coil-kt", name = "coil", version.ref = "coil" }

#Lottie
lottie-compose = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "lottie-compose" }

#Logger
logger-timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "timber" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data class HomeState(
val checkList: List<CheckListItem>,
) : ViewState {
data class CheckListItem(
val id: Int,
val id: String,
val title: String,
val date: String,
val isProgress: Boolean,
Expand All @@ -39,7 +39,7 @@ data class HomeState(
profileUrl = "",
checkList = listOf(
CheckListItem(
id = 0,
id = "0",
title = "파리, 프랑스",
date = "2023.07.16 ~ 2023.07.20",
isProgress = true,
Expand All @@ -53,5 +53,5 @@ data class HomeState(
sealed interface HomeEffect : ViewEffect {
object NavigateToAddCheckList : HomeEffect

data class NavigateToCheckList(val id: Int) : HomeEffect
data class NavigateToCheckList(val id: String) : HomeEffect
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class HomeViewModel @Inject constructor() : MVIViewModel<HomeIntent, HomeState,
setEffect { HomeEffect.NavigateToAddCheckList }
}

fun onClickChecklist(id: Int) {
fun onClickChecklist(id: String) {
setEffect { HomeEffect.NavigateToCheckList(id) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ sealed interface TemplateEffect : ViewEffect {

object NavigateToSortTemplate : TemplateEffect

data class NavigateToTemplate(val id: Int) : TemplateEffect
data class NavigateToTemplate(val id: String) : TemplateEffect
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,43 @@ class TemplateViewModel @Inject constructor() :
_templateState.value = TemplateState.Available(
listOf(
Template(
id = 0,
id = "0",
title = "자주 빠뜨리는 것",
date = "2023.08.10",
colorType = TemplateColor.DAWN
),
Template(
id = 1,
id = "1",
title = "가족이랑 갈 때 필수템",
date = "2023.08.07",
colorType = TemplateColor.AFTERNOON
),
Template(
id = 2,
id = "2",
title = "유럽 여행 갈 때",
date = "2023.08.05",
colorType = TemplateColor.MORNING
),
Template(
id = 3,
id = "3",
title = "영상 촬영시 필요한 것들",
date = "2023.08.04",
colorType = TemplateColor.NIGHT
),
Template(
id = 4,
id = "4",
title = "일본 갈 때 필수",
date = "2023.08.03",
colorType = TemplateColor.SUNSET
),
Template(
id = 5,
id = "5",
title = "일본 갈 때 필수2",
date = "2023.08.02",
colorType = TemplateColor.DAWN
),
Template(
id = 6,
id = "6",
title = "일본 갈 때 필수3",
date = "2023.08.01",
colorType = TemplateColor.AFTERNOON
Expand All @@ -81,7 +81,7 @@ class TemplateViewModel @Inject constructor() :
setEffect { TemplateEffect.NavigateToSortTemplate }
}

fun onClickTemplate(id: Int) {
fun onClickTemplate(id: String) {
setEffect { TemplateEffect.NavigateToTemplate(id) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fun HomeTabContents(
@Composable
private fun CheckListContents(
item: HomeState.CheckListItem,
onClickLink: (id: Int) -> Unit,
onClickLink: (id: String) -> Unit,
modifier: Modifier = Modifier,
) {
Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ fun TemplateTabContents(
@Composable
private fun TemplateItem(
template: Template,
onClick: (id: Int) -> Unit
onClick: (id: String) -> Unit
) {
Box(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dkin.chevit.presentation.home.model

data class Template(
val id: Int,
val id: String,
val title: String,
val date: String,
val colorType: TemplateColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

@Composable
Expand All @@ -41,7 +42,8 @@ fun ChevitButtonChip(
focusedContentColor = ChevitTheme.colors.blue4,
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp),
textStyle = ChevitTheme.typhography.bodyLarge,
borderColor = if (selected) ChevitTheme.colors.blue7 else ChevitTheme.colors.grey4
borderColor = if (selected) ChevitTheme.colors.blue7 else ChevitTheme.colors.grey4,
borderWidth = if (selected) 2.dp else 1.dp
) {
Text(text = text)
}
Expand Down Expand Up @@ -136,6 +138,7 @@ internal fun ChevitButton(
disabledContentColor: Color = contentColor,
elevation: ButtonElevation? = ButtonDefaults.buttonElevation(),
borderColor: Color? = null,
borderWidth: Dp = 1.dp,
pressedBorderColor: Color? = borderColor,
contentPadding: PaddingValues = ButtonDefaults.ContentPadding,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
Expand All @@ -159,7 +162,7 @@ internal fun ChevitButton(
elevation = elevation,
border = borderColor?.let {
BorderStroke(
width = 1.dp,
width = borderWidth,
color = if (isPressed && pressedBorderColor != null) pressedBorderColor else it
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fun ChevitTextField(
shape = RoundedCornerShape(8.dp),
textStyle = ChevitTheme.typhography.bodyLarge.copy(color = ChevitTheme.colors.grey10),
colors = TextFieldDefaults.outlinedTextFieldColors(
textColor = ChevitTheme.colors.grey10,
focusedTextColor = ChevitTheme.colors.grey10,
unfocusedTextColor = ChevitTheme.colors.grey10,
disabledTextColor = ChevitTheme.colors.grey10,
focusedBorderColor = ChevitTheme.colors.grey4,
unfocusedBorderColor = ChevitTheme.colors.grey4,
Expand All @@ -43,7 +44,8 @@ fun ChevitTextField(
unfocusedTrailingIconColor = ChevitTheme.colors.grey4,
disabledTrailingIconColor = ChevitTheme.colors.grey4,
errorTrailingIconColor = ChevitTheme.colors.grey4,
placeholderColor = ChevitTheme.colors.grey4,
focusedPlaceholderColor = ChevitTheme.colors.grey4,
unfocusedPlaceholderColor = ChevitTheme.colors.grey4,
disabledPlaceholderColor = ChevitTheme.colors.grey4,
),
placeholder = placeholder,
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions presentation/resource/src/main/res/raw/loading.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"v":"5.8.1","fr":30,"ip":0,"op":60,"w":300,"h":300,"nm":"loading_6","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":60,"s":[360]}],"ix":10},"p":{"a":0,"k":[150.00000000000003,150.00000000000003,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[30.000000000000004,30.000000000000004,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[300,300],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.22745098039215686,0.6627450980392157,0.8627450980392157,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":50,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[0]},{"t":60,"s":[99]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[1]},{"t":50,"s":[100]}],"ix":2},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":60,"s":[3]}],"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":300,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":30,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150.00000000000003,150.00000000000003,0],"ix":2,"l":2},"a":{"a":0,"k":[0,0,0],"ix":1,"l":2},"s":{"a":0,"k":[30.000000000000004,30.000000000000004,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[300,300],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.6666666666666666,0.8431372549019608,0.9215686274509803,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":50,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":300,"st":0,"bm":0}],"markers":[]}
2 changes: 2 additions & 0 deletions presentation/step/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ dependencies {
implementation(project(":presentation:resource"))
implementation(project(":presentation:common"))
implementation(project(":presentation:deeplink"))

implementation(libs.lottie.compose)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class Step : MVIComposeFragment<StepIntent, StepState, StepEffect>() {

override fun processEffect(effect: StepEffect) {
when (effect) {
else -> {}
is StepEffect.NavigateToCheckList -> {

}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.dkin.chevit.core.mvi.ViewEffect
import com.dkin.chevit.core.mvi.ViewIntent
import com.dkin.chevit.core.mvi.ViewState
import com.dkin.chevit.presentation.step.model.CountryModel
import com.dkin.chevit.presentation.step.model.TravelKind
import com.dkin.chevit.presentation.step.model.TravelWith
import java.time.LocalDate

Expand All @@ -17,7 +18,7 @@ data class StepState(
val startDate: LocalDate? = null,
val endDate: LocalDate? = null,
val travelWith: List<TravelWith> = listOf(),
val travelKind: String? = null
val travelKind: List<TravelKind> = listOf()
) : ViewState {
fun getWhereLabel(): String = country?.text?.split(",")?.getOrNull(0) ?: ""
fun getWhenLabel(): String {
Expand All @@ -40,4 +41,5 @@ data class StepState(
}

sealed interface StepEffect : ViewEffect {
data class NavigateToCheckList(val id: String) : StepEffect
}
Loading

0 comments on commit 48c3377

Please sign in to comment.