From 0558886b76a9ecf226723d2d3850e23da6dd0b65 Mon Sep 17 00:00:00 2001 From: beom84 Date: Fri, 10 Jan 2025 15:46:20 +0900 Subject: [PATCH 01/29] =?UTF-8?q?[feat]=20#7=20ToDoCardType=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 --- .../android/bbangzip/presentation/type/ToDoCardType.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/ToDoCardType.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/ToDoCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/ToDoCardType.kt new file mode 100644 index 0000000..f0dce87 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/ToDoCardType.kt @@ -0,0 +1,8 @@ +package org.android.bbangzip.presentation.type + +enum class ToDoCardType() { + DEFAULT, + CHECKABLE, + CHECKED, + COMPLETE +} \ No newline at end of file From 492a0f9c092090b0116efd394645f822bc96d944 Mon Sep 17 00:00:00 2001 From: beom84 Date: Fri, 10 Jan 2025 19:21:05 +0900 Subject: [PATCH 02/29] =?UTF-8?q?[feat]=20#7=20Modifier.dropShadow=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/util/modifier/ModifierExt.kt | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt index 6956f4a..dfde429 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt @@ -1,11 +1,21 @@ package org.android.bbangzip.presentation.util.modifier +import android.graphics.BlurMaskFilter import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.drawBehind +import androidx.compose.ui.geometry.Size +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.Paint +import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.graphics.drawOutline +import androidx.compose.ui.graphics.drawscope.drawIntoCanvas import androidx.compose.ui.semantics.Role +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp @Composable fun Modifier.noRippleClickable( @@ -22,3 +32,33 @@ fun Modifier.noRippleClickable( onClickLabel = onClickLabel, role = role, ) + +@Composable +fun Modifier.dropShadow( + shape: Shape, + color: Color = Color.Black.copy(0.25f), + blur: Dp = 4.dp, + offsetY: Dp = 4.dp, + offsetX: Dp = 0.dp, + spread: Dp = 0.dp +) = this.drawBehind { + val shadowSize = Size(size.width + spread.toPx(), size.height + spread.toPx()) + val shadowOutline = shape.createOutline(shadowSize, layoutDirection, this) + + val paint = Paint().apply { + this.color = color + } + + if (blur.toPx() > 0) { + paint.asFrameworkPaint().apply { + maskFilter = BlurMaskFilter(blur.toPx(), BlurMaskFilter.Blur.NORMAL) + } + } + + drawIntoCanvas { canvas -> + canvas.save() + canvas.translate(offsetX.toPx(), offsetY.toPx()) + canvas.drawOutline(shadowOutline, paint) + canvas.restore() + } +} \ No newline at end of file From 789fd3a2bb8d44014da4731472bff60165c1134f Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 00:29:52 +0900 Subject: [PATCH 03/29] =?UTF-8?q?[del]=20#7=20type=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/bbangzip/presentation/type/ToDoCardType.kt | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/ToDoCardType.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/ToDoCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/ToDoCardType.kt deleted file mode 100644 index f0dce87..0000000 --- a/app/src/main/java/org/android/bbangzip/presentation/type/ToDoCardType.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.android.bbangzip.presentation.type - -enum class ToDoCardType() { - DEFAULT, - CHECKABLE, - CHECKED, - COMPLETE -} \ No newline at end of file From 772f4dcc47d2bb46bd7ec1cb59a9ce30a69442f0 Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 00:30:34 +0900 Subject: [PATCH 04/29] =?UTF-8?q?[feat]=20#7=20studyCard=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20Type=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/model/ShadowConfig.kt | 12 +++++ .../presentation/type/StudyCardData.kt | 25 +++++++++++ .../presentation/type/StudyCardStateType.kt | 44 +++++++++++++++++++ .../presentation/type/StudyCardType.kt | 6 +++ 4 files changed, 87 insertions(+) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt create mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt create mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt create mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/StudyCardType.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt b/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt new file mode 100644 index 0000000..8bea562 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt @@ -0,0 +1,12 @@ +package org.android.bbangzip.presentation.model + +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp + +data class ShadowConfig( + val color: Color, + val blur: Dp, + val offsetX: Dp, + val offsetY: Dp, + val spread: Dp +) \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt new file mode 100644 index 0000000..8b13a72 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt @@ -0,0 +1,25 @@ +package org.android.bbangzip.presentation.type + +sealed interface StudyCardData { + data class TodoCardData( + val pieceId: String, + val subjectName: String, + val examName: String, + val studyContents: String, + val startPage: Int, + val finishPage: Int, + val deadline: String, + val remainingDays: Int, + val isFinished: Boolean, + val todoItemType: String + ) : StudyCardData + + data class SubjectCardData( + val subjectId: Int, + val subjectName: String, + val examName: String, + val examRemainingDays: Int, + val pendingCount: Int, + val inProgressCount: Int + ) : StudyCardData +} \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt new file mode 100644 index 0000000..e121d0f --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt @@ -0,0 +1,44 @@ +package org.android.bbangzip.presentation.type + +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp +import org.android.bbangzip.presentation.model.ShadowConfig + +sealed interface StudyCardStateType { + data class DEFAULT( + var background: Color, + var borderColor: Color, + var borderWidth: Dp, + var radius: Dp, + var shadowOptions: List + ) : StudyCardStateType + + + data class CHECKABLE( + var background: Color, + var borderColor: Color, + var borderWidth: Dp, + var radius: Dp, + var shadowOptions: List + ) : StudyCardStateType + + data class CHECKED( + var background: Color, + var borderColor: Color, + var borderWidth: Dp, + var radius: Dp, + var shadowOptions: List + ) : StudyCardStateType +} + +sealed interface SubjectCardStateType : StudyCardStateType + +sealed interface ToDoCardStateType : StudyCardStateType { + data class COMPLETE( + var background: Color, + var borderColor: Color, + var borderWidth: Dp, + var radius: Dp, + var shadowOptions : ShadowConfig + ) : ToDoCardStateType +} \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardType.kt new file mode 100644 index 0000000..02588f3 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardType.kt @@ -0,0 +1,6 @@ +package org.android.bbangzip.presentation.type + +sealed class StudyCardType{ + data object TODO : StudyCardType() + data object SUBJECT : StudyCardType() +} \ No newline at end of file From 36a7269fe7382ae873b0be08a328839a59e4a32a Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 02:33:15 +0900 Subject: [PATCH 05/29] =?UTF-8?q?[feat]=20#7=20modifierExt=20applyShadow?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/component/card/ToDoCard.kt | 92 +++++++++++++++++++ .../presentation/util/modifier/ModifierExt.kt | 11 +++ 2 files changed, 103 insertions(+) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt new file mode 100644 index 0000000..d261135 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -0,0 +1,92 @@ +package org.android.bbangzip.presentation.component.card + +import androidx.compose.foundation.background +import androidx.compose.foundation.border +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.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import org.android.bbangzip.presentation.type.StudyCardData +import org.android.bbangzip.presentation.type.StudyCardStyle +import org.android.bbangzip.presentation.util.modifier.applyShadows +import org.android.bbangzip.ui.theme.BbangZipTheme + +@Composable +fun ToDoCard( + style: StudyCardStyle, + data: StudyCardData.TodoCardData, + isComplete: Boolean, + modifier: Modifier = Modifier +) { + val applicableShadows = if (isComplete) { + style.shadowOptions.take(1) + } else { + style.shadowOptions + } + Box( + modifier = modifier + .fillMaxWidth() + .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) + .background(color = style.background) + .padding(horizontal = 16.dp, vertical = 10.dp), + ) { + Row( + modifier = Modifier + .applyShadows(shadowOptions = applicableShadows, shape = RoundedCornerShape(style.radius)) + .fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + ToDoInfo(data = data) + Icon() + } + } +} + +@Composable +fun ToDoInfo( + data: StudyCardData.TodoCardData, + modifier: Modifier = Modifier +) { + Column(modifier = modifier) { + Text( + text = "${data.subjectName} / ${data.examName}", + style = BbangZipTheme.typography.caption2Medium, + color = BbangZipTheme.colors.labelAssistive_282119_28 + ) + Text( + text = data.studyContents, + style = BbangZipTheme.typography.caption1Medium, + color = BbangZipTheme.colors.labelAlternative_282119_61 + ) + Text( + text = "${data.startPage}p - ${data.finishPage}p", + style = BbangZipTheme.typography.label1Bold, + color = BbangZipTheme.colors.labelNormal_282119 + ) + Row { + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .background(color = BbangZipTheme.colors.statusDestructive_FF8345, shape = RoundedCornerShape(11.dp)) + .padding(horizontal = 12.dp, vertical = 2.dp) + ) { + Text(text = "D+5", style = BbangZipTheme.typography.caption1Medium, color = BbangZipTheme.colors.staticWhite_FFFFFF) + } + + Text( + text = "${data.deadline}까지", + style = BbangZipTheme.typography.label1Bold, + color = BbangZipTheme.colors.labelNormal_282119 + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt index dfde429..8eabc45 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.graphics.drawscope.drawIntoCanvas import androidx.compose.ui.semantics.Role import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import org.android.bbangzip.presentation.model.ShadowConfig @Composable fun Modifier.noRippleClickable( @@ -61,4 +62,14 @@ fun Modifier.dropShadow( canvas.drawOutline(shadowOutline, paint) canvas.restore() } +} + +@Composable +fun Modifier.applyShadows( + shadowOptions: List, + shape: Shape +): Modifier { + return shadowOptions.fold(this) { acc, shadowConfig -> + acc.dropShadow(shape = shape, color = shadowConfig.color, blur = shadowConfig.blur, offsetY = shadowConfig.offsetY, offsetX = shadowConfig.offsetX, spread = shadowConfig.spread) + } } \ No newline at end of file From db6a8c046bf53e03d4b86190c0902ce862263457 Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 02:33:46 +0900 Subject: [PATCH 06/29] =?UTF-8?q?[feat]=20#7=20cardStateType=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20,=20studyCardSlot=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/StudyCardSlot.kt | 56 +++++++ .../component/card/SubjectCard.kt | 14 ++ .../presentation/type/StudyCardData.kt | 2 - .../presentation/type/StudyCardStateType.kt | 154 ++++++++++++++---- 4 files changed, 193 insertions(+), 33 deletions(-) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt create mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt new file mode 100644 index 0000000..d4b7b37 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt @@ -0,0 +1,56 @@ +package org.android.bbangzip.presentation.component.card + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import org.android.bbangzip.presentation.model.ShadowConfig +import org.android.bbangzip.presentation.type.StudyCardData +import org.android.bbangzip.presentation.type.StudyCardStateType +import org.android.bbangzip.presentation.type.StudyCardStyle +import org.android.bbangzip.presentation.type.StudyCardType +import org.android.bbangzip.presentation.type.ToDoCardStateType +import org.android.bbangzip.ui.theme.BbangZipTheme + +@Composable +fun StudyCardSlot( + stateType: StudyCardStateType, + studyType: StudyCardType, + data: StudyCardData, + modifier: Modifier = Modifier, +) { + val style =stateType.getStyle() + when (studyType) { + StudyCardType.TODO -> { + val todoDate = data as? StudyCardData.TodoCardData ?: throw IllegalArgumentException("Invalid data for TODO card") + + ToDoCard( + style = style, + data = todoDate, + isComplete = stateType == ToDoCardStateType.COMPLETE, + modifier = modifier + ) + } + + StudyCardType.SUBJECT -> { + val subjectData = data as? StudyCardData.SubjectCardData ?: throw IllegalArgumentException("Invalid data for SUBJECT card") + SubjectCard( + style = style, + data = subjectData, + modifier = modifier + ) + } + } +} +/* + 공통 부분 : State에따라 background border 그림자 변경되는거 + state type = Catched / catchAbLe / default / Complete(버튼에서만) + state에따라서 background opacity 를 다르게 하고 icon 차이 + card type = todo / subject + 카드의 높이 넓이가 아예 다름 + 들어가는 data도 다름 + 분기도 다름 + 그림자도 다fma + 바깥 state를 정했잖아 안의 내용물은 cardSTate로 정해보자 + + + */ \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt new file mode 100644 index 0000000..4e44924 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -0,0 +1,14 @@ +package org.android.bbangzip.presentation.component.card + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import org.android.bbangzip.presentation.type.StudyCardData +import org.android.bbangzip.presentation.type.StudyCardStyle + +@Composable +fun SubjectCard( + style: StudyCardStyle, + data: StudyCardData.SubjectCardData, + modifier: Modifier = Modifier) { + +} \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt index 8b13a72..ae407cb 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt @@ -10,8 +10,6 @@ sealed interface StudyCardData { val finishPage: Int, val deadline: String, val remainingDays: Int, - val isFinished: Boolean, - val todoItemType: String ) : StudyCardData data class SubjectCardData( diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt index e121d0f..d2eafa2 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt @@ -1,44 +1,136 @@ package org.android.bbangzip.presentation.type +import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp import org.android.bbangzip.presentation.model.ShadowConfig +import org.android.bbangzip.ui.theme.BbangZipTheme + +data class StudyCardStyle( + val background: Color, + val borderColor: Color, + val borderWidth: Dp, + val radius: Dp, + val shadowOptions: List +) sealed interface StudyCardStateType { - data class DEFAULT( - var background: Color, - var borderColor: Color, - var borderWidth: Dp, - var radius: Dp, - var shadowOptions: List - ) : StudyCardStateType + @Composable fun getStyle(): StudyCardStyle + data object DEFAULT : StudyCardStateType { + @Composable override fun getStyle() = StudyCardStyle( + background = BbangZipTheme.colors.backgroundNormal_FFFFFF, + borderColor = BbangZipTheme.colors.fillNormal_68645E_08, + borderWidth = 1.dp, + radius = 24.dp, + shadowOptions = listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 2.dp, + spread = 0.dp + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 1.dp, + spread = 0.dp + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), + blur = 1.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp + ) + ) + ) + } - data class CHECKABLE( - var background: Color, - var borderColor: Color, - var borderWidth: Dp, - var radius: Dp, - var shadowOptions: List - ) : StudyCardStateType + data object CHECKABLE : StudyCardStateType { + @Composable override fun getStyle() = StudyCardStyle( + background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, + borderColor = BbangZipTheme.colors.fillNormal_68645E_08, + borderWidth = 1.dp, + radius = 24.dp, + shadowOptions = listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 12.dp, + offsetX = 0.dp, + offsetY = 6.dp, + spread = 0.dp + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp + ) + ) + ) + } - data class CHECKED( - var background: Color, - var borderColor: Color, - var borderWidth: Dp, - var radius: Dp, - var shadowOptions: List - ) : StudyCardStateType + data object CHECKED : StudyCardStateType { + @Composable override fun getStyle() = StudyCardStyle( + background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, + borderColor = BbangZipTheme.colors.fillNormal_68645E_08, + borderWidth = 3.dp, + radius = 24.dp, + shadowOptions = listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 12.dp, + offsetX = 0.dp, + offsetY = 6.dp, + spread = 0.dp + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp + ) + ) + ) + } } -sealed interface SubjectCardStateType : StudyCardStateType - sealed interface ToDoCardStateType : StudyCardStateType { - data class COMPLETE( - var background: Color, - var borderColor: Color, - var borderWidth: Dp, - var radius: Dp, - var shadowOptions : ShadowConfig - ) : ToDoCardStateType -} \ No newline at end of file + data object COMPLETE : ToDoCardStateType { + @Composable override fun getStyle() = StudyCardStyle( + background = BbangZipTheme.colors.backgroundNormal_FFFFFF, + borderColor = BbangZipTheme.colors.fillNormal_68645E_08, + borderWidth = 1.dp, + radius = 24.dp, + shadowOptions = listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity28), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp + ) + ) + ) + } +} From de1de52dc862e78d0f607b338426e718041e8c6b Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 03:30:53 +0900 Subject: [PATCH 07/29] =?UTF-8?q?[feat]=20#7=20ToDoCard=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/StudyCardSlot.kt | 7 +- .../presentation/component/card/ToDoCard.kt | 179 +++++++++++++++--- .../presentation/type/StudyCardStateType.kt | 8 +- 3 files changed, 161 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt index d4b7b37..4e2cc13 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt @@ -18,15 +18,12 @@ fun StudyCardSlot( data: StudyCardData, modifier: Modifier = Modifier, ) { - val style =stateType.getStyle() when (studyType) { StudyCardType.TODO -> { val todoDate = data as? StudyCardData.TodoCardData ?: throw IllegalArgumentException("Invalid data for TODO card") - ToDoCard( - style = style, + stateType = stateType, data = todoDate, - isComplete = stateType == ToDoCardStateType.COMPLETE, modifier = modifier ) } @@ -34,7 +31,7 @@ fun StudyCardSlot( StudyCardType.SUBJECT -> { val subjectData = data as? StudyCardData.SubjectCardData ?: throw IllegalArgumentException("Invalid data for SUBJECT card") SubjectCard( - style = style, + stateType = stateType, data = subjectData, modifier = modifier ) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index d261135..cce4739 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -6,73 +6,114 @@ 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.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import org.android.bbangzip.R import org.android.bbangzip.presentation.type.StudyCardData -import org.android.bbangzip.presentation.type.StudyCardStyle +import org.android.bbangzip.presentation.type.StudyCardStateType +import org.android.bbangzip.presentation.type.ToDoCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows +import org.android.bbangzip.ui.theme.BBANGZIPTheme import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun ToDoCard( - style: StudyCardStyle, + stateType: StudyCardStateType, data: StudyCardData.TodoCardData, - isComplete: Boolean, modifier: Modifier = Modifier ) { + val style = stateType.getStyle() + val isComplete = stateType == ToDoCardStateType.COMPLETE val applicableShadows = if (isComplete) { style.shadowOptions.take(1) } else { style.shadowOptions } + val background = when (stateType) { + StudyCardStateType.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 + StudyCardStateType.CHECKED -> BbangZipTheme.colors.fillStrong_68645E_16 + StudyCardStateType.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 + ToDoCardStateType.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 + } Box( modifier = modifier + .applyShadows(shadowOptions = applicableShadows, shape = RoundedCornerShape(style.radius)) .fillMaxWidth() .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) - .background(color = style.background) + .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) .padding(horizontal = 16.dp, vertical = 10.dp), ) { Row( modifier = Modifier - .applyShadows(shadowOptions = applicableShadows, shape = RoundedCornerShape(style.radius)) .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween ) { ToDoInfo(data = data) - Icon() + CheckSpace( + backgroundColor = background, + checkIcon = if (isComplete) { + { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), + contentDescription = "체크 표시 아이콘입니다.", + tint = BbangZipTheme.colors.staticWhite_FFFFFF + ) + } + } else { + null + } + ) } } } + @Composable fun ToDoInfo( data: StudyCardData.TodoCardData, modifier: Modifier = Modifier ) { Column(modifier = modifier) { - Text( - text = "${data.subjectName} / ${data.examName}", - style = BbangZipTheme.typography.caption2Medium, - color = BbangZipTheme.colors.labelAssistive_282119_28 - ) - Text( - text = data.studyContents, - style = BbangZipTheme.typography.caption1Medium, - color = BbangZipTheme.colors.labelAlternative_282119_61 - ) - Text( - text = "${data.startPage}p - ${data.finishPage}p", - style = BbangZipTheme.typography.label1Bold, - color = BbangZipTheme.colors.labelNormal_282119 - ) - Row { + Column (modifier =Modifier.padding(start = 4.dp)){ + Text( + text = "${data.subjectName} / ${data.examName}", + style = BbangZipTheme.typography.caption2Medium, + color = BbangZipTheme.colors.labelAssistive_282119_28 + ) + + Spacer(modifier = Modifier.height(2.dp)) + + Text( + text = data.studyContents, + style = BbangZipTheme.typography.caption1Medium, + color = BbangZipTheme.colors.labelAlternative_282119_61 + ) + + Spacer(modifier = Modifier.height(4.dp)) + + Text( + text = "${data.startPage}p - ${data.finishPage}p", + style = BbangZipTheme.typography.label1Bold, + color = BbangZipTheme.colors.labelNormal_282119 + ) + } + Spacer(modifier = Modifier.height(6.dp)) + + Row(verticalAlignment = Alignment.CenterVertically) { Box( contentAlignment = Alignment.Center, modifier = Modifier @@ -82,11 +123,101 @@ fun ToDoInfo( Text(text = "D+5", style = BbangZipTheme.typography.caption1Medium, color = BbangZipTheme.colors.staticWhite_FFFFFF) } + Spacer(modifier = Modifier.width(8.dp)) + Text( text = "${data.deadline}까지", - style = BbangZipTheme.typography.label1Bold, + style = BbangZipTheme.typography.caption1Bold, color = BbangZipTheme.colors.labelNormal_282119 ) } } -} \ No newline at end of file +} + +@Composable +fun CheckSpace( + modifier: Modifier = Modifier, + backgroundColor: Color, + checkIcon: @Composable (() -> Unit)? = null, +) { + Box( + contentAlignment = Alignment.Center, + modifier = modifier + .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) + .height(32.dp) + .width(32.dp) + //TODO 여기 어떤식으로 기기대응하는지 물어보기 + ) { + checkIcon?.invoke() + } +} + +@Preview(showBackground = true) +@Composable +fun ToDoCardPreview() { + BBANGZIPTheme { + Column { + ToDoCard( + stateType = StudyCardStateType.DEFAULT, + data = StudyCardData.TodoCardData( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1 + ), + modifier = Modifier + .padding(16.dp) + ) + ToDoCard( + stateType = StudyCardStateType.CHECKED, + data = StudyCardData.TodoCardData( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1 + ), + modifier = Modifier + .padding(16.dp) + ) + ToDoCard( + stateType = StudyCardStateType.CHECKABLE, + data = StudyCardData.TodoCardData( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1 + ), + modifier = Modifier + .padding(16.dp) + ) + ToDoCard( + stateType = ToDoCardStateType.COMPLETE, + data = StudyCardData.TodoCardData( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1 + ), + modifier = Modifier + .padding(16.dp) + ) + } + } +} + diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt index d2eafa2..f93f906 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt @@ -21,7 +21,7 @@ sealed interface StudyCardStateType { data object DEFAULT : StudyCardStateType { @Composable override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundNormal_FFFFFF, - borderColor = BbangZipTheme.colors.fillNormal_68645E_08, + borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, borderWidth = 1.dp, radius = 24.dp, shadowOptions = listOf( @@ -53,7 +53,7 @@ sealed interface StudyCardStateType { data object CHECKABLE : StudyCardStateType { @Composable override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, - borderColor = BbangZipTheme.colors.fillNormal_68645E_08, + borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, borderWidth = 1.dp, radius = 24.dp, shadowOptions = listOf( @@ -85,7 +85,7 @@ sealed interface StudyCardStateType { data object CHECKED : StudyCardStateType { @Composable override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, - borderColor = BbangZipTheme.colors.fillNormal_68645E_08, + borderColor = BbangZipTheme.colors.lineStrong_68645E_52, borderWidth = 3.dp, radius = 24.dp, shadowOptions = listOf( @@ -119,7 +119,7 @@ sealed interface ToDoCardStateType : StudyCardStateType { data object COMPLETE : ToDoCardStateType { @Composable override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundNormal_FFFFFF, - borderColor = BbangZipTheme.colors.fillNormal_68645E_08, + borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, borderWidth = 1.dp, radius = 24.dp, shadowOptions = listOf( From 93ad2e3a5e46e9fc731331e389357a4bd0d96bc8 Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 03:33:11 +0900 Subject: [PATCH 08/29] =?UTF-8?q?[mod]=20#7=20ToDoCard=20deadline=20?= =?UTF-8?q?=EC=83=89=EC=83=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/bbangzip/presentation/component/card/ToDoCard.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index cce4739..0b0a6cd 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -128,7 +128,7 @@ fun ToDoInfo( Text( text = "${data.deadline}까지", style = BbangZipTheme.typography.caption1Bold, - color = BbangZipTheme.colors.labelNormal_282119 + color = BbangZipTheme.colors.labelAlternative_282119_61 ) } } From 40b80859066920dfb4a9b308538e4c15980e1592 Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 04:22:54 +0900 Subject: [PATCH 09/29] =?UTF-8?q?[feat]=20#7=20SubjectCard=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/SubjectCard.kt | 191 +++++++++++++++++- .../presentation/component/card/ToDoCard.kt | 2 +- 2 files changed, 189 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index 4e44924..f2b4ea0 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -1,14 +1,199 @@ package org.android.bbangzip.presentation.component.card +import androidx.compose.foundation.background +import androidx.compose.foundation.border +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.fillMaxHeight +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon +import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.android.bbangzip.R import org.android.bbangzip.presentation.type.StudyCardData -import org.android.bbangzip.presentation.type.StudyCardStyle +import org.android.bbangzip.presentation.type.StudyCardStateType +import org.android.bbangzip.presentation.util.modifier.applyShadows +import org.android.bbangzip.ui.theme.BBANGZIPTheme +import org.android.bbangzip.ui.theme.BbangZipTheme + @Composable fun SubjectCard( - style: StudyCardStyle, + stateType: StudyCardStateType, + data: StudyCardData.SubjectCardData, + modifier: Modifier = Modifier +) { + val style = stateType.getStyle() + + Box( + modifier = modifier + .applyShadows(shadowOptions = style.shadowOptions, shape = RoundedCornerShape(style.radius)) + .height(190.dp) // TODO 기기대응 어케할지 물어보기 + .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) + .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + SubjectInfo( + data = data + ) + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_chevronright_thick_small_24), + tint = BbangZipTheme.colors.labelAssistive_282119_28, + contentDescription = "오늘 할 일로 향하는 버튼입니다." + ) + } + } +} + +@Composable +fun SubjectInfo( data: StudyCardData.SubjectCardData, - modifier: Modifier = Modifier) { + modifier: Modifier = Modifier +) { + Column( + modifier = modifier.fillMaxHeight(), + verticalArrangement = Arrangement.SpaceBetween, + ) { + Column { + Text( + text = data.subjectName, + style = BbangZipTheme.typography.body1Bold, + color = BbangZipTheme.colors.labelNormal_282119, + ) + + Spacer(modifier = Modifier.height(4.dp)) + + Text( + text = data.examName, + style = BbangZipTheme.typography.label2Bold, + color = BbangZipTheme.colors.labelNeutral_282119_88, + ) + + Spacer(modifier = Modifier.height(4.dp)) + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .background(color = BbangZipTheme.colors.statusPositive_3D3730, shape = RoundedCornerShape(11.dp)) + .padding(horizontal = 12.dp, vertical = 2.dp) + ) { + Text( + text = "D-24", + style = BbangZipTheme.typography.caption1Medium, + color = BbangZipTheme.colors.staticWhite_FFFFFF + ) + }//TODO 칩구현 + } + Column { + StudyStateCountCircle( + backgroundColor = BbangZipTheme.colors.statusDestructive_FF8345, + count = data.pendingCount, + text = "밀린 공부" + ) + Spacer(modifier = Modifier.height(4.dp)) + + StudyStateCountCircle( + backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, + count = data.inProgressCount, + text = "진행 중인 공부" + ) + } + + } +} + +@Composable +fun StudyStateCountCircle( + backgroundColor: Color, + count: Int, + text: String, + modifier: Modifier = Modifier +) { + Row(verticalAlignment = Alignment.CenterVertically) { + Box( + contentAlignment = Alignment.Center, + modifier = modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp) + ) { + Text( + text = count.toString(), + style = BbangZipTheme.typography.caption2Bold, + color = BbangZipTheme.colors.staticWhite_FFFFFF + ) + } + + Spacer(modifier = Modifier.width(4.dp)) + + Text( + text = text, + style = BbangZipTheme.typography.caption1Bold, + color = BbangZipTheme.colors.labelAssistive_282119_28 + ) + } +} + +@Preview(showBackground = true) +@Composable +fun SubjectCardPreview() { + BBANGZIPTheme { + Column { + SubjectCard( + stateType = StudyCardStateType.DEFAULT, // 필요한 상태 타입 설정 + data = StudyCardData.SubjectCardData( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, // 밀린 공부 개수 + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1 // 진행 중인 공부 개수 + ), + modifier = Modifier + .padding(16.dp) // 카드가 화면에 잘 보이도록 여백 추가 + ) + SubjectCard( + stateType = StudyCardStateType.CHECKED, // 필요한 상태 타입 설정 + data = StudyCardData.SubjectCardData( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, // 밀린 공부 개수 + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1 // 진행 중인 공부 개수 + ), + modifier = Modifier + .padding(16.dp) // 카드가 화면에 잘 보이도록 여백 추가 + ) + SubjectCard( + stateType = StudyCardStateType.CHECKABLE, // 필요한 상태 타입 설정 + data = StudyCardData.SubjectCardData( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, // 밀린 공부 개수 + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1 // 진행 중인 공부 개수 + ), + modifier = Modifier + .padding(16.dp) // 카드가 화면에 잘 보이도록 여백 추가 + ) + } + } } \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 0b0a6cd..a96a461 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -121,7 +121,7 @@ fun ToDoInfo( .padding(horizontal = 12.dp, vertical = 2.dp) ) { Text(text = "D+5", style = BbangZipTheme.typography.caption1Medium, color = BbangZipTheme.colors.staticWhite_FFFFFF) - } + }// TODO 칩 구현 Spacer(modifier = Modifier.width(8.dp)) From f0377d7dd60562955d4e49c0c7bda4668d9401b5 Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 11:06:25 +0900 Subject: [PATCH 10/29] =?UTF-8?q?[feat]=20#7=20Card=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/BbangZipCardSlot.kt | 159 ++++++++++++++++++ .../component/card/StudyCardSlot.kt | 53 ------ .../component/card/SubjectCard.kt | 22 +-- .../presentation/component/card/ToDoCard.kt | 30 ++-- .../card/model/BbangZipCardData.kt} | 13 +- ...dStateType.kt => BbangZipCardStateType.kt} | 10 +- .../presentation/type/BbangZipCardType.kt | 6 + .../presentation/type/StudyCardType.kt | 6 - 8 files changed, 205 insertions(+), 94 deletions(-) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt delete mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt rename app/src/main/java/org/android/bbangzip/presentation/{type/StudyCardData.kt => component/card/model/BbangZipCardData.kt} (65%) rename app/src/main/java/org/android/bbangzip/presentation/type/{StudyCardStateType.kt => BbangZipCardStateType.kt} (95%) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt delete mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/StudyCardType.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt new file mode 100644 index 0000000..435d9d4 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt @@ -0,0 +1,159 @@ +package org.android.bbangzip.presentation.component.card + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.android.bbangzip.presentation.component.card.model.BbangZipCardData +import org.android.bbangzip.presentation.type.BbangZipCardStateType +import org.android.bbangzip.presentation.type.BbangZipCardType +import org.android.bbangzip.presentation.type.ToDoCardStateType +import org.android.bbangzip.ui.theme.BBANGZIPTheme + +@Composable +fun BbangZipCardSlot( + stateType: BbangZipCardStateType, + studyType: BbangZipCardType, + data: BbangZipCardData, + modifier: Modifier = Modifier, +) { + when (studyType) { + BbangZipCardType.TODO -> { + val todoDate = data as? BbangZipCardData.TodoCardData ?: throw IllegalArgumentException("Invalid data for TODO card") + ToDoCard( + stateType = stateType, + data = todoDate, + modifier = modifier + ) + } + + BbangZipCardType.SUBJECT -> { + val subjectData = data as? BbangZipCardData.SubjectCardData ?: throw IllegalArgumentException("Invalid data for SUBJECT card") + SubjectCard( + stateType = stateType, + data = subjectData, + modifier = modifier + ) + } + } +} + +@Preview(showBackground = true, showSystemUi = true) +@Composable +fun StudyCardSlotPreview() { + BBANGZIPTheme { + Column( + modifier = Modifier.padding(16.dp) + ) { + // ToDoCard States + BbangZipCardSlot( + stateType = BbangZipCardStateType.DEFAULT, + studyType = BbangZipCardType.TODO, + data = BbangZipCardData.TodoCardData( + pieceId = "1", + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + remainingDays = 1 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + + BbangZipCardSlot( + stateType = BbangZipCardStateType.CHECKED, + studyType = BbangZipCardType.TODO, + data = BbangZipCardData.TodoCardData( + pieceId = "1", + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + remainingDays = 1 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + + BbangZipCardSlot( + stateType = BbangZipCardStateType.CHECKABLE, + studyType = BbangZipCardType.TODO, + data = BbangZipCardData.TodoCardData( + pieceId = "1", + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + remainingDays = 1 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + + BbangZipCardSlot( + stateType = ToDoCardStateType.COMPLETE, + studyType = BbangZipCardType.TODO, + data = BbangZipCardData.TodoCardData( + pieceId = "1", + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + remainingDays = 1 + ), + modifier = Modifier.padding(bottom = 16.dp) + ) + + // SubjectCard States + BbangZipCardSlot( + stateType = BbangZipCardStateType.DEFAULT, + studyType = BbangZipCardType.SUBJECT, + data = BbangZipCardData.SubjectCardData( + subjectId = 1, + subjectName = "[경영] 경제통계학", + examName = "중간고사", + examRemainingDays = 1, + pendingCount = 0, + inProgressCount = 6 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + + BbangZipCardSlot( + stateType = BbangZipCardStateType.CHECKED, + studyType = BbangZipCardType.SUBJECT, + data = BbangZipCardData.SubjectCardData( + subjectId = 1, + subjectName = "[경영] 경제통계학", + examName = "중간고사", + examRemainingDays = 1, + pendingCount = 0, + inProgressCount = 6 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + + BbangZipCardSlot( + stateType = BbangZipCardStateType.CHECKABLE, + studyType = BbangZipCardType.SUBJECT, + data = BbangZipCardData.SubjectCardData( + subjectId = 1, + subjectName = "[경영] 경제통계학", + examName = "중간고사", + examRemainingDays = 1, + pendingCount = 0, + inProgressCount = 6 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt deleted file mode 100644 index 4e2cc13..0000000 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/StudyCardSlot.kt +++ /dev/null @@ -1,53 +0,0 @@ -package org.android.bbangzip.presentation.component.card - -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import org.android.bbangzip.presentation.model.ShadowConfig -import org.android.bbangzip.presentation.type.StudyCardData -import org.android.bbangzip.presentation.type.StudyCardStateType -import org.android.bbangzip.presentation.type.StudyCardStyle -import org.android.bbangzip.presentation.type.StudyCardType -import org.android.bbangzip.presentation.type.ToDoCardStateType -import org.android.bbangzip.ui.theme.BbangZipTheme - -@Composable -fun StudyCardSlot( - stateType: StudyCardStateType, - studyType: StudyCardType, - data: StudyCardData, - modifier: Modifier = Modifier, -) { - when (studyType) { - StudyCardType.TODO -> { - val todoDate = data as? StudyCardData.TodoCardData ?: throw IllegalArgumentException("Invalid data for TODO card") - ToDoCard( - stateType = stateType, - data = todoDate, - modifier = modifier - ) - } - - StudyCardType.SUBJECT -> { - val subjectData = data as? StudyCardData.SubjectCardData ?: throw IllegalArgumentException("Invalid data for SUBJECT card") - SubjectCard( - stateType = stateType, - data = subjectData, - modifier = modifier - ) - } - } -} -/* - 공통 부분 : State에따라 background border 그림자 변경되는거 - state type = Catched / catchAbLe / default / Complete(버튼에서만) - state에따라서 background opacity 를 다르게 하고 icon 차이 - card type = todo / subject - 카드의 높이 넓이가 아예 다름 - 들어가는 data도 다름 - 분기도 다름 - 그림자도 다fma - 바깥 state를 정했잖아 안의 내용물은 cardSTate로 정해보자 - - - */ \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index f2b4ea0..eeecec5 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -24,8 +24,8 @@ import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.android.bbangzip.R -import org.android.bbangzip.presentation.type.StudyCardData -import org.android.bbangzip.presentation.type.StudyCardStateType +import org.android.bbangzip.presentation.component.card.model.BbangZipCardData +import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme import org.android.bbangzip.ui.theme.BbangZipTheme @@ -33,8 +33,8 @@ import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun SubjectCard( - stateType: StudyCardStateType, - data: StudyCardData.SubjectCardData, + stateType: BbangZipCardStateType, + data: BbangZipCardData.SubjectCardData, modifier: Modifier = Modifier ) { val style = stateType.getStyle() @@ -64,7 +64,7 @@ fun SubjectCard( @Composable fun SubjectInfo( - data: StudyCardData.SubjectCardData, + data: BbangZipCardData.SubjectCardData, modifier: Modifier = Modifier ) { Column( @@ -156,8 +156,8 @@ fun SubjectCardPreview() { BBANGZIPTheme { Column { SubjectCard( - stateType = StudyCardStateType.DEFAULT, // 필요한 상태 타입 설정 - data = StudyCardData.SubjectCardData( + stateType = BbangZipCardStateType.DEFAULT, // 필요한 상태 타입 설정 + data = BbangZipCardData.SubjectCardData( subjectName = "[경영] 경제통계학", examName = "중간고사", pendingCount = 0, // 밀린 공부 개수 @@ -169,8 +169,8 @@ fun SubjectCardPreview() { .padding(16.dp) // 카드가 화면에 잘 보이도록 여백 추가 ) SubjectCard( - stateType = StudyCardStateType.CHECKED, // 필요한 상태 타입 설정 - data = StudyCardData.SubjectCardData( + stateType = BbangZipCardStateType.CHECKED, // 필요한 상태 타입 설정 + data = BbangZipCardData.SubjectCardData( subjectName = "[경영] 경제통계학", examName = "중간고사", pendingCount = 0, // 밀린 공부 개수 @@ -182,8 +182,8 @@ fun SubjectCardPreview() { .padding(16.dp) // 카드가 화면에 잘 보이도록 여백 추가 ) SubjectCard( - stateType = StudyCardStateType.CHECKABLE, // 필요한 상태 타입 설정 - data = StudyCardData.SubjectCardData( + stateType = BbangZipCardStateType.CHECKABLE, // 필요한 상태 타입 설정 + data = BbangZipCardData.SubjectCardData( subjectName = "[경영] 경제통계학", examName = "중간고사", pendingCount = 0, // 밀린 공부 개수 diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index a96a461..b23d819 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -23,8 +23,8 @@ import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.android.bbangzip.R -import org.android.bbangzip.presentation.type.StudyCardData -import org.android.bbangzip.presentation.type.StudyCardStateType +import org.android.bbangzip.presentation.component.card.model.BbangZipCardData +import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.type.ToDoCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme @@ -32,8 +32,8 @@ import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun ToDoCard( - stateType: StudyCardStateType, - data: StudyCardData.TodoCardData, + stateType: BbangZipCardStateType, + data: BbangZipCardData.TodoCardData, modifier: Modifier = Modifier ) { val style = stateType.getStyle() @@ -44,9 +44,9 @@ fun ToDoCard( style.shadowOptions } val background = when (stateType) { - StudyCardStateType.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 - StudyCardStateType.CHECKED -> BbangZipTheme.colors.fillStrong_68645E_16 - StudyCardStateType.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 + BbangZipCardStateType.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 + BbangZipCardStateType.CHECKED -> BbangZipTheme.colors.fillStrong_68645E_16 + BbangZipCardStateType.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 ToDoCardStateType.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 } Box( @@ -84,7 +84,7 @@ fun ToDoCard( @Composable fun ToDoInfo( - data: StudyCardData.TodoCardData, + data: BbangZipCardData.TodoCardData, modifier: Modifier = Modifier ) { Column(modifier = modifier) { @@ -158,8 +158,8 @@ fun ToDoCardPreview() { BBANGZIPTheme { Column { ToDoCard( - stateType = StudyCardStateType.DEFAULT, - data = StudyCardData.TodoCardData( + stateType = BbangZipCardStateType.DEFAULT, + data = BbangZipCardData.TodoCardData( subjectName = "경제통계학개론", examName = "중간고사", studyContents = "경제통계학", @@ -173,8 +173,8 @@ fun ToDoCardPreview() { .padding(16.dp) ) ToDoCard( - stateType = StudyCardStateType.CHECKED, - data = StudyCardData.TodoCardData( + stateType = BbangZipCardStateType.CHECKED, + data = BbangZipCardData.TodoCardData( subjectName = "경제통계학개론", examName = "중간고사", studyContents = "경제통계학", @@ -188,8 +188,8 @@ fun ToDoCardPreview() { .padding(16.dp) ) ToDoCard( - stateType = StudyCardStateType.CHECKABLE, - data = StudyCardData.TodoCardData( + stateType = BbangZipCardStateType.CHECKABLE, + data = BbangZipCardData.TodoCardData( subjectName = "경제통계학개론", examName = "중간고사", studyContents = "경제통계학", @@ -204,7 +204,7 @@ fun ToDoCardPreview() { ) ToDoCard( stateType = ToDoCardStateType.COMPLETE, - data = StudyCardData.TodoCardData( + data = BbangZipCardData.TodoCardData( subjectName = "경제통계학개론", examName = "중간고사", studyContents = "경제통계학", diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt similarity index 65% rename from app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt rename to app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt index ae407cb..9dc5e75 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardData.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt @@ -1,6 +1,10 @@ -package org.android.bbangzip.presentation.type +package org.android.bbangzip.presentation.component.card.model -sealed interface StudyCardData { +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +sealed interface BbangZipCardData { + @Parcelize data class TodoCardData( val pieceId: String, val subjectName: String, @@ -10,8 +14,9 @@ sealed interface StudyCardData { val finishPage: Int, val deadline: String, val remainingDays: Int, - ) : StudyCardData + ) : BbangZipCardData, Parcelable + @Parcelize data class SubjectCardData( val subjectId: Int, val subjectName: String, @@ -19,5 +24,5 @@ sealed interface StudyCardData { val examRemainingDays: Int, val pendingCount: Int, val inProgressCount: Int - ) : StudyCardData + ) : BbangZipCardData, Parcelable } \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt similarity index 95% rename from app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt rename to app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt index f93f906..d3dff4c 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardStateType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt @@ -15,10 +15,10 @@ data class StudyCardStyle( val shadowOptions: List ) -sealed interface StudyCardStateType { +sealed interface BbangZipCardStateType { @Composable fun getStyle(): StudyCardStyle - data object DEFAULT : StudyCardStateType { + data object DEFAULT : BbangZipCardStateType { @Composable override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundNormal_FFFFFF, borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, @@ -50,7 +50,7 @@ sealed interface StudyCardStateType { ) } - data object CHECKABLE : StudyCardStateType { + data object CHECKABLE : BbangZipCardStateType { @Composable override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, @@ -82,7 +82,7 @@ sealed interface StudyCardStateType { ) } - data object CHECKED : StudyCardStateType { + data object CHECKED : BbangZipCardStateType { @Composable override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, borderColor = BbangZipTheme.colors.lineStrong_68645E_52, @@ -115,7 +115,7 @@ sealed interface StudyCardStateType { } } -sealed interface ToDoCardStateType : StudyCardStateType { +sealed interface ToDoCardStateType : BbangZipCardStateType { data object COMPLETE : ToDoCardStateType { @Composable override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundNormal_FFFFFF, diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt new file mode 100644 index 0000000..66bac34 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt @@ -0,0 +1,6 @@ +package org.android.bbangzip.presentation.type + +sealed class BbangZipCardType{ + data object TODO : BbangZipCardType() + data object SUBJECT : BbangZipCardType() +} \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardType.kt deleted file mode 100644 index 02588f3..0000000 --- a/app/src/main/java/org/android/bbangzip/presentation/type/StudyCardType.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.android.bbangzip.presentation.type - -sealed class StudyCardType{ - data object TODO : StudyCardType() - data object SUBJECT : StudyCardType() -} \ No newline at end of file From 227d5f0737b9e64ae3e8b996afa81ccd0094cba4 Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 11:32:19 +0900 Subject: [PATCH 11/29] =?UTF-8?q?[feat]=20#7=20=EC=B9=9C=EA=B5=AC=20Card?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/BbangZipCardSlot.kt | 61 ++++++++++++- .../presentation/component/card/FriendCard.kt | 87 +++++++++++++++++++ .../component/card/model/BbangZipCardData.kt | 7 ++ .../presentation/type/BbangZipCardType.kt | 1 + 4 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt index 435d9d4..aa6197f 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt @@ -6,6 +6,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import org.android.bbangzip.R import org.android.bbangzip.presentation.component.card.model.BbangZipCardData import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.type.BbangZipCardType @@ -37,10 +38,19 @@ fun BbangZipCardSlot( modifier = modifier ) } + + BbangZipCardType.FRIEND -> { + val friendData = data as? BbangZipCardData.FriendCardData ?: throw IllegalArgumentException("Invalid data for FRIEND card") + FriendCard( + stateType = stateType, + data = friendData, + modifier = modifier + ) + } } } -@Preview(showBackground = true, showSystemUi = true) +@Preview(showBackground = true) @Composable fun StudyCardSlotPreview() { BBANGZIPTheme { @@ -156,4 +166,53 @@ fun StudyCardSlotPreview() { ) } } +} + +@Preview(showBackground = true, showSystemUi = true) +@Composable +fun FriendCardPreview() { + BBANGZIPTheme { + Column( + modifier = Modifier.padding(16.dp) + ) { + // FriendCard States + Column( + modifier = Modifier.padding(16.dp) + ) { + // FriendCard States + BbangZipCardSlot( + stateType = BbangZipCardStateType.DEFAULT, + studyType = BbangZipCardType.FRIEND, + data = BbangZipCardData.FriendCardData( + friendId = 1, + friendName = "강라리", + imageUrl = "R.drawable.ic_person" // 적절한 더미 이미지 리소스 사용 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + + BbangZipCardSlot( + stateType = BbangZipCardStateType.CHECKED, + studyType = BbangZipCardType.FRIEND, + data = BbangZipCardData.FriendCardData( + friendId = 2, + friendName = "최민지", + imageUrl = "R.drawable.ic_person" // 적절한 더미 이미지 리소스 사용 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + + BbangZipCardSlot( + stateType = BbangZipCardStateType.CHECKABLE, + studyType = BbangZipCardType.FRIEND, + data = BbangZipCardData.FriendCardData( + friendId = 3, + friendName = "이은지", + imageUrl = "R.drawable.ic_person" // 적절한 더미 이미지 리소스 사용 + ), + modifier = Modifier.padding(bottom = 8.dp) + ) + } + } + } } \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt new file mode 100644 index 0000000..09f3dcf --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -0,0 +1,87 @@ +package org.android.bbangzip.presentation.component.card + +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +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.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.unit.dp +import org.android.bbangzip.R +import org.android.bbangzip.presentation.component.card.model.BbangZipCardData +import org.android.bbangzip.presentation.type.BbangZipCardStateType +import org.android.bbangzip.presentation.util.modifier.applyShadows +import org.android.bbangzip.ui.theme.BbangZipTheme + +@Composable +fun FriendCard( + stateType: BbangZipCardStateType, + data: BbangZipCardData.FriendCardData, + modifier: Modifier = Modifier +) { + val style = stateType.getStyle() + + Box( + modifier = modifier + .applyShadows(shadowOptions = style.shadowOptions, shape = RoundedCornerShape(style.radius)) + .fillMaxWidth() + .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) + .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) + .padding(16.dp), + ) { + + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween + + ) { + Row( + verticalAlignment = Alignment.CenterVertically, + ) { + Image( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_user_one_default_24), + contentDescription = "프로필 이미지입니다.", + contentScale = ContentScale.FillBounds, + modifier = Modifier.size(48.dp) // TODO 밤에 코리와 함께 고칠게요 이거 나중가면 이미지가 48.dp로 내려오나? + ) + + Spacer(modifier = Modifier.width(16.dp)) + + Text( + text = data.friendName, + style = BbangZipTheme.typography.headline1Bold, + color = BbangZipTheme.colors.labelNormal_282119 + ) + + Spacer(modifier = Modifier.width(4.dp)) + + Text( + text = "사장님", + style = BbangZipTheme.typography.caption2Bold, + color = BbangZipTheme.colors.labelAlternative_282119_61 + ) + } + + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_kebab_default_24), + contentDescription = "더보기 버튼입니다.", + tint = BbangZipTheme.colors.labelAlternative_282119_61 + ) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt index 9dc5e75..365eb27 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt @@ -25,4 +25,11 @@ sealed interface BbangZipCardData { val pendingCount: Int, val inProgressCount: Int ) : BbangZipCardData, Parcelable + + @Parcelize + data class FriendCardData( + val friendId: Int, + val friendName: String, + val imageUrl: String + ) : BbangZipCardData, Parcelable } \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt index 66bac34..63f62af 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt @@ -3,4 +3,5 @@ package org.android.bbangzip.presentation.type sealed class BbangZipCardType{ data object TODO : BbangZipCardType() data object SUBJECT : BbangZipCardType() + data object FRIEND : BbangZipCardType() } \ No newline at end of file From 14ea2ab05d7576c216ce07f04ce4a3c8a601e092 Mon Sep 17 00:00:00 2001 From: beom84 Date: Sun, 12 Jan 2025 11:36:47 +0900 Subject: [PATCH 12/29] =?UTF-8?q?[feat]=20#7=20ktlint=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/BbangZipCardSlot.kt | 203 +++++++++-------- .../presentation/component/card/FriendCard.kt | 31 ++- .../component/card/SubjectCard.kt | 119 +++++----- .../presentation/component/card/ToDoCard.kt | 207 ++++++++++-------- .../component/card/model/BbangZipCardData.kt | 6 +- .../presentation/model/ShadowConfig.kt | 4 +- .../type/BbangZipCardStateType.kt | 206 ++++++++--------- .../presentation/type/BbangZipCardType.kt | 6 +- .../presentation/util/modifier/ModifierExt.kt | 13 +- 9 files changed, 414 insertions(+), 381 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt index aa6197f..abbae14 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt @@ -6,7 +6,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import org.android.bbangzip.R import org.android.bbangzip.presentation.component.card.model.BbangZipCardData import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.type.BbangZipCardType @@ -26,7 +25,7 @@ fun BbangZipCardSlot( ToDoCard( stateType = stateType, data = todoDate, - modifier = modifier + modifier = modifier, ) } @@ -35,7 +34,7 @@ fun BbangZipCardSlot( SubjectCard( stateType = stateType, data = subjectData, - modifier = modifier + modifier = modifier, ) } @@ -44,7 +43,7 @@ fun BbangZipCardSlot( FriendCard( stateType = stateType, data = friendData, - modifier = modifier + modifier = modifier, ) } } @@ -55,114 +54,121 @@ fun BbangZipCardSlot( fun StudyCardSlotPreview() { BBANGZIPTheme { Column( - modifier = Modifier.padding(16.dp) + modifier = Modifier.padding(16.dp), ) { // ToDoCard States BbangZipCardSlot( stateType = BbangZipCardStateType.DEFAULT, studyType = BbangZipCardType.TODO, - data = BbangZipCardData.TodoCardData( - pieceId = "1", - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - remainingDays = 1 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.TodoCardData( + pieceId = "1", + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + remainingDays = 1, + ), + modifier = Modifier.padding(bottom = 8.dp), ) BbangZipCardSlot( stateType = BbangZipCardStateType.CHECKED, studyType = BbangZipCardType.TODO, - data = BbangZipCardData.TodoCardData( - pieceId = "1", - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - remainingDays = 1 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.TodoCardData( + pieceId = "1", + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + remainingDays = 1, + ), + modifier = Modifier.padding(bottom = 8.dp), ) BbangZipCardSlot( stateType = BbangZipCardStateType.CHECKABLE, studyType = BbangZipCardType.TODO, - data = BbangZipCardData.TodoCardData( - pieceId = "1", - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - remainingDays = 1 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.TodoCardData( + pieceId = "1", + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + remainingDays = 1, + ), + modifier = Modifier.padding(bottom = 8.dp), ) BbangZipCardSlot( stateType = ToDoCardStateType.COMPLETE, studyType = BbangZipCardType.TODO, - data = BbangZipCardData.TodoCardData( - pieceId = "1", - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - remainingDays = 1 - ), - modifier = Modifier.padding(bottom = 16.dp) + data = + BbangZipCardData.TodoCardData( + pieceId = "1", + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + remainingDays = 1, + ), + modifier = Modifier.padding(bottom = 16.dp), ) // SubjectCard States BbangZipCardSlot( stateType = BbangZipCardStateType.DEFAULT, studyType = BbangZipCardType.SUBJECT, - data = BbangZipCardData.SubjectCardData( - subjectId = 1, - subjectName = "[경영] 경제통계학", - examName = "중간고사", - examRemainingDays = 1, - pendingCount = 0, - inProgressCount = 6 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.SubjectCardData( + subjectId = 1, + subjectName = "[경영] 경제통계학", + examName = "중간고사", + examRemainingDays = 1, + pendingCount = 0, + inProgressCount = 6, + ), + modifier = Modifier.padding(bottom = 8.dp), ) BbangZipCardSlot( stateType = BbangZipCardStateType.CHECKED, studyType = BbangZipCardType.SUBJECT, - data = BbangZipCardData.SubjectCardData( - subjectId = 1, - subjectName = "[경영] 경제통계학", - examName = "중간고사", - examRemainingDays = 1, - pendingCount = 0, - inProgressCount = 6 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.SubjectCardData( + subjectId = 1, + subjectName = "[경영] 경제통계학", + examName = "중간고사", + examRemainingDays = 1, + pendingCount = 0, + inProgressCount = 6, + ), + modifier = Modifier.padding(bottom = 8.dp), ) BbangZipCardSlot( stateType = BbangZipCardStateType.CHECKABLE, studyType = BbangZipCardType.SUBJECT, - data = BbangZipCardData.SubjectCardData( - subjectId = 1, - subjectName = "[경영] 경제통계학", - examName = "중간고사", - examRemainingDays = 1, - pendingCount = 0, - inProgressCount = 6 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.SubjectCardData( + subjectId = 1, + subjectName = "[경영] 경제통계학", + examName = "중간고사", + examRemainingDays = 1, + pendingCount = 0, + inProgressCount = 6, + ), + modifier = Modifier.padding(bottom = 8.dp), ) } } @@ -173,46 +179,49 @@ fun StudyCardSlotPreview() { fun FriendCardPreview() { BBANGZIPTheme { Column( - modifier = Modifier.padding(16.dp) + modifier = Modifier.padding(16.dp), ) { // FriendCard States Column( - modifier = Modifier.padding(16.dp) + modifier = Modifier.padding(16.dp), ) { // FriendCard States BbangZipCardSlot( stateType = BbangZipCardStateType.DEFAULT, studyType = BbangZipCardType.FRIEND, - data = BbangZipCardData.FriendCardData( - friendId = 1, - friendName = "강라리", - imageUrl = "R.drawable.ic_person" // 적절한 더미 이미지 리소스 사용 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.FriendCardData( + friendId = 1, + friendName = "강라리", + imageUrl = "R.drawable.ic_person", + ), + modifier = Modifier.padding(bottom = 8.dp), ) BbangZipCardSlot( stateType = BbangZipCardStateType.CHECKED, studyType = BbangZipCardType.FRIEND, - data = BbangZipCardData.FriendCardData( - friendId = 2, - friendName = "최민지", - imageUrl = "R.drawable.ic_person" // 적절한 더미 이미지 리소스 사용 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.FriendCardData( + friendId = 2, + friendName = "최민지", + imageUrl = "R.drawable.ic_person", + ), + modifier = Modifier.padding(bottom = 8.dp), ) BbangZipCardSlot( stateType = BbangZipCardStateType.CHECKABLE, studyType = BbangZipCardType.FRIEND, - data = BbangZipCardData.FriendCardData( - friendId = 3, - friendName = "이은지", - imageUrl = "R.drawable.ic_person" // 적절한 더미 이미지 리소스 사용 - ), - modifier = Modifier.padding(bottom = 8.dp) + data = + BbangZipCardData.FriendCardData( + friendId = 3, + friendName = "이은지", + imageUrl = "R.drawable.ic_person", + ), + modifier = Modifier.padding(bottom = 8.dp), ) } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index 09f3dcf..0669d23 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -31,24 +31,23 @@ import org.android.bbangzip.ui.theme.BbangZipTheme fun FriendCard( stateType: BbangZipCardStateType, data: BbangZipCardData.FriendCardData, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val style = stateType.getStyle() Box( - modifier = modifier - .applyShadows(shadowOptions = style.shadowOptions, shape = RoundedCornerShape(style.radius)) - .fillMaxWidth() - .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) - .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) - .padding(16.dp), + modifier = + modifier + .applyShadows(shadowOptions = style.shadowOptions, shape = RoundedCornerShape(style.radius)) + .fillMaxWidth() + .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) + .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) + .padding(16.dp), ) { - Row( modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween - + horizontalArrangement = Arrangement.SpaceBetween, ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -57,15 +56,15 @@ fun FriendCard( imageVector = ImageVector.vectorResource(id = R.drawable.ic_user_one_default_24), contentDescription = "프로필 이미지입니다.", contentScale = ContentScale.FillBounds, - modifier = Modifier.size(48.dp) // TODO 밤에 코리와 함께 고칠게요 이거 나중가면 이미지가 48.dp로 내려오나? - ) + modifier = Modifier.size(48.dp), + ) // TODO 밤에 코리와 함께 고칠게요 이거 나중가면 이미지가 48.dp로 내려오나? Spacer(modifier = Modifier.width(16.dp)) Text( text = data.friendName, style = BbangZipTheme.typography.headline1Bold, - color = BbangZipTheme.colors.labelNormal_282119 + color = BbangZipTheme.colors.labelNormal_282119, ) Spacer(modifier = Modifier.width(4.dp)) @@ -73,15 +72,15 @@ fun FriendCard( Text( text = "사장님", style = BbangZipTheme.typography.caption2Bold, - color = BbangZipTheme.colors.labelAlternative_282119_61 + color = BbangZipTheme.colors.labelAlternative_282119_61, ) } Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_kebab_default_24), contentDescription = "더보기 버튼입니다.", - tint = BbangZipTheme.colors.labelAlternative_282119_61 + tint = BbangZipTheme.colors.labelAlternative_282119_61, ) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index eeecec5..e319a7b 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -30,33 +30,33 @@ import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme import org.android.bbangzip.ui.theme.BbangZipTheme - @Composable fun SubjectCard( stateType: BbangZipCardStateType, data: BbangZipCardData.SubjectCardData, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val style = stateType.getStyle() Box( - modifier = modifier - .applyShadows(shadowOptions = style.shadowOptions, shape = RoundedCornerShape(style.radius)) - .height(190.dp) // TODO 기기대응 어케할지 물어보기 - .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) - .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + modifier = + modifier + .applyShadows(shadowOptions = style.shadowOptions, shape = RoundedCornerShape(style.radius)) + .height(190.dp) // TODO 기기대응 어케할지 물어보기 + .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) + .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, ) { SubjectInfo( - data = data + data = data, ) Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_chevronright_thick_small_24), tint = BbangZipTheme.colors.labelAssistive_282119_28, - contentDescription = "오늘 할 일로 향하는 버튼입니다." + contentDescription = "오늘 할 일로 향하는 버튼입니다.", ) } } @@ -65,7 +65,7 @@ fun SubjectCard( @Composable fun SubjectInfo( data: BbangZipCardData.SubjectCardData, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { Column( modifier = modifier.fillMaxHeight(), @@ -90,32 +90,32 @@ fun SubjectInfo( Box( contentAlignment = Alignment.Center, - modifier = Modifier - .background(color = BbangZipTheme.colors.statusPositive_3D3730, shape = RoundedCornerShape(11.dp)) - .padding(horizontal = 12.dp, vertical = 2.dp) + modifier = + Modifier + .background(color = BbangZipTheme.colors.statusPositive_3D3730, shape = RoundedCornerShape(11.dp)) + .padding(horizontal = 12.dp, vertical = 2.dp), ) { Text( text = "D-24", style = BbangZipTheme.typography.caption1Medium, - color = BbangZipTheme.colors.staticWhite_FFFFFF + color = BbangZipTheme.colors.staticWhite_FFFFFF, ) - }//TODO 칩구현 + } // TODO 칩구현 } Column { StudyStateCountCircle( backgroundColor = BbangZipTheme.colors.statusDestructive_FF8345, count = data.pendingCount, - text = "밀린 공부" + text = "밀린 공부", ) Spacer(modifier = Modifier.height(4.dp)) StudyStateCountCircle( backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, count = data.inProgressCount, - text = "진행 중인 공부" + text = "진행 중인 공부", ) } - } } @@ -124,19 +124,20 @@ fun StudyStateCountCircle( backgroundColor: Color, count: Int, text: String, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { Row(verticalAlignment = Alignment.CenterVertically) { Box( contentAlignment = Alignment.Center, - modifier = modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp) + modifier = + modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), style = BbangZipTheme.typography.caption2Bold, - color = BbangZipTheme.colors.staticWhite_FFFFFF + color = BbangZipTheme.colors.staticWhite_FFFFFF, ) } @@ -145,7 +146,7 @@ fun StudyStateCountCircle( Text( text = text, style = BbangZipTheme.typography.caption1Bold, - color = BbangZipTheme.colors.labelAssistive_282119_28 + color = BbangZipTheme.colors.labelAssistive_282119_28, ) } } @@ -156,44 +157,44 @@ fun SubjectCardPreview() { BBANGZIPTheme { Column { SubjectCard( - stateType = BbangZipCardStateType.DEFAULT, // 필요한 상태 타입 설정 - data = BbangZipCardData.SubjectCardData( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, // 밀린 공부 개수 - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1 // 진행 중인 공부 개수 - ), - modifier = Modifier - .padding(16.dp) // 카드가 화면에 잘 보이도록 여백 추가 + stateType = BbangZipCardStateType.DEFAULT, + data = + BbangZipCardData.SubjectCardData( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), + modifier = Modifier.padding(16.dp), ) SubjectCard( - stateType = BbangZipCardStateType.CHECKED, // 필요한 상태 타입 설정 - data = BbangZipCardData.SubjectCardData( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, // 밀린 공부 개수 - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1 // 진행 중인 공부 개수 - ), - modifier = Modifier - .padding(16.dp) // 카드가 화면에 잘 보이도록 여백 추가 + stateType = BbangZipCardStateType.CHECKED, + data = + BbangZipCardData.SubjectCardData( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), + modifier = Modifier.padding(16.dp), ) SubjectCard( - stateType = BbangZipCardStateType.CHECKABLE, // 필요한 상태 타입 설정 - data = BbangZipCardData.SubjectCardData( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, // 밀린 공부 개수 - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1 // 진행 중인 공부 개수 - ), - modifier = Modifier - .padding(16.dp) // 카드가 화면에 잘 보이도록 여백 추가 + stateType = BbangZipCardStateType.CHECKABLE, + data = + BbangZipCardData.SubjectCardData( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), + modifier = Modifier.padding(16.dp), ) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index b23d819..2dbdcd5 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -34,65 +34,69 @@ import org.android.bbangzip.ui.theme.BbangZipTheme fun ToDoCard( stateType: BbangZipCardStateType, data: BbangZipCardData.TodoCardData, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val style = stateType.getStyle() val isComplete = stateType == ToDoCardStateType.COMPLETE - val applicableShadows = if (isComplete) { - style.shadowOptions.take(1) - } else { - style.shadowOptions - } - val background = when (stateType) { - BbangZipCardStateType.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 - BbangZipCardStateType.CHECKED -> BbangZipTheme.colors.fillStrong_68645E_16 - BbangZipCardStateType.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 - ToDoCardStateType.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 - } + val applicableShadows = + if (isComplete) { + style.shadowOptions.take(1) + } else { + style.shadowOptions + } + val background = + when (stateType) { + BbangZipCardStateType.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 + BbangZipCardStateType.CHECKED -> BbangZipTheme.colors.fillStrong_68645E_16 + BbangZipCardStateType.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 + ToDoCardStateType.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 + } Box( - modifier = modifier - .applyShadows(shadowOptions = applicableShadows, shape = RoundedCornerShape(style.radius)) - .fillMaxWidth() - .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) - .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) - .padding(horizontal = 16.dp, vertical = 10.dp), + modifier = + modifier + .applyShadows(shadowOptions = applicableShadows, shape = RoundedCornerShape(style.radius)) + .fillMaxWidth() + .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) + .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) + .padding(horizontal = 16.dp, vertical = 10.dp), ) { Row( - modifier = Modifier - .fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween + modifier = + Modifier + .fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween, ) { ToDoInfo(data = data) CheckSpace( backgroundColor = background, - checkIcon = if (isComplete) { - { - Icon( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), - contentDescription = "체크 표시 아이콘입니다.", - tint = BbangZipTheme.colors.staticWhite_FFFFFF - ) - } - } else { - null - } + checkIcon = + if (isComplete) { + { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), + contentDescription = "체크 표시 아이콘입니다.", + tint = BbangZipTheme.colors.staticWhite_FFFFFF, + ) + } + } else { + null + }, ) } } } - @Composable fun ToDoInfo( data: BbangZipCardData.TodoCardData, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { Column(modifier = modifier) { - Column (modifier =Modifier.padding(start = 4.dp)){ + Column(modifier = Modifier.padding(start = 4.dp)) { Text( text = "${data.subjectName} / ${data.examName}", style = BbangZipTheme.typography.caption2Medium, - color = BbangZipTheme.colors.labelAssistive_282119_28 + color = BbangZipTheme.colors.labelAssistive_282119_28, ) Spacer(modifier = Modifier.height(2.dp)) @@ -100,7 +104,7 @@ fun ToDoInfo( Text( text = data.studyContents, style = BbangZipTheme.typography.caption1Medium, - color = BbangZipTheme.colors.labelAlternative_282119_61 + color = BbangZipTheme.colors.labelAlternative_282119_61, ) Spacer(modifier = Modifier.height(4.dp)) @@ -108,7 +112,7 @@ fun ToDoInfo( Text( text = "${data.startPage}p - ${data.finishPage}p", style = BbangZipTheme.typography.label1Bold, - color = BbangZipTheme.colors.labelNormal_282119 + color = BbangZipTheme.colors.labelNormal_282119, ) } Spacer(modifier = Modifier.height(6.dp)) @@ -116,19 +120,20 @@ fun ToDoInfo( Row(verticalAlignment = Alignment.CenterVertically) { Box( contentAlignment = Alignment.Center, - modifier = Modifier - .background(color = BbangZipTheme.colors.statusDestructive_FF8345, shape = RoundedCornerShape(11.dp)) - .padding(horizontal = 12.dp, vertical = 2.dp) + modifier = + Modifier + .background(color = BbangZipTheme.colors.statusDestructive_FF8345, shape = RoundedCornerShape(11.dp)) + .padding(horizontal = 12.dp, vertical = 2.dp), ) { Text(text = "D+5", style = BbangZipTheme.typography.caption1Medium, color = BbangZipTheme.colors.staticWhite_FFFFFF) - }// TODO 칩 구현 + } // TODO 칩 구현 Spacer(modifier = Modifier.width(8.dp)) Text( text = "${data.deadline}까지", style = BbangZipTheme.typography.caption1Bold, - color = BbangZipTheme.colors.labelAlternative_282119_61 + color = BbangZipTheme.colors.labelAlternative_282119_61, ) } } @@ -142,11 +147,12 @@ fun CheckSpace( ) { Box( contentAlignment = Alignment.Center, - modifier = modifier - .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) - .height(32.dp) - .width(32.dp) - //TODO 여기 어떤식으로 기기대응하는지 물어보기 + modifier = + modifier + .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) + .height(32.dp) + .width(32.dp), + // TODO 여기 어떤식으로 기기대응하는지 물어보기 ) { checkIcon?.invoke() } @@ -159,65 +165,72 @@ fun ToDoCardPreview() { Column { ToDoCard( stateType = BbangZipCardStateType.DEFAULT, - data = BbangZipCardData.TodoCardData( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1 - ), - modifier = Modifier - .padding(16.dp) + data = + BbangZipCardData.TodoCardData( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), + modifier = + Modifier + .padding(16.dp), ) ToDoCard( stateType = BbangZipCardStateType.CHECKED, - data = BbangZipCardData.TodoCardData( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1 - ), - modifier = Modifier - .padding(16.dp) + data = + BbangZipCardData.TodoCardData( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), + modifier = + Modifier + .padding(16.dp), ) ToDoCard( stateType = BbangZipCardStateType.CHECKABLE, - data = BbangZipCardData.TodoCardData( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1 - ), - modifier = Modifier - .padding(16.dp) + data = + BbangZipCardData.TodoCardData( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), + modifier = + Modifier + .padding(16.dp), ) ToDoCard( stateType = ToDoCardStateType.COMPLETE, - data = BbangZipCardData.TodoCardData( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1 - ), - modifier = Modifier - .padding(16.dp) + data = + BbangZipCardData.TodoCardData( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), + modifier = + Modifier + .padding(16.dp), ) } } } - diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt index 365eb27..4654661 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt @@ -23,13 +23,13 @@ sealed interface BbangZipCardData { val examName: String, val examRemainingDays: Int, val pendingCount: Int, - val inProgressCount: Int + val inProgressCount: Int, ) : BbangZipCardData, Parcelable @Parcelize data class FriendCardData( val friendId: Int, val friendName: String, - val imageUrl: String + val imageUrl: String, ) : BbangZipCardData, Parcelable -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt b/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt index 8bea562..e1f6750 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt @@ -8,5 +8,5 @@ data class ShadowConfig( val blur: Dp, val offsetX: Dp, val offsetY: Dp, - val spread: Dp -) \ No newline at end of file + val spread: Dp, +) diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt index d3dff4c..daef4f8 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt @@ -12,125 +12,133 @@ data class StudyCardStyle( val borderColor: Color, val borderWidth: Dp, val radius: Dp, - val shadowOptions: List + val shadowOptions: List, ) sealed interface BbangZipCardStateType { @Composable fun getStyle(): StudyCardStyle data object DEFAULT : BbangZipCardStateType { - @Composable override fun getStyle() = StudyCardStyle( - background = BbangZipTheme.colors.backgroundNormal_FFFFFF, - borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, - borderWidth = 1.dp, - radius = 24.dp, - shadowOptions = listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 2.dp, - spread = 0.dp - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 1.dp, - spread = 0.dp - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), - blur = 1.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp - ) + @Composable override fun getStyle() = + StudyCardStyle( + background = BbangZipTheme.colors.backgroundNormal_FFFFFF, + borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, + borderWidth = 1.dp, + radius = 24.dp, + shadowOptions = + listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 2.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 1.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), + blur = 1.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp, + ), + ), ) - ) } data object CHECKABLE : BbangZipCardStateType { - @Composable override fun getStyle() = StudyCardStyle( - background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, - borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, - borderWidth = 1.dp, - radius = 24.dp, - shadowOptions = listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 12.dp, - offsetX = 0.dp, - offsetY = 6.dp, - spread = 0.dp - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 4.dp, - spread = 0.dp - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp - ) + @Composable override fun getStyle() = + StudyCardStyle( + background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, + borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, + borderWidth = 1.dp, + radius = 24.dp, + shadowOptions = + listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 12.dp, + offsetX = 0.dp, + offsetY = 6.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp, + ), + ), ) - ) } data object CHECKED : BbangZipCardStateType { - @Composable override fun getStyle() = StudyCardStyle( - background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, - borderColor = BbangZipTheme.colors.lineStrong_68645E_52, - borderWidth = 3.dp, - radius = 24.dp, - shadowOptions = listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 12.dp, - offsetX = 0.dp, - offsetY = 6.dp, - spread = 0.dp - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 4.dp, - spread = 0.dp - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp - ) + @Composable override fun getStyle() = + StudyCardStyle( + background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, + borderColor = BbangZipTheme.colors.lineStrong_68645E_52, + borderWidth = 3.dp, + radius = 24.dp, + shadowOptions = + listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 12.dp, + offsetX = 0.dp, + offsetY = 6.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp, + ), + ), ) - ) } } sealed interface ToDoCardStateType : BbangZipCardStateType { data object COMPLETE : ToDoCardStateType { - @Composable override fun getStyle() = StudyCardStyle( - background = BbangZipTheme.colors.backgroundNormal_FFFFFF, - borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, - borderWidth = 1.dp, - radius = 24.dp, - shadowOptions = listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity28), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 4.dp, - spread = 0.dp - ) + @Composable override fun getStyle() = + StudyCardStyle( + background = BbangZipTheme.colors.backgroundNormal_FFFFFF, + borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, + borderWidth = 1.dp, + radius = 24.dp, + shadowOptions = + listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity28), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp, + ), + ), ) - ) } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt index 63f62af..5694c20 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt @@ -1,7 +1,9 @@ package org.android.bbangzip.presentation.type -sealed class BbangZipCardType{ +sealed class BbangZipCardType { data object TODO : BbangZipCardType() + data object SUBJECT : BbangZipCardType() + data object FRIEND : BbangZipCardType() -} \ No newline at end of file +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt index 8eabc45..7e1b795 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt @@ -41,14 +41,15 @@ fun Modifier.dropShadow( blur: Dp = 4.dp, offsetY: Dp = 4.dp, offsetX: Dp = 0.dp, - spread: Dp = 0.dp + spread: Dp = 0.dp, ) = this.drawBehind { val shadowSize = Size(size.width + spread.toPx(), size.height + spread.toPx()) val shadowOutline = shape.createOutline(shadowSize, layoutDirection, this) - val paint = Paint().apply { - this.color = color - } + val paint = + Paint().apply { + this.color = color + } if (blur.toPx() > 0) { paint.asFrameworkPaint().apply { @@ -67,9 +68,9 @@ fun Modifier.dropShadow( @Composable fun Modifier.applyShadows( shadowOptions: List, - shape: Shape + shape: Shape, ): Modifier { return shadowOptions.fold(this) { acc, shadowConfig -> acc.dropShadow(shape = shape, color = shadowConfig.color, blur = shadowConfig.blur, offsetY = shadowConfig.offsetY, offsetX = shadowConfig.offsetX, spread = shadowConfig.spread) } -} \ No newline at end of file +} From 4bb36d82295f443a3bf7d1740e28cff37ec90913 Mon Sep 17 00:00:00 2001 From: beom84 Date: Mon, 13 Jan 2025 03:26:03 +0900 Subject: [PATCH 13/29] =?UTF-8?q?[feat]=20#13=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81=20,=20Model=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/BbangZipCardSlot.kt | 227 ------------------ .../presentation/component/card/FriendCard.kt | 4 +- .../component/card/SubjectCard.kt | 135 +++++------ .../presentation/component/card/ToDoCard.kt | 191 ++++++++------- .../component/card/model/BbangZipCardData.kt | 35 --- .../model/card/FriendCardModel.kt | 11 + .../model/card/SubjectCardModel.kt | 14 ++ .../presentation/model/card/ToDoCardModel.kt | 16 ++ .../type/BbangZipCardStateType.kt | 162 ++++++------- .../presentation/type/BbangZipCardType.kt | 9 - .../presentation/util/modifier/ModifierExt.kt | 2 +- .../theme}/model/ShadowConfig.kt | 2 +- 12 files changed, 290 insertions(+), 518 deletions(-) delete mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt delete mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt create mode 100644 app/src/main/java/org/android/bbangzip/presentation/model/card/FriendCardModel.kt create mode 100644 app/src/main/java/org/android/bbangzip/presentation/model/card/SubjectCardModel.kt create mode 100644 app/src/main/java/org/android/bbangzip/presentation/model/card/ToDoCardModel.kt delete mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt rename app/src/main/java/org/android/bbangzip/{presentation => ui/theme}/model/ShadowConfig.kt (81%) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt deleted file mode 100644 index abbae14..0000000 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardSlot.kt +++ /dev/null @@ -1,227 +0,0 @@ -package org.android.bbangzip.presentation.component.card - -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.padding -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.android.bbangzip.presentation.component.card.model.BbangZipCardData -import org.android.bbangzip.presentation.type.BbangZipCardStateType -import org.android.bbangzip.presentation.type.BbangZipCardType -import org.android.bbangzip.presentation.type.ToDoCardStateType -import org.android.bbangzip.ui.theme.BBANGZIPTheme - -@Composable -fun BbangZipCardSlot( - stateType: BbangZipCardStateType, - studyType: BbangZipCardType, - data: BbangZipCardData, - modifier: Modifier = Modifier, -) { - when (studyType) { - BbangZipCardType.TODO -> { - val todoDate = data as? BbangZipCardData.TodoCardData ?: throw IllegalArgumentException("Invalid data for TODO card") - ToDoCard( - stateType = stateType, - data = todoDate, - modifier = modifier, - ) - } - - BbangZipCardType.SUBJECT -> { - val subjectData = data as? BbangZipCardData.SubjectCardData ?: throw IllegalArgumentException("Invalid data for SUBJECT card") - SubjectCard( - stateType = stateType, - data = subjectData, - modifier = modifier, - ) - } - - BbangZipCardType.FRIEND -> { - val friendData = data as? BbangZipCardData.FriendCardData ?: throw IllegalArgumentException("Invalid data for FRIEND card") - FriendCard( - stateType = stateType, - data = friendData, - modifier = modifier, - ) - } - } -} - -@Preview(showBackground = true) -@Composable -fun StudyCardSlotPreview() { - BBANGZIPTheme { - Column( - modifier = Modifier.padding(16.dp), - ) { - // ToDoCard States - BbangZipCardSlot( - stateType = BbangZipCardStateType.DEFAULT, - studyType = BbangZipCardType.TODO, - data = - BbangZipCardData.TodoCardData( - pieceId = "1", - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - remainingDays = 1, - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - - BbangZipCardSlot( - stateType = BbangZipCardStateType.CHECKED, - studyType = BbangZipCardType.TODO, - data = - BbangZipCardData.TodoCardData( - pieceId = "1", - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - remainingDays = 1, - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - - BbangZipCardSlot( - stateType = BbangZipCardStateType.CHECKABLE, - studyType = BbangZipCardType.TODO, - data = - BbangZipCardData.TodoCardData( - pieceId = "1", - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - remainingDays = 1, - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - - BbangZipCardSlot( - stateType = ToDoCardStateType.COMPLETE, - studyType = BbangZipCardType.TODO, - data = - BbangZipCardData.TodoCardData( - pieceId = "1", - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - remainingDays = 1, - ), - modifier = Modifier.padding(bottom = 16.dp), - ) - - // SubjectCard States - BbangZipCardSlot( - stateType = BbangZipCardStateType.DEFAULT, - studyType = BbangZipCardType.SUBJECT, - data = - BbangZipCardData.SubjectCardData( - subjectId = 1, - subjectName = "[경영] 경제통계학", - examName = "중간고사", - examRemainingDays = 1, - pendingCount = 0, - inProgressCount = 6, - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - - BbangZipCardSlot( - stateType = BbangZipCardStateType.CHECKED, - studyType = BbangZipCardType.SUBJECT, - data = - BbangZipCardData.SubjectCardData( - subjectId = 1, - subjectName = "[경영] 경제통계학", - examName = "중간고사", - examRemainingDays = 1, - pendingCount = 0, - inProgressCount = 6, - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - - BbangZipCardSlot( - stateType = BbangZipCardStateType.CHECKABLE, - studyType = BbangZipCardType.SUBJECT, - data = - BbangZipCardData.SubjectCardData( - subjectId = 1, - subjectName = "[경영] 경제통계학", - examName = "중간고사", - examRemainingDays = 1, - pendingCount = 0, - inProgressCount = 6, - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - } - } -} - -@Preview(showBackground = true, showSystemUi = true) -@Composable -fun FriendCardPreview() { - BBANGZIPTheme { - Column( - modifier = Modifier.padding(16.dp), - ) { - // FriendCard States - Column( - modifier = Modifier.padding(16.dp), - ) { - // FriendCard States - BbangZipCardSlot( - stateType = BbangZipCardStateType.DEFAULT, - studyType = BbangZipCardType.FRIEND, - data = - BbangZipCardData.FriendCardData( - friendId = 1, - friendName = "강라리", - imageUrl = "R.drawable.ic_person", - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - - BbangZipCardSlot( - stateType = BbangZipCardStateType.CHECKED, - studyType = BbangZipCardType.FRIEND, - data = - BbangZipCardData.FriendCardData( - friendId = 2, - friendName = "최민지", - imageUrl = "R.drawable.ic_person", - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - - BbangZipCardSlot( - stateType = BbangZipCardStateType.CHECKABLE, - studyType = BbangZipCardType.FRIEND, - data = - BbangZipCardData.FriendCardData( - friendId = 3, - friendName = "이은지", - imageUrl = "R.drawable.ic_person", - ), - modifier = Modifier.padding(bottom = 8.dp), - ) - } - } - } -} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index 0669d23..5ca3290 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -22,7 +22,7 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp import org.android.bbangzip.R -import org.android.bbangzip.presentation.component.card.model.BbangZipCardData +import org.android.bbangzip.presentation.model.card.FriendCardModel import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BbangZipTheme @@ -30,7 +30,7 @@ import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun FriendCard( stateType: BbangZipCardStateType, - data: BbangZipCardData.FriendCardData, + data: FriendCardModel, modifier: Modifier = Modifier, ) { val style = stateType.getStyle() diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index e319a7b..0bfdf3a 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -24,7 +24,8 @@ import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.android.bbangzip.R -import org.android.bbangzip.presentation.component.card.model.BbangZipCardData +import org.android.bbangzip.presentation.component.chip.BbangZipChip +import org.android.bbangzip.presentation.model.card.SubjectCardModel import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme @@ -33,19 +34,25 @@ import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun SubjectCard( stateType: BbangZipCardStateType, - data: BbangZipCardData.SubjectCardData, + data: SubjectCardModel, modifier: Modifier = Modifier, ) { val style = stateType.getStyle() Box( modifier = - modifier - .applyShadows(shadowOptions = style.shadowOptions, shape = RoundedCornerShape(style.radius)) - .height(190.dp) // TODO 기기대응 어케할지 물어보기 - .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) - .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + modifier + .applyShadows( + shadowOptions = style.shadowOptions, + shape = RoundedCornerShape(style.radius) + ) + .border( + width = style.borderWidth, + color = style.borderColor, + shape = RoundedCornerShape(size = style.radius) + ) + .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -64,53 +71,47 @@ fun SubjectCard( @Composable fun SubjectInfo( - data: BbangZipCardData.SubjectCardData, + data: SubjectCardModel, modifier: Modifier = Modifier, ) { Column( - modifier = modifier.fillMaxHeight(), + modifier = modifier, verticalArrangement = Arrangement.SpaceBetween, ) { - Column { - Text( - text = data.subjectName, - style = BbangZipTheme.typography.body1Bold, - color = BbangZipTheme.colors.labelNormal_282119, - ) - Spacer(modifier = Modifier.height(4.dp)) + Text( + text = data.subjectName, + style = BbangZipTheme.typography.body1Bold, + color = BbangZipTheme.colors.labelNormal_282119, + ) - Text( - text = data.examName, - style = BbangZipTheme.typography.label2Bold, - color = BbangZipTheme.colors.labelNeutral_282119_88, - ) + Spacer(modifier = Modifier.height(4.dp)) - Spacer(modifier = Modifier.height(4.dp)) + Text( + text = data.examName, + style = BbangZipTheme.typography.label2Bold, + color = BbangZipTheme.colors.labelNeutral_282119_88, + ) - Box( - contentAlignment = Alignment.Center, - modifier = - Modifier - .background(color = BbangZipTheme.colors.statusPositive_3D3730, shape = RoundedCornerShape(11.dp)) - .padding(horizontal = 12.dp, vertical = 2.dp), - ) { - Text( - text = "D-24", - style = BbangZipTheme.typography.caption1Medium, - color = BbangZipTheme.colors.staticWhite_FFFFFF, - ) - } // TODO 칩구현 - } + Spacer(modifier = Modifier.height(4.dp)) + + + BbangZipChip( + text = "D-${data.pendingCount}", + backgroundColor = BbangZipTheme.colors.statusPositive_3D3730 + ) + + Spacer(modifier = Modifier.height(44.dp)) Column { - StudyStateCountCircle( + BbangZipPushIcon( backgroundColor = BbangZipTheme.colors.statusDestructive_FF8345, count = data.pendingCount, text = "밀린 공부", ) + Spacer(modifier = Modifier.height(4.dp)) - StudyStateCountCircle( + BbangZipPushIcon( backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, count = data.inProgressCount, text = "진행 중인 공부", @@ -120,7 +121,7 @@ fun SubjectInfo( } @Composable -fun StudyStateCountCircle( +fun BbangZipPushIcon( backgroundColor: Color, count: Int, text: String, @@ -130,9 +131,9 @@ fun StudyStateCountCircle( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp), + modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), @@ -159,40 +160,40 @@ fun SubjectCardPreview() { SubjectCard( stateType = BbangZipCardStateType.DEFAULT, data = - BbangZipCardData.SubjectCardData( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( stateType = BbangZipCardStateType.CHECKED, data = - BbangZipCardData.SubjectCardData( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( stateType = BbangZipCardStateType.CHECKABLE, data = - BbangZipCardData.SubjectCardData( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 2dbdcd5..e555641 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -23,7 +23,8 @@ import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.android.bbangzip.R -import org.android.bbangzip.presentation.component.card.model.BbangZipCardData +import org.android.bbangzip.presentation.component.chip.BbangZipChip +import org.android.bbangzip.presentation.model.card.ToDoCardModel import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.type.ToDoCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows @@ -33,54 +34,54 @@ import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun ToDoCard( stateType: BbangZipCardStateType, - data: BbangZipCardData.TodoCardData, + data: ToDoCardModel, modifier: Modifier = Modifier, ) { val style = stateType.getStyle() - val isComplete = stateType == ToDoCardStateType.COMPLETE - val applicableShadows = - if (isComplete) { - style.shadowOptions.take(1) - } else { - style.shadowOptions - } - val background = + + val checkBoxBackgroundColor = when (stateType) { BbangZipCardStateType.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 - BbangZipCardStateType.CHECKED -> BbangZipTheme.colors.fillStrong_68645E_16 + BbangZipCardStateType.CHECKED -> BbangZipTheme.colors.labelAlternative_282119_61 BbangZipCardStateType.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 ToDoCardStateType.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 } Box( modifier = - modifier - .applyShadows(shadowOptions = applicableShadows, shape = RoundedCornerShape(style.radius)) - .fillMaxWidth() - .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) - .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) - .padding(horizontal = 16.dp, vertical = 10.dp), + modifier + .applyShadows( + shadowOptions = style.shadowOptions, + shape = RoundedCornerShape(style.radius) + ) + .fillMaxWidth() + .border( + width = style.borderWidth, + color = style.borderColor, + shape = RoundedCornerShape(size = style.radius) + ) + .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) + .padding(horizontal = 16.dp, vertical = 10.dp), ) { Row( modifier = - Modifier - .fillMaxWidth(), + Modifier + .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, ) { ToDoInfo(data = data) + CheckSpace( - backgroundColor = background, + backgroundColor = checkBoxBackgroundColor, checkIcon = - if (isComplete) { - { - Icon( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), - contentDescription = "체크 표시 아이콘입니다.", - tint = BbangZipTheme.colors.staticWhite_FFFFFF, - ) - } - } else { - null - }, + if (stateType == ToDoCardStateType.COMPLETE || stateType == BbangZipCardStateType.CHECKED) { + { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), + contentDescription = "체크 표시 아이콘입니다.", + tint = BbangZipTheme.colors.staticWhite_FFFFFF, + ) + } + } else null, ) } } @@ -88,9 +89,16 @@ fun ToDoCard( @Composable fun ToDoInfo( - data: BbangZipCardData.TodoCardData, + data: ToDoCardModel, modifier: Modifier = Modifier, ) { + val count = if (data.remainingDays >= 0) "D+" else "D-" + val backgroundColor = if (data.remainingDays >= 0) { + BbangZipTheme.colors.labelAlternative_282119_61 + } else { + BbangZipTheme.colors.statusDestructive_FF8345 + } + Column(modifier = modifier) { Column(modifier = Modifier.padding(start = 4.dp)) { Text( @@ -115,18 +123,14 @@ fun ToDoInfo( color = BbangZipTheme.colors.labelNormal_282119, ) } + Spacer(modifier = Modifier.height(6.dp)) Row(verticalAlignment = Alignment.CenterVertically) { - Box( - contentAlignment = Alignment.Center, - modifier = - Modifier - .background(color = BbangZipTheme.colors.statusDestructive_FF8345, shape = RoundedCornerShape(11.dp)) - .padding(horizontal = 12.dp, vertical = 2.dp), - ) { - Text(text = "D+5", style = BbangZipTheme.typography.caption1Medium, color = BbangZipTheme.colors.staticWhite_FFFFFF) - } // TODO 칩 구현 + BbangZipChip( + text = count + data.remainingDays, + backgroundColor = backgroundColor + ) Spacer(modifier = Modifier.width(8.dp)) @@ -139,6 +143,7 @@ fun ToDoInfo( } } + @Composable fun CheckSpace( modifier: Modifier = Modifier, @@ -148,10 +153,10 @@ fun CheckSpace( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) - .height(32.dp) - .width(32.dp), + modifier + .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) + .height(32.dp) + .width(32.dp), // TODO 여기 어떤식으로 기기대응하는지 물어보기 ) { checkIcon?.invoke() @@ -166,70 +171,70 @@ fun ToDoCardPreview() { ToDoCard( stateType = BbangZipCardStateType.DEFAULT, data = - BbangZipCardData.TodoCardData( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( stateType = BbangZipCardStateType.CHECKED, data = - BbangZipCardData.TodoCardData( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( stateType = BbangZipCardStateType.CHECKABLE, data = - BbangZipCardData.TodoCardData( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( stateType = ToDoCardStateType.COMPLETE, data = - BbangZipCardData.TodoCardData( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt deleted file mode 100644 index 4654661..0000000 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/model/BbangZipCardData.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.android.bbangzip.presentation.component.card.model - -import android.os.Parcelable -import kotlinx.parcelize.Parcelize - -sealed interface BbangZipCardData { - @Parcelize - data class TodoCardData( - val pieceId: String, - val subjectName: String, - val examName: String, - val studyContents: String, - val startPage: Int, - val finishPage: Int, - val deadline: String, - val remainingDays: Int, - ) : BbangZipCardData, Parcelable - - @Parcelize - data class SubjectCardData( - val subjectId: Int, - val subjectName: String, - val examName: String, - val examRemainingDays: Int, - val pendingCount: Int, - val inProgressCount: Int, - ) : BbangZipCardData, Parcelable - - @Parcelize - data class FriendCardData( - val friendId: Int, - val friendName: String, - val imageUrl: String, - ) : BbangZipCardData, Parcelable -} diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/card/FriendCardModel.kt b/app/src/main/java/org/android/bbangzip/presentation/model/card/FriendCardModel.kt new file mode 100644 index 0000000..cb67a36 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/model/card/FriendCardModel.kt @@ -0,0 +1,11 @@ +package org.android.bbangzip.presentation.model.card + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class FriendCardModel( + val friendId: Int, + val friendName: String, + val imageUrl: String, +) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/card/SubjectCardModel.kt b/app/src/main/java/org/android/bbangzip/presentation/model/card/SubjectCardModel.kt new file mode 100644 index 0000000..30badde --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/model/card/SubjectCardModel.kt @@ -0,0 +1,14 @@ +package org.android.bbangzip.presentation.model.card + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class SubjectCardModel( + val subjectId: Int, + val subjectName: String, + val examName: String, + val examRemainingDays: Int, + val pendingCount: Int, + val inProgressCount: Int, +) : Parcelable diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/card/ToDoCardModel.kt b/app/src/main/java/org/android/bbangzip/presentation/model/card/ToDoCardModel.kt new file mode 100644 index 0000000..fe8a29f --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/model/card/ToDoCardModel.kt @@ -0,0 +1,16 @@ +package org.android.bbangzip.presentation.model.card + +import android.os.Parcelable +import kotlinx.parcelize.Parcelize + +@Parcelize +data class ToDoCardModel( + val pieceId: String, + val subjectName: String, + val examName: String, + val studyContents: String, + val startPage: Int, + val finishPage: Int, + val deadline: String, + val remainingDays: Int, +) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt index daef4f8..187ee1d 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt @@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import org.android.bbangzip.presentation.model.ShadowConfig +import org.android.bbangzip.ui.theme.model.ShadowConfig import org.android.bbangzip.ui.theme.BbangZipTheme data class StudyCardStyle( @@ -12,133 +12,129 @@ data class StudyCardStyle( val borderColor: Color, val borderWidth: Dp, val radius: Dp, - val shadowOptions: List, + val shadowOptions: List = listOf(), ) sealed interface BbangZipCardStateType { - @Composable fun getStyle(): StudyCardStyle + @Composable + fun getStyle(): StudyCardStyle data object DEFAULT : BbangZipCardStateType { - @Composable override fun getStyle() = + @Composable + override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundNormal_FFFFFF, borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, borderWidth = 1.dp, radius = 24.dp, shadowOptions = - listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 2.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 1.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), - blur = 1.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp, - ), + listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 2.dp, + spread = 0.dp, ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 1.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), + blur = 1.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp, + ), + ), ) } data object CHECKABLE : BbangZipCardStateType { - @Composable override fun getStyle() = + @Composable + override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, borderWidth = 1.dp, radius = 24.dp, shadowOptions = - listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 12.dp, - offsetX = 0.dp, - offsetY = 6.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 4.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp, - ), + listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 12.dp, + offsetX = 0.dp, + offsetY = 6.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp, ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp, + ), + ), ) } data object CHECKED : BbangZipCardStateType { - @Composable override fun getStyle() = + @Composable + override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, borderColor = BbangZipTheme.colors.lineStrong_68645E_52, borderWidth = 3.dp, radius = 24.dp, shadowOptions = - listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 12.dp, - offsetX = 0.dp, - offsetY = 6.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 4.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp, - ), + listOf( + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 12.dp, + offsetX = 0.dp, + offsetY = 6.dp, + spread = 0.dp, + ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp, ), + ShadowConfig( + color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp, + ), + ), ) } } sealed interface ToDoCardStateType : BbangZipCardStateType { data object COMPLETE : ToDoCardStateType { - @Composable override fun getStyle() = + @Composable + override fun getStyle() = StudyCardStyle( background = BbangZipTheme.colors.backgroundNormal_FFFFFF, borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, borderWidth = 1.dp, radius = 24.dp, - shadowOptions = - listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity28), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 4.dp, - spread = 0.dp, - ), - ), ) + } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt deleted file mode 100644 index 5694c20..0000000 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt +++ /dev/null @@ -1,9 +0,0 @@ -package org.android.bbangzip.presentation.type - -sealed class BbangZipCardType { - data object TODO : BbangZipCardType() - - data object SUBJECT : BbangZipCardType() - - data object FRIEND : BbangZipCardType() -} diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt index 7e1b795..35683d1 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt @@ -16,7 +16,7 @@ import androidx.compose.ui.graphics.drawscope.drawIntoCanvas import androidx.compose.ui.semantics.Role import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import org.android.bbangzip.presentation.model.ShadowConfig +import org.android.bbangzip.ui.theme.model.ShadowConfig @Composable fun Modifier.noRippleClickable( diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt b/app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowConfig.kt similarity index 81% rename from app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt rename to app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowConfig.kt index e1f6750..cafc3b5 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/model/ShadowConfig.kt +++ b/app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowConfig.kt @@ -1,4 +1,4 @@ -package org.android.bbangzip.presentation.model +package org.android.bbangzip.ui.theme.model import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp From 7837af024fffb2f76e4eb6e3b77707ec81a3d854 Mon Sep 17 00:00:00 2001 From: beom84 Date: Mon, 13 Jan 2025 21:23:04 +0900 Subject: [PATCH 14/29] =?UTF-8?q?[feat]=20#21=20todoCard=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/bbangzip/presentation/component/card/ToDoCard.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index e555641..3dbda0c 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -73,8 +73,8 @@ fun ToDoCard( CheckSpace( backgroundColor = checkBoxBackgroundColor, checkIcon = - if (stateType == ToDoCardStateType.COMPLETE || stateType == BbangZipCardStateType.CHECKED) { - { + { + if (stateType == ToDoCardStateType.COMPLETE || stateType == BbangZipCardStateType.CHECKED) { Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), contentDescription = "체크 표시 아이콘입니다.", From 89ea096149e58d522a9acbcadc09e434baf1bb29 Mon Sep 17 00:00:00 2001 From: beom84 Date: Mon, 13 Jan 2025 21:24:43 +0900 Subject: [PATCH 15/29] =?UTF-8?q?[feat]=20#21=20todoCard=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/bbangzip/presentation/component/card/ToDoCard.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 3dbda0c..8c91155 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -81,7 +81,7 @@ fun ToDoCard( tint = BbangZipTheme.colors.staticWhite_FFFFFF, ) } - } else null, + } , ) } } From 46c978aaa4b2be68ef6f10959cd28b80b0d24ca4 Mon Sep 17 00:00:00 2001 From: beom84 Date: Tue, 14 Jan 2025 16:17:59 +0900 Subject: [PATCH 16/29] =?UTF-8?q?[feat]=20#21=20ShadowType=20=EC=A7=80?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/type/BbangZipShadowType.kt | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/BbangZipShadowType.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipShadowType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipShadowType.kt new file mode 100644 index 0000000..5d68cdb --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipShadowType.kt @@ -0,0 +1,63 @@ +package org.android.bbangzip.presentation.type + +import androidx.compose.ui.unit.dp +import org.android.bbangzip.ui.theme.defaultBbangZipColors +import org.android.bbangzip.ui.theme.defaultBbangZipOpacity +import org.android.bbangzip.ui.theme.model.ShadowOption + +enum class BbangZipShadowType( + val shadowOptions: List +) { + Emphasize( + listOf( + ShadowOption( + color = defaultBbangZipColors.staticBlack_000000.copy(defaultBbangZipOpacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 2.dp, + spread = 0.dp, + ), + ShadowOption( + color = defaultBbangZipColors.staticBlack_000000.copy(defaultBbangZipOpacity.opacity8), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 1.dp, + spread = 0.dp, + ), + ShadowOption( + color = defaultBbangZipColors.staticBlack_000000.copy(defaultBbangZipOpacity.opacity8), + blur = 1.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp, + ), + ) + ), + Strong( + listOf( + ShadowOption( + color = defaultBbangZipColors.staticBlack_000000.copy(defaultBbangZipOpacity.opacity12), + blur = 12.dp, + offsetX = 0.dp, + offsetY = 6.dp, + spread = 0.dp, + ), + ShadowOption( + color = defaultBbangZipColors.staticBlack_000000.copy(defaultBbangZipOpacity.opacity12), + blur = 8.dp, + offsetX = 0.dp, + offsetY = 4.dp, + spread = 0.dp, + ), + ShadowOption( + color = defaultBbangZipColors.staticBlack_000000.copy(defaultBbangZipOpacity.opacity8), + blur = 4.dp, + offsetX = 0.dp, + offsetY = 0.dp, + spread = 0.dp, + ), + ) + ) + + +} \ No newline at end of file From f027333433b75cdc1cf1bf9d642cec23b2d82790 Mon Sep 17 00:00:00 2001 From: beom84 Date: Tue, 14 Jan 2025 16:18:31 +0900 Subject: [PATCH 17/29] =?UTF-8?q?[feat]=20#21=20shadowConfig=20->=20Shadow?= =?UTF-8?q?Option=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/theme/model/{ShadowConfig.kt => ShadowOption.kt} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename app/src/main/java/org/android/bbangzip/ui/theme/model/{ShadowConfig.kt => ShadowOption.kt} (90%) diff --git a/app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowConfig.kt b/app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowOption.kt similarity index 90% rename from app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowConfig.kt rename to app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowOption.kt index cafc3b5..388da41 100644 --- a/app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowConfig.kt +++ b/app/src/main/java/org/android/bbangzip/ui/theme/model/ShadowOption.kt @@ -3,7 +3,7 @@ package org.android.bbangzip.ui.theme.model import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp -data class ShadowConfig( +data class ShadowOption( val color: Color, val blur: Dp, val offsetX: Dp, From 83b29630ab2a2598535cf1653555e8f8c442bf4a Mon Sep 17 00:00:00 2001 From: beom84 Date: Tue, 14 Jan 2025 19:21:52 +0900 Subject: [PATCH 18/29] =?UTF-8?q?[feat]=20#21=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81=20=EC=99=84=EB=A3=8C!!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/BbangZipCardState.kt | 38 ++++ .../presentation/component/card/FriendCard.kt | 67 +++++- .../component/card/SubjectCard.kt | 95 ++++----- .../presentation/component/card/ToDoCard.kt | 194 +++++++++--------- .../model/card/FriendCardModel.kt | 2 +- .../model/card/SubjectCardModel.kt | 2 +- .../presentation/model/card/ToDoCardModel.kt | 2 +- .../type/BbangZipCardStateType.kt | 140 ------------- .../presentation/type/BbangZipCardType.kt | 38 ++++ .../presentation/type/BbangZipShadowType.kt | 15 +- .../presentation/util/modifier/ModifierExt.kt | 8 +- 11 files changed, 292 insertions(+), 309 deletions(-) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt delete mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt create mode 100644 app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt new file mode 100644 index 0000000..d1e8d8e --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt @@ -0,0 +1,38 @@ +package org.android.bbangzip.presentation.component.card + +import android.os.Parcelable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import kotlinx.parcelize.Parcelize +import org.android.bbangzip.presentation.type.BbangZipCardType +import org.android.bbangzip.presentation.type.BbangZipShadowType + +@Parcelize +sealed class BbangZipCardState : Parcelable { + data object DEFAULT : BbangZipCardState() + + data object CHECKABLE : BbangZipCardState() + + data object CHECKED : BbangZipCardState() + + data object COMPLETE : BbangZipCardState() +} + +private val stateToTypeMap = + mapOf( + BbangZipCardState.DEFAULT to BbangZipCardType.DEFAULT, + BbangZipCardState.CHECKABLE to BbangZipCardType.CHECKABLE, + BbangZipCardState.CHECKED to BbangZipCardType.CHECKED, + BbangZipCardState.COMPLETE to BbangZipCardType.COMPLETE, + ) + +fun BbangZipCardState.getBackgroundColor(): Color = stateToTypeMap[this]?.backgroundColor ?: Color.Transparent + +fun BbangZipCardState.getBorderColor(): Color = stateToTypeMap[this]?.borderColor ?: Color.Transparent + +fun BbangZipCardState.getBorderWidth(): Dp = stateToTypeMap[this]?.borderWidth ?: 0.dp + +fun BbangZipCardState.getRadius(): Dp = stateToTypeMap[this]?.radius ?: 0.dp + +fun BbangZipCardState.getShadowOptions(): BbangZipShadowType = stateToTypeMap[this]?.shadowOptions ?: BbangZipShadowType.EMPTY diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index 5ca3290..99eee0c 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.border 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 @@ -20,28 +21,38 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.android.bbangzip.R import org.android.bbangzip.presentation.model.card.FriendCardModel -import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows +import org.android.bbangzip.ui.theme.BBANGZIPTheme import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun FriendCard( - stateType: BbangZipCardStateType, + state: BbangZipCardState, data: FriendCardModel, modifier: Modifier = Modifier, ) { - val style = stateType.getStyle() - + val radius = state.getRadius() Box( modifier = modifier - .applyShadows(shadowOptions = style.shadowOptions, shape = RoundedCornerShape(style.radius)) + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) .fillMaxWidth() - .border(width = style.borderWidth, color = style.borderColor, shape = RoundedCornerShape(size = style.radius)) - .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) .padding(16.dp), ) { Row( @@ -57,7 +68,8 @@ fun FriendCard( contentDescription = "프로필 이미지입니다.", contentScale = ContentScale.FillBounds, modifier = Modifier.size(48.dp), - ) // TODO 밤에 코리와 함께 고칠게요 이거 나중가면 이미지가 48.dp로 내려오나? + ) + // TODO 밤에 코리와 함께 고칠게요 이거 나중가면 이미지가 48.dp로 내려오나? Spacer(modifier = Modifier.width(16.dp)) @@ -84,3 +96,42 @@ fun FriendCard( } } } + +@Preview(showBackground = true, name = "Friend Card Preview") +@Composable +fun FriendCardPreview() { + BBANGZIPTheme { + Column(modifier = Modifier.padding(16.dp)) { + FriendCard( + state = BbangZipCardState.DEFAULT, + data = + FriendCardModel( + friendId = 1, + friendName = "김철수", + imageUrl = "https://via.placeholder.com/150", + ), + modifier = Modifier.padding(bottom = 8.dp), + ) + FriendCard( + state = BbangZipCardState.CHECKABLE, + data = + FriendCardModel( + friendId = 2, + friendName = "이영희", + imageUrl = "https://via.placeholder.com/150", + ), + modifier = Modifier.padding(bottom = 8.dp), + ) + FriendCard( + state = BbangZipCardState.CHECKED, + data = + FriendCardModel( + friendId = 3, + friendName = "박영수", + imageUrl = "https://via.placeholder.com/150", + ), + modifier = Modifier.padding(bottom = 8.dp), + ) + } + } +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index 0bfdf3a..3839e32 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -7,7 +7,6 @@ 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.fillMaxHeight import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width @@ -26,33 +25,31 @@ import androidx.compose.ui.unit.dp import org.android.bbangzip.R import org.android.bbangzip.presentation.component.chip.BbangZipChip import org.android.bbangzip.presentation.model.card.SubjectCardModel -import org.android.bbangzip.presentation.type.BbangZipCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun SubjectCard( - stateType: BbangZipCardStateType, + state: BbangZipCardState, data: SubjectCardModel, modifier: Modifier = Modifier, ) { - val style = stateType.getStyle() - + val radius = state.getRadius() Box( modifier = - modifier - .applyShadows( - shadowOptions = style.shadowOptions, - shape = RoundedCornerShape(style.radius) - ) - .border( - width = style.borderWidth, - color = style.borderColor, - shape = RoundedCornerShape(size = style.radius) - ) - .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background(color = state.getBackgroundColor(), shape = RoundedCornerShape(size = radius)) + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -78,7 +75,6 @@ fun SubjectInfo( modifier = modifier, verticalArrangement = Arrangement.SpaceBetween, ) { - Text( text = data.subjectName, style = BbangZipTheme.typography.body1Bold, @@ -95,10 +91,9 @@ fun SubjectInfo( Spacer(modifier = Modifier.height(4.dp)) - BbangZipChip( text = "D-${data.pendingCount}", - backgroundColor = BbangZipTheme.colors.statusPositive_3D3730 + backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, ) Spacer(modifier = Modifier.height(44.dp)) @@ -131,9 +126,9 @@ fun BbangZipPushIcon( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp), + modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), @@ -158,42 +153,42 @@ fun SubjectCardPreview() { BBANGZIPTheme { Column { SubjectCard( - stateType = BbangZipCardStateType.DEFAULT, + state = BbangZipCardState.DEFAULT, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( - stateType = BbangZipCardStateType.CHECKED, + state = BbangZipCardState.CHECKED, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( - stateType = BbangZipCardStateType.CHECKABLE, + state = BbangZipCardState.CHECKABLE, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 8c91155..91ad5c6 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -25,47 +25,47 @@ import androidx.compose.ui.unit.dp import org.android.bbangzip.R import org.android.bbangzip.presentation.component.chip.BbangZipChip import org.android.bbangzip.presentation.model.card.ToDoCardModel -import org.android.bbangzip.presentation.type.BbangZipCardStateType -import org.android.bbangzip.presentation.type.ToDoCardStateType import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun ToDoCard( - stateType: BbangZipCardStateType, + state: BbangZipCardState, data: ToDoCardModel, modifier: Modifier = Modifier, ) { - val style = stateType.getStyle() - + val radius = state.getRadius() val checkBoxBackgroundColor = - when (stateType) { - BbangZipCardStateType.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 - BbangZipCardStateType.CHECKED -> BbangZipTheme.colors.labelAlternative_282119_61 - BbangZipCardStateType.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 - ToDoCardStateType.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 + when (state) { + BbangZipCardState.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 + BbangZipCardState.CHECKED -> BbangZipTheme.colors.labelAlternative_282119_61 + BbangZipCardState.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 + BbangZipCardState.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 } Box( modifier = - modifier - .applyShadows( - shadowOptions = style.shadowOptions, - shape = RoundedCornerShape(style.radius) - ) - .fillMaxWidth() - .border( - width = style.borderWidth, - color = style.borderColor, - shape = RoundedCornerShape(size = style.radius) - ) - .background(color = style.background, shape = RoundedCornerShape(size = style.radius)) - .padding(horizontal = 16.dp, vertical = 10.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(size = radius), + ) + .fillMaxWidth() + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .padding(horizontal = 16.dp, vertical = 10.dp), ) { Row( modifier = - Modifier - .fillMaxWidth(), + Modifier + .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, ) { ToDoInfo(data = data) @@ -73,15 +73,15 @@ fun ToDoCard( CheckSpace( backgroundColor = checkBoxBackgroundColor, checkIcon = - { - if (stateType == ToDoCardStateType.COMPLETE || stateType == BbangZipCardStateType.CHECKED) { - Icon( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), - contentDescription = "체크 표시 아이콘입니다.", - tint = BbangZipTheme.colors.staticWhite_FFFFFF, - ) - } - } , + { + if (state == BbangZipCardState.COMPLETE) { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), + contentDescription = "체크 표시 아이콘입니다.", + tint = BbangZipTheme.colors.staticWhite_FFFFFF, + ) + } + }, ) } } @@ -93,11 +93,12 @@ fun ToDoInfo( modifier: Modifier = Modifier, ) { val count = if (data.remainingDays >= 0) "D+" else "D-" - val backgroundColor = if (data.remainingDays >= 0) { - BbangZipTheme.colors.labelAlternative_282119_61 - } else { - BbangZipTheme.colors.statusDestructive_FF8345 - } + val backgroundColor = + if (data.remainingDays >= 0) { + BbangZipTheme.colors.labelAlternative_282119_61 + } else { + BbangZipTheme.colors.statusDestructive_FF8345 + } Column(modifier = modifier) { Column(modifier = Modifier.padding(start = 4.dp)) { @@ -129,7 +130,7 @@ fun ToDoInfo( Row(verticalAlignment = Alignment.CenterVertically) { BbangZipChip( text = count + data.remainingDays, - backgroundColor = backgroundColor + backgroundColor = backgroundColor, ) Spacer(modifier = Modifier.width(8.dp)) @@ -143,7 +144,6 @@ fun ToDoInfo( } } - @Composable fun CheckSpace( modifier: Modifier = Modifier, @@ -153,10 +153,10 @@ fun CheckSpace( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) - .height(32.dp) - .width(32.dp), + modifier + .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) + .height(32.dp) + .width(32.dp), // TODO 여기 어떤식으로 기기대응하는지 물어보기 ) { checkIcon?.invoke() @@ -169,72 +169,72 @@ fun ToDoCardPreview() { BBANGZIPTheme { Column { ToDoCard( - stateType = BbangZipCardStateType.DEFAULT, + state = BbangZipCardState.DEFAULT, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( - stateType = BbangZipCardStateType.CHECKED, + state = BbangZipCardState.CHECKABLE, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( - stateType = BbangZipCardStateType.CHECKABLE, + state = BbangZipCardState.CHECKED, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( - stateType = ToDoCardStateType.COMPLETE, + state = BbangZipCardState.COMPLETE, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/card/FriendCardModel.kt b/app/src/main/java/org/android/bbangzip/presentation/model/card/FriendCardModel.kt index cb67a36..ff64725 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/model/card/FriendCardModel.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/model/card/FriendCardModel.kt @@ -8,4 +8,4 @@ data class FriendCardModel( val friendId: Int, val friendName: String, val imageUrl: String, -) : Parcelable \ No newline at end of file +) : Parcelable diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/card/SubjectCardModel.kt b/app/src/main/java/org/android/bbangzip/presentation/model/card/SubjectCardModel.kt index 30badde..4680bd2 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/model/card/SubjectCardModel.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/model/card/SubjectCardModel.kt @@ -11,4 +11,4 @@ data class SubjectCardModel( val examRemainingDays: Int, val pendingCount: Int, val inProgressCount: Int, -) : Parcelable +) : Parcelable diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/card/ToDoCardModel.kt b/app/src/main/java/org/android/bbangzip/presentation/model/card/ToDoCardModel.kt index fe8a29f..90de955 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/model/card/ToDoCardModel.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/model/card/ToDoCardModel.kt @@ -13,4 +13,4 @@ data class ToDoCardModel( val finishPage: Int, val deadline: String, val remainingDays: Int, -) : Parcelable \ No newline at end of file +) : Parcelable diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt deleted file mode 100644 index 187ee1d..0000000 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardStateType.kt +++ /dev/null @@ -1,140 +0,0 @@ -package org.android.bbangzip.presentation.type - -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp -import org.android.bbangzip.ui.theme.model.ShadowConfig -import org.android.bbangzip.ui.theme.BbangZipTheme - -data class StudyCardStyle( - val background: Color, - val borderColor: Color, - val borderWidth: Dp, - val radius: Dp, - val shadowOptions: List = listOf(), -) - -sealed interface BbangZipCardStateType { - @Composable - fun getStyle(): StudyCardStyle - - data object DEFAULT : BbangZipCardStateType { - @Composable - override fun getStyle() = - StudyCardStyle( - background = BbangZipTheme.colors.backgroundNormal_FFFFFF, - borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, - borderWidth = 1.dp, - radius = 24.dp, - shadowOptions = - listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 2.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 1.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity8), - blur = 1.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp, - ), - ), - ) - } - - data object CHECKABLE : BbangZipCardStateType { - @Composable - override fun getStyle() = - StudyCardStyle( - background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, - borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, - borderWidth = 1.dp, - radius = 24.dp, - shadowOptions = - listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 12.dp, - offsetX = 0.dp, - offsetY = 6.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 4.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp, - ), - ), - ) - } - - data object CHECKED : BbangZipCardStateType { - @Composable - override fun getStyle() = - StudyCardStyle( - background = BbangZipTheme.colors.backgroundAlternative_F5F5F5, - borderColor = BbangZipTheme.colors.lineStrong_68645E_52, - borderWidth = 3.dp, - radius = 24.dp, - shadowOptions = - listOf( - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 12.dp, - offsetX = 0.dp, - offsetY = 6.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 8.dp, - offsetX = 0.dp, - offsetY = 4.dp, - spread = 0.dp, - ), - ShadowConfig( - color = BbangZipTheme.colors.staticBlack_000000.copy(BbangZipTheme.opacity.opacity12), - blur = 4.dp, - offsetX = 0.dp, - offsetY = 0.dp, - spread = 0.dp, - ), - ), - ) - } -} - -sealed interface ToDoCardStateType : BbangZipCardStateType { - data object COMPLETE : ToDoCardStateType { - @Composable - override fun getStyle() = - StudyCardStyle( - background = BbangZipTheme.colors.backgroundNormal_FFFFFF, - borderColor = BbangZipTheme.colors.lineAlternative_68645E_08, - borderWidth = 1.dp, - radius = 24.dp, - ) - - } -} diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt new file mode 100644 index 0000000..79d8cb2 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt @@ -0,0 +1,38 @@ +package org.android.bbangzip.presentation.type + +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import org.android.bbangzip.ui.theme.defaultBbangZipColors + +enum class BbangZipCardType( + val backgroundColor: Color, + val borderColor: Color, + val borderWidth: Dp, + val radius: Dp = 24.dp, + val shadowOptions: BbangZipShadowType = BbangZipShadowType.EMPTY, +) { + DEFAULT( + backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, + borderColor = defaultBbangZipColors.lineAlternative_68645E_08, + borderWidth = 1.dp, + shadowOptions = BbangZipShadowType.Emphasize, + ), + CHECKABLE( + backgroundColor = defaultBbangZipColors.backgroundAlternative_F5F5F5, + borderColor = defaultBbangZipColors.lineAlternative_68645E_08, + borderWidth = 1.dp, + shadowOptions = BbangZipShadowType.Strong, + ), + CHECKED( + backgroundColor = defaultBbangZipColors.backgroundAlternative_F5F5F5, + borderColor = defaultBbangZipColors.lineStrong_68645E_52, + borderWidth = 3.dp, + shadowOptions = BbangZipShadowType.Emphasize, + ), + COMPLETE( + backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, + borderColor = defaultBbangZipColors.lineAlternative_68645E_08, + borderWidth = 1.dp, + ), +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipShadowType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipShadowType.kt index 5d68cdb..8b0e104 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipShadowType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipShadowType.kt @@ -6,8 +6,11 @@ import org.android.bbangzip.ui.theme.defaultBbangZipOpacity import org.android.bbangzip.ui.theme.model.ShadowOption enum class BbangZipShadowType( - val shadowOptions: List + val shadowOptions: List, ) { + EMPTY( + listOf(), + ), Emphasize( listOf( ShadowOption( @@ -31,7 +34,7 @@ enum class BbangZipShadowType( offsetY = 0.dp, spread = 0.dp, ), - ) + ), ), Strong( listOf( @@ -56,8 +59,6 @@ enum class BbangZipShadowType( offsetY = 0.dp, spread = 0.dp, ), - ) - ) - - -} \ No newline at end of file + ), + ), +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt index 35683d1..0f47cd7 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt @@ -16,7 +16,7 @@ import androidx.compose.ui.graphics.drawscope.drawIntoCanvas import androidx.compose.ui.semantics.Role import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import org.android.bbangzip.ui.theme.model.ShadowConfig +import org.android.bbangzip.presentation.type.BbangZipShadowType @Composable fun Modifier.noRippleClickable( @@ -67,10 +67,10 @@ fun Modifier.dropShadow( @Composable fun Modifier.applyShadows( - shadowOptions: List, + shadowType: BbangZipShadowType, shape: Shape, ): Modifier { - return shadowOptions.fold(this) { acc, shadowConfig -> - acc.dropShadow(shape = shape, color = shadowConfig.color, blur = shadowConfig.blur, offsetY = shadowConfig.offsetY, offsetX = shadowConfig.offsetX, spread = shadowConfig.spread) + return shadowType.shadowOptions.fold(this) { acc, shadowOption -> + acc.dropShadow(shape = shape, color = shadowOption.color, blur = shadowOption.blur, offsetY = shadowOption.offsetY, offsetX = shadowOption.offsetX, spread = shadowOption.spread) } } From bf6fa3db9a5b940fc8f79146e06b702e7af6cf2d Mon Sep 17 00:00:00 2001 From: beom84 Date: Tue, 14 Jan 2025 19:36:56 +0900 Subject: [PATCH 19/29] =?UTF-8?q?[feat]=20#21=20string=20=EC=B6=94?= =?UTF-8?q?=EC=B6=9C=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/component/card/FriendCard.kt | 40 ++++----- .../component/card/SubjectCard.kt | 88 ++++++++++--------- .../presentation/component/card/ToDoCard.kt | 37 ++++---- app/src/main/res/values/strings.xml | 9 ++ 4 files changed, 94 insertions(+), 80 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index 99eee0c..f47a6bb 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -38,22 +39,22 @@ fun FriendCard( val radius = state.getRadius() Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(radius), - ) - .fillMaxWidth() - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .padding(16.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .fillMaxWidth() + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .padding(16.dp), ) { Row( modifier = Modifier.fillMaxWidth(), @@ -65,11 +66,10 @@ fun FriendCard( ) { Image( imageVector = ImageVector.vectorResource(id = R.drawable.ic_user_one_default_24), - contentDescription = "프로필 이미지입니다.", + contentDescription = stringResource(R.string.card_friend_profile_description), contentScale = ContentScale.FillBounds, modifier = Modifier.size(48.dp), ) - // TODO 밤에 코리와 함께 고칠게요 이거 나중가면 이미지가 48.dp로 내려오나? Spacer(modifier = Modifier.width(16.dp)) @@ -82,7 +82,7 @@ fun FriendCard( Spacer(modifier = Modifier.width(4.dp)) Text( - text = "사장님", + text = stringResource(R.string.card_friend_boss_text), style = BbangZipTheme.typography.caption2Bold, color = BbangZipTheme.colors.labelAlternative_282119_61, ) @@ -90,7 +90,7 @@ fun FriendCard( Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_kebab_default_24), - contentDescription = "더보기 버튼입니다.", + contentDescription = stringResource(R.string.card_friend_kebab_button_description), tint = BbangZipTheme.colors.labelAlternative_282119_61, ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index 3839e32..214cd6a 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -19,6 +19,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -38,18 +39,21 @@ fun SubjectCard( val radius = state.getRadius() Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(radius), - ) - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background(color = state.getBackgroundColor(), shape = RoundedCornerShape(size = radius)) - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius) + ) + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -60,7 +64,7 @@ fun SubjectCard( Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_chevronright_thick_small_24), tint = BbangZipTheme.colors.labelAssistive_282119_28, - contentDescription = "오늘 할 일로 향하는 버튼입니다.", + contentDescription = stringResource(R.string.card_subject_button_description), ) } } @@ -101,7 +105,7 @@ fun SubjectInfo( BbangZipPushIcon( backgroundColor = BbangZipTheme.colors.statusDestructive_FF8345, count = data.pendingCount, - text = "밀린 공부", + text = stringResource(R.string.card_subject_pending_icon_description), ) Spacer(modifier = Modifier.height(4.dp)) @@ -109,7 +113,7 @@ fun SubjectInfo( BbangZipPushIcon( backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, count = data.inProgressCount, - text = "진행 중인 공부", + text = stringResource(R.string.card_subject_studying_icon_description), ) } } @@ -126,9 +130,9 @@ fun BbangZipPushIcon( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp), + modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), @@ -155,40 +159,40 @@ fun SubjectCardPreview() { SubjectCard( state = BbangZipCardState.DEFAULT, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKED, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKABLE, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 91ad5c6..8799276 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -19,6 +19,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -39,28 +40,28 @@ fun ToDoCard( val checkBoxBackgroundColor = when (state) { BbangZipCardState.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 - BbangZipCardState.CHECKED -> BbangZipTheme.colors.labelAlternative_282119_61 + BbangZipCardState.CHECKED -> BbangZipTheme.colors.fillStrong_68645E_16 BbangZipCardState.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 BbangZipCardState.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 } Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(size = radius), - ) - .fillMaxWidth() - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .padding(horizontal = 16.dp, vertical = 10.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(size = radius), + ) + .fillMaxWidth() + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .padding(horizontal = 16.dp, vertical = 10.dp), ) { Row( modifier = @@ -77,7 +78,7 @@ fun ToDoCard( if (state == BbangZipCardState.COMPLETE) { Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), - contentDescription = "체크 표시 아이콘입니다.", + contentDescription = stringResource(R.string.card_todo_check_space_description), tint = BbangZipTheme.colors.staticWhite_FFFFFF, ) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 23b02db..c9d3084 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,13 @@ BBANGZIP 이거 + 체크 표시 아이콘입니다. + 오늘 할 일로 향하는 버튼입니다. + 밀린 공부 + 진행 중인 공부 + 프로필 이미지입니다. + 더보기 버튼입니다. + 사장님 + + \ No newline at end of file From f5d94e1654c16c50059a86c4859102e4fd351cdf Mon Sep 17 00:00:00 2001 From: beom84 Date: Tue, 14 Jan 2025 19:43:21 +0900 Subject: [PATCH 20/29] =?UTF-8?q?[feat]=20#21=20merge=20block=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/component/card/FriendCard.kt | 32 +++---- .../component/card/SubjectCard.kt | 84 +++++++++---------- .../presentation/component/card/ToDoCard.kt | 32 +++---- app/src/main/res/values/strings.xml | 10 ++- 4 files changed, 82 insertions(+), 76 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index f47a6bb..8931428 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -39,22 +39,22 @@ fun FriendCard( val radius = state.getRadius() Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(radius), - ) - .fillMaxWidth() - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .padding(16.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .fillMaxWidth() + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .padding(16.dp), ) { Row( modifier = Modifier.fillMaxWidth(), diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index 214cd6a..e541db4 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -39,21 +39,21 @@ fun SubjectCard( val radius = state.getRadius() Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(radius), - ) - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius) - ) - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -130,9 +130,9 @@ fun BbangZipPushIcon( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp), + modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), @@ -159,40 +159,40 @@ fun SubjectCardPreview() { SubjectCard( state = BbangZipCardState.DEFAULT, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKED, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKABLE, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 8799276..edc53ea 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -46,22 +46,22 @@ fun ToDoCard( } Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(size = radius), - ) - .fillMaxWidth() - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .padding(horizontal = 16.dp, vertical = 10.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(size = radius), + ) + .fillMaxWidth() + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .padding(horizontal = 16.dp, vertical = 10.dp), ) { Row( modifier = diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c9d3084..307a809 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,14 @@ BBANGZIP 이거 + + + 과목 관리 + 오늘 할 일 + 친구들 + 마이페이지 + + 체크 표시 아이콘입니다. 오늘 할 일로 향하는 버튼입니다. 밀린 공부 @@ -8,6 +16,4 @@ 프로필 이미지입니다. 더보기 버튼입니다. 사장님 - - \ No newline at end of file From 12e8e42bbc0f608c35dcf9480361eedba4cd0efc Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 12:12:37 +0900 Subject: [PATCH 21/29] =?UTF-8?q?[feat]=20#7=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EC=A0=81=EC=9A=A9(string=20=EC=B6=94=EC=B6=9C=20,?= =?UTF-8?q?=20onClick=20=EC=A0=81=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/BbangZipCardState.kt | 2 + .../presentation/component/card/FriendCard.kt | 11 +- .../component/card/SubjectCard.kt | 41 ++-- .../presentation/component/card/ToDoCard.kt | 195 +++++++++--------- .../presentation/type/BbangZipCardType.kt | 3 + app/src/main/res/values/strings.xml | 4 + 6 files changed, 140 insertions(+), 116 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt index d1e8d8e..3f47ddb 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt @@ -36,3 +36,5 @@ fun BbangZipCardState.getBorderWidth(): Dp = stateToTypeMap[this]?.borderWidth ? fun BbangZipCardState.getRadius(): Dp = stateToTypeMap[this]?.radius ?: 0.dp fun BbangZipCardState.getShadowOptions(): BbangZipShadowType = stateToTypeMap[this]?.shadowOptions ?: BbangZipShadowType.EMPTY + +fun BbangZipCardState.getCheckBoxBackgroundColor(): Color = stateToTypeMap[this]?.checkBoxBackgroundColor ?: Color.Transparent \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index 8931428..197771c 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -3,6 +3,7 @@ package org.android.bbangzip.presentation.component.card import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.border +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -34,6 +35,8 @@ import org.android.bbangzip.ui.theme.BbangZipTheme fun FriendCard( state: BbangZipCardState, data: FriendCardModel, + onClick: () -> Unit = {}, + onActionIconClick: () -> Unit = {}, modifier: Modifier = Modifier, ) { val radius = state.getRadius() @@ -54,7 +57,8 @@ fun FriendCard( color = state.getBackgroundColor(), shape = RoundedCornerShape(size = radius), ) - .padding(16.dp), + .padding(16.dp) + .clickable { onClick() }, ) { Row( modifier = Modifier.fillMaxWidth(), @@ -66,7 +70,7 @@ fun FriendCard( ) { Image( imageVector = ImageVector.vectorResource(id = R.drawable.ic_user_one_default_24), - contentDescription = stringResource(R.string.card_friend_profile_description), + contentDescription = null, contentScale = ContentScale.FillBounds, modifier = Modifier.size(48.dp), ) @@ -87,11 +91,12 @@ fun FriendCard( color = BbangZipTheme.colors.labelAlternative_282119_61, ) } - + //TODO Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_kebab_default_24), contentDescription = stringResource(R.string.card_friend_kebab_button_description), tint = BbangZipTheme.colors.labelAlternative_282119_61, + modifier = Modifier.clickable { onActionIconClick() }, ) } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index e541db4..b5219bc 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -2,6 +2,7 @@ package org.android.bbangzip.presentation.component.card import androidx.compose.foundation.background import androidx.compose.foundation.border +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -34,26 +35,29 @@ import org.android.bbangzip.ui.theme.BbangZipTheme fun SubjectCard( state: BbangZipCardState, data: SubjectCardModel, + onClick: () -> Unit = {}, + onActionIconClick: () -> Unit = {}, modifier: Modifier = Modifier, ) { val radius = state.getRadius() Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(radius), - ) - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp) + .clickable { onClick() }, ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -65,11 +69,13 @@ fun SubjectCard( imageVector = ImageVector.vectorResource(id = R.drawable.ic_chevronright_thick_small_24), tint = BbangZipTheme.colors.labelAssistive_282119_28, contentDescription = stringResource(R.string.card_subject_button_description), + modifier = Modifier + .clickable { onActionIconClick() }, ) } } } - +//TODO @Composable fun SubjectInfo( data: SubjectCardModel, @@ -96,11 +102,12 @@ fun SubjectInfo( Spacer(modifier = Modifier.height(4.dp)) BbangZipChip( - text = "D-${data.pendingCount}", + text = (stringResource(R.string.card_d_minus_day,data.pendingCount)), backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, ) Spacer(modifier = Modifier.height(44.dp)) + Column { BbangZipPushIcon( backgroundColor = BbangZipTheme.colors.statusDestructive_FF8345, diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index edc53ea..0b92f97 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -2,6 +2,7 @@ package org.android.bbangzip.presentation.component.card import androidx.compose.foundation.background import androidx.compose.foundation.border +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -34,55 +35,41 @@ import org.android.bbangzip.ui.theme.BbangZipTheme fun ToDoCard( state: BbangZipCardState, data: ToDoCardModel, + onClick: () -> Unit = {}, modifier: Modifier = Modifier, ) { val radius = state.getRadius() - val checkBoxBackgroundColor = - when (state) { - BbangZipCardState.DEFAULT -> BbangZipTheme.colors.fillStrong_68645E_16 - BbangZipCardState.CHECKED -> BbangZipTheme.colors.fillStrong_68645E_16 - BbangZipCardState.CHECKABLE -> BbangZipTheme.colors.fillStrong_68645E_16 - BbangZipCardState.COMPLETE -> BbangZipTheme.colors.secondaryNormal_FFCD80 - } Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(size = radius), - ) - .fillMaxWidth() - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .padding(horizontal = 16.dp, vertical = 10.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(size = radius), + ) + .fillMaxWidth() + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .padding(horizontal = 16.dp, vertical = 10.dp) + .clickable { onClick() }, ) { Row( modifier = - Modifier - .fillMaxWidth(), + Modifier + .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, ) { ToDoInfo(data = data) CheckSpace( - backgroundColor = checkBoxBackgroundColor, - checkIcon = - { - if (state == BbangZipCardState.COMPLETE) { - Icon( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), - contentDescription = stringResource(R.string.card_todo_check_space_description), - tint = BbangZipTheme.colors.staticWhite_FFFFFF, - ) - } - }, + backgroundColor = state.getCheckBoxBackgroundColor(), + isCompleted = state == BbangZipCardState.COMPLETE ) } } @@ -94,7 +81,7 @@ fun ToDoInfo( modifier: Modifier = Modifier, ) { val count = if (data.remainingDays >= 0) "D+" else "D-" - val backgroundColor = + val chipBackgroundColor = if (data.remainingDays >= 0) { BbangZipTheme.colors.labelAlternative_282119_61 } else { @@ -104,7 +91,11 @@ fun ToDoInfo( Column(modifier = modifier) { Column(modifier = Modifier.padding(start = 4.dp)) { Text( - text = "${data.subjectName} / ${data.examName}", + text = stringResource( + R.string.card_subject_exam_name_text, + data.subjectName, + data.examName + ), style = BbangZipTheme.typography.caption2Medium, color = BbangZipTheme.colors.labelAssistive_282119_28, ) @@ -120,7 +111,11 @@ fun ToDoInfo( Spacer(modifier = Modifier.height(4.dp)) Text( - text = "${data.startPage}p - ${data.finishPage}p", + text = stringResource( + R.string.card_start_end_day_text, + data.startPage, + data.finishPage + ), style = BbangZipTheme.typography.label1Bold, color = BbangZipTheme.colors.labelNormal_282119, ) @@ -131,13 +126,13 @@ fun ToDoInfo( Row(verticalAlignment = Alignment.CenterVertically) { BbangZipChip( text = count + data.remainingDays, - backgroundColor = backgroundColor, + backgroundColor = chipBackgroundColor, ) Spacer(modifier = Modifier.width(8.dp)) Text( - text = "${data.deadline}까지", + text = stringResource(R.string.card_deadline_text, data.deadline), style = BbangZipTheme.typography.caption1Bold, color = BbangZipTheme.colors.labelAlternative_282119_61, ) @@ -147,23 +142,31 @@ fun ToDoInfo( @Composable fun CheckSpace( - modifier: Modifier = Modifier, backgroundColor: Color, - checkIcon: @Composable (() -> Unit)? = null, + isCompleted: Boolean = false, + modifier: Modifier = Modifier, ) { Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) - .height(32.dp) - .width(32.dp), + modifier + .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) + .height(32.dp) + .width(32.dp) + // TODO 여기 어떤식으로 기기대응하는지 물어보기 ) { - checkIcon?.invoke() + if (isCompleted) { + Icon( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_check_thick_24), + contentDescription = stringResource(R.string.card_todo_check_space_description), + tint = BbangZipTheme.colors.staticWhite_FFFFFF, + ) + } } } +//TODO @Preview(showBackground = true) @Composable fun ToDoCardPreview() { @@ -172,70 +175,70 @@ fun ToDoCardPreview() { ToDoCard( state = BbangZipCardState.DEFAULT, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( state = BbangZipCardState.CHECKABLE, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( state = BbangZipCardState.CHECKED, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( state = BbangZipCardState.COMPLETE, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt index 79d8cb2..f37232c 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt @@ -3,6 +3,7 @@ package org.android.bbangzip.presentation.type import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp +import org.android.bbangzip.ui.theme.BbangZipTheme import org.android.bbangzip.ui.theme.defaultBbangZipColors enum class BbangZipCardType( @@ -11,6 +12,7 @@ enum class BbangZipCardType( val borderWidth: Dp, val radius: Dp = 24.dp, val shadowOptions: BbangZipShadowType = BbangZipShadowType.EMPTY, + val checkBoxBackgroundColor: Color = defaultBbangZipColors.fillStrong_68645E_16, ) { DEFAULT( backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, @@ -34,5 +36,6 @@ enum class BbangZipCardType( backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, borderColor = defaultBbangZipColors.lineAlternative_68645E_08, borderWidth = 1.dp, + checkBoxBackgroundColor = defaultBbangZipColors.secondaryNormal_FFCD80 ), } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 307a809..211f70f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,4 +16,8 @@ 프로필 이미지입니다. 더보기 버튼입니다. 사장님 + D-%s + %s까지 + %sp - %sp + %s / %s \ No newline at end of file From a2d0df3bcf009ad9f827cc4b128285f588214722 Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 13:25:28 +0900 Subject: [PATCH 22/29] =?UTF-8?q?[feat]=20#7=20complete=20opacity=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/BbangZipCardState.kt | 4 +++- .../presentation/component/card/ToDoCard.kt | 19 +++++++++++-------- .../presentation/type/BbangZipCardType.kt | 5 ++++- .../org/android/bbangzip/ui/theme/Opacity.kt | 2 ++ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt index 3f47ddb..e77cb32 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt @@ -37,4 +37,6 @@ fun BbangZipCardState.getRadius(): Dp = stateToTypeMap[this]?.radius ?: 0.dp fun BbangZipCardState.getShadowOptions(): BbangZipShadowType = stateToTypeMap[this]?.shadowOptions ?: BbangZipShadowType.EMPTY -fun BbangZipCardState.getCheckBoxBackgroundColor(): Color = stateToTypeMap[this]?.checkBoxBackgroundColor ?: Color.Transparent \ No newline at end of file +fun BbangZipCardState.getCheckBoxBackgroundColor(): Color = stateToTypeMap[this]?.checkBoxBackgroundColor ?: Color.Transparent + +fun BbangZipCardState.getInfoOpacity(): Float = stateToTypeMap[this]?.infoOpacity ?: 1f \ No newline at end of file diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 0b92f97..515455b 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -29,6 +29,7 @@ import org.android.bbangzip.presentation.component.chip.BbangZipChip import org.android.bbangzip.presentation.model.card.ToDoCardModel import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme +import org.android.bbangzip.ui.theme.BbangZipOpacity import org.android.bbangzip.ui.theme.BbangZipTheme @Composable @@ -39,6 +40,7 @@ fun ToDoCard( modifier: Modifier = Modifier, ) { val radius = state.getRadius() + val infoOpacity = state.getInfoOpacity() Box( modifier = modifier @@ -65,7 +67,8 @@ fun ToDoCard( .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, ) { - ToDoInfo(data = data) + ToDoInfo(data = data, + infoOpacity = infoOpacity) CheckSpace( backgroundColor = state.getCheckBoxBackgroundColor(), @@ -74,10 +77,11 @@ fun ToDoCard( } } } - +//TODO @Composable fun ToDoInfo( data: ToDoCardModel, + infoOpacity: Float, modifier: Modifier = Modifier, ) { val count = if (data.remainingDays >= 0) "D+" else "D-" @@ -87,7 +91,6 @@ fun ToDoInfo( } else { BbangZipTheme.colors.statusDestructive_FF8345 } - Column(modifier = modifier) { Column(modifier = Modifier.padding(start = 4.dp)) { Text( @@ -97,7 +100,7 @@ fun ToDoInfo( data.examName ), style = BbangZipTheme.typography.caption2Medium, - color = BbangZipTheme.colors.labelAssistive_282119_28, + color = BbangZipTheme.colors.labelAssistive_282119_28.copy(alpha = infoOpacity), ) Spacer(modifier = Modifier.height(2.dp)) @@ -105,7 +108,7 @@ fun ToDoInfo( Text( text = data.studyContents, style = BbangZipTheme.typography.caption1Medium, - color = BbangZipTheme.colors.labelAlternative_282119_61, + color = BbangZipTheme.colors.labelAlternative_282119_61.copy(alpha = infoOpacity), ) Spacer(modifier = Modifier.height(4.dp)) @@ -117,7 +120,7 @@ fun ToDoInfo( data.finishPage ), style = BbangZipTheme.typography.label1Bold, - color = BbangZipTheme.colors.labelNormal_282119, + color = BbangZipTheme.colors.labelNormal_282119.copy(alpha = infoOpacity), ) } @@ -126,7 +129,7 @@ fun ToDoInfo( Row(verticalAlignment = Alignment.CenterVertically) { BbangZipChip( text = count + data.remainingDays, - backgroundColor = chipBackgroundColor, + backgroundColor = chipBackgroundColor.copy(alpha = infoOpacity), ) Spacer(modifier = Modifier.width(8.dp)) @@ -134,7 +137,7 @@ fun ToDoInfo( Text( text = stringResource(R.string.card_deadline_text, data.deadline), style = BbangZipTheme.typography.caption1Bold, - color = BbangZipTheme.colors.labelAlternative_282119_61, + color = BbangZipTheme.colors.labelAlternative_282119_61.copy(alpha = infoOpacity), ) } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt index f37232c..f1d47b2 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt @@ -5,6 +5,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import org.android.bbangzip.ui.theme.BbangZipTheme import org.android.bbangzip.ui.theme.defaultBbangZipColors +import org.android.bbangzip.ui.theme.defaultBbangZipOpacity enum class BbangZipCardType( val backgroundColor: Color, @@ -13,6 +14,7 @@ enum class BbangZipCardType( val radius: Dp = 24.dp, val shadowOptions: BbangZipShadowType = BbangZipShadowType.EMPTY, val checkBoxBackgroundColor: Color = defaultBbangZipColors.fillStrong_68645E_16, + val infoOpacity: Float = 1f ) { DEFAULT( backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, @@ -36,6 +38,7 @@ enum class BbangZipCardType( backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, borderColor = defaultBbangZipColors.lineAlternative_68645E_08, borderWidth = 1.dp, - checkBoxBackgroundColor = defaultBbangZipColors.secondaryNormal_FFCD80 + checkBoxBackgroundColor = defaultBbangZipColors.secondaryNormal_FFCD80, + infoOpacity = defaultBbangZipOpacity.opacity40 ), } diff --git a/app/src/main/java/org/android/bbangzip/ui/theme/Opacity.kt b/app/src/main/java/org/android/bbangzip/ui/theme/Opacity.kt index b713042..524768e 100644 --- a/app/src/main/java/org/android/bbangzip/ui/theme/Opacity.kt +++ b/app/src/main/java/org/android/bbangzip/ui/theme/Opacity.kt @@ -13,6 +13,7 @@ data class BbangZipOpacity( val opacity22: Float, val opacity28: Float, val opacity35: Float, + val opacity40 : Float, val opacity43: Float, val opacity52: Float, val opacity61: Float, @@ -32,6 +33,7 @@ val defaultBbangZipOpacity = opacity22 = 0.22f, opacity28 = 0.28f, opacity35 = 0.35f, + opacity40 = 0.40f, opacity43 = 0.43f, opacity52 = 0.52f, opacity61 = 0.61f, From 108819244d6f0bc6e6f4a831c3a34ce936a3f20f Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 15:40:03 +0900 Subject: [PATCH 23/29] =?UTF-8?q?[feat]=20#7=20applyPressedFilter=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EC=A6=88=20=ED=99=95=EC=9E=A5=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=A0=9C=EC=9E=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bbangzip/presentation/util/compose/ComposeExt.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/src/main/java/org/android/bbangzip/presentation/util/compose/ComposeExt.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/compose/ComposeExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/compose/ComposeExt.kt new file mode 100644 index 0000000..b94380f --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/util/compose/ComposeExt.kt @@ -0,0 +1,11 @@ +package org.android.bbangzip.presentation.util.compose + +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.compositeOver + +@Composable +fun applyPressedFilter(backgroundColor: Color): Color { + val filterColor = Color(0xFF282119).copy(alpha = 0.12f) + return filterColor.compositeOver(backgroundColor) +} \ No newline at end of file From cec1518bc1209c48d265ec26920b85b992a9a885 Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 15:48:32 +0900 Subject: [PATCH 24/29] =?UTF-8?q?[mod]=20#7=20applyPressedFilter=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EC=A6=88=20=ED=99=95=EC=9E=A5=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bbangzip/presentation/util/compose/ComposeExt.kt | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 app/src/main/java/org/android/bbangzip/presentation/util/compose/ComposeExt.kt diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/compose/ComposeExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/compose/ComposeExt.kt deleted file mode 100644 index b94380f..0000000 --- a/app/src/main/java/org/android/bbangzip/presentation/util/compose/ComposeExt.kt +++ /dev/null @@ -1,11 +0,0 @@ -package org.android.bbangzip.presentation.util.compose - -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.compositeOver - -@Composable -fun applyPressedFilter(backgroundColor: Color): Color { - val filterColor = Color(0xFF282119).copy(alpha = 0.12f) - return filterColor.compositeOver(backgroundColor) -} \ No newline at end of file From fadadd778f1631afd401d888d12142c01a6f2ed0 Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 16:30:26 +0900 Subject: [PATCH 25/29] =?UTF-8?q?[mod]=20#7=20applyFilterOnClick=20modifie?= =?UTF-8?q?r=20=ED=99=95=EC=9E=A5=ED=95=A8=EC=88=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/util/modifier/ModifierExt.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt index 0f47cd7..e31b8d4 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt @@ -1,16 +1,22 @@ package org.android.bbangzip.presentation.util.modifier import android.graphics.BlurMaskFilter +import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.interaction.collectIsPressedAsState +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.composed import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Paint import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.graphics.drawOutline import androidx.compose.ui.graphics.drawscope.drawIntoCanvas import androidx.compose.ui.semantics.Role @@ -34,6 +40,27 @@ fun Modifier.noRippleClickable( role = role, ) +fun Modifier.applyFilterOnClick( + baseColor: Color = Color.Transparent, + radius: Dp = 0.dp, + filterColor: Color = Color(0xFF282119).copy(alpha = 0.12f), + onClick: () -> Unit = {} +): Modifier = composed { + val finalFilteredColor = remember(baseColor, filterColor) { + filterColor.compositeOver(baseColor) + } + val interactionSource = remember { MutableInteractionSource() } + val isPressed by interactionSource.collectIsPressedAsState() + + this + .background(if (isPressed) finalFilteredColor else baseColor, shape = RoundedCornerShape(size = radius)) + .clickable( + interactionSource = interactionSource, + indication = null, // Ripple 제거 + onClick = { onClick() } + ) +} + @Composable fun Modifier.dropShadow( shape: Shape, From 75edb66b83cba791ff2fb84bcc1b3d2933037ee4 Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 17:10:15 +0900 Subject: [PATCH 26/29] =?UTF-8?q?[feat]=20#7=20applyFilterOnClick=20Card?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9=20,=20pressed=EC=8B=9C=20=EB=B0=B0?= =?UTF-8?q?=EA=B2=BD=EC=83=89=20=EB=B0=94=EB=80=9C=20,=20opacity=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/component/card/FriendCard.kt | 6 +- .../component/card/SubjectCard.kt | 68 ++++++++++--------- .../presentation/component/card/ToDoCard.kt | 51 +++++++++----- .../presentation/util/modifier/ModifierExt.kt | 4 +- app/src/main/res/values/strings.xml | 4 +- 5 files changed, 77 insertions(+), 56 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index 197771c..6d1cd87 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.android.bbangzip.R import org.android.bbangzip.presentation.model.card.FriendCardModel +import org.android.bbangzip.presentation.util.modifier.applyFilterOnClick import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme import org.android.bbangzip.ui.theme.BbangZipTheme @@ -57,8 +58,8 @@ fun FriendCard( color = state.getBackgroundColor(), shape = RoundedCornerShape(size = radius), ) + .applyFilterOnClick(baseColor = state.getBackgroundColor(), radius = radius) { onClick() } .padding(16.dp) - .clickable { onClick() }, ) { Row( modifier = Modifier.fillMaxWidth(), @@ -91,7 +92,6 @@ fun FriendCard( color = BbangZipTheme.colors.labelAlternative_282119_61, ) } - //TODO Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_menu_kebab_default_24), contentDescription = stringResource(R.string.card_friend_kebab_button_description), @@ -102,7 +102,7 @@ fun FriendCard( } } -@Preview(showBackground = true, name = "Friend Card Preview") +@Preview(showBackground = true) @Composable fun FriendCardPreview() { BBANGZIPTheme { diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index b5219bc..9100e14 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -2,7 +2,6 @@ package org.android.bbangzip.presentation.component.card import androidx.compose.foundation.background import androidx.compose.foundation.border -import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -27,6 +26,7 @@ import androidx.compose.ui.unit.dp import org.android.bbangzip.R import org.android.bbangzip.presentation.component.chip.BbangZipChip import org.android.bbangzip.presentation.model.card.SubjectCardModel +import org.android.bbangzip.presentation.util.modifier.applyFilterOnClick import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme import org.android.bbangzip.ui.theme.BbangZipTheme @@ -36,7 +36,6 @@ fun SubjectCard( state: BbangZipCardState, data: SubjectCardModel, onClick: () -> Unit = {}, - onActionIconClick: () -> Unit = {}, modifier: Modifier = Modifier, ) { val radius = state.getRadius() @@ -56,8 +55,11 @@ fun SubjectCard( color = state.getBackgroundColor(), shape = RoundedCornerShape(size = radius), ) + .applyFilterOnClick( + baseColor = state.getBackgroundColor(), + radius = radius + ) { onClick() } .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp) - .clickable { onClick() }, ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -65,16 +67,16 @@ fun SubjectCard( SubjectInfo( data = data, ) + Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_chevronright_thick_small_24), tint = BbangZipTheme.colors.labelAssistive_282119_28, contentDescription = stringResource(R.string.card_subject_button_description), - modifier = Modifier - .clickable { onActionIconClick() }, ) } } } + //TODO @Composable fun SubjectInfo( @@ -102,7 +104,7 @@ fun SubjectInfo( Spacer(modifier = Modifier.height(4.dp)) BbangZipChip( - text = (stringResource(R.string.card_d_minus_day,data.pendingCount)), + text = (stringResource(R.string.card_d_minus_day_text, data.pendingCount)), backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, ) @@ -137,9 +139,9 @@ fun BbangZipPushIcon( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp), + modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), @@ -166,40 +168,40 @@ fun SubjectCardPreview() { SubjectCard( state = BbangZipCardState.DEFAULT, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKED, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKABLE, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 515455b..6485cf8 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -2,7 +2,6 @@ package org.android.bbangzip.presentation.component.card import androidx.compose.foundation.background import androidx.compose.foundation.border -import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -27,15 +26,16 @@ import androidx.compose.ui.unit.dp import org.android.bbangzip.R import org.android.bbangzip.presentation.component.chip.BbangZipChip import org.android.bbangzip.presentation.model.card.ToDoCardModel +import org.android.bbangzip.presentation.util.modifier.applyFilterOnClick import org.android.bbangzip.presentation.util.modifier.applyShadows import org.android.bbangzip.ui.theme.BBANGZIPTheme -import org.android.bbangzip.ui.theme.BbangZipOpacity import org.android.bbangzip.ui.theme.BbangZipTheme @Composable fun ToDoCard( state: BbangZipCardState, data: ToDoCardModel, + isDeleted: Boolean = false, onClick: () -> Unit = {}, modifier: Modifier = Modifier, ) { @@ -58,8 +58,12 @@ fun ToDoCard( color = state.getBackgroundColor(), shape = RoundedCornerShape(size = radius), ) + .applyFilterOnClick( + baseColor = state.getBackgroundColor(), + isDisabled = isDeleted, + radius = radius + ) { if (!isDeleted) onClick() } .padding(horizontal = 16.dp, vertical = 10.dp) - .clickable { onClick() }, ) { Row( modifier = @@ -67,8 +71,11 @@ fun ToDoCard( .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, ) { - ToDoInfo(data = data, - infoOpacity = infoOpacity) + ToDoInfo( + data = data, + infoOpacity = infoOpacity, + isComplete = state == BbangZipCardState.COMPLETE + ) CheckSpace( backgroundColor = state.getCheckBoxBackgroundColor(), @@ -77,20 +84,28 @@ fun ToDoCard( } } } -//TODO + @Composable fun ToDoInfo( data: ToDoCardModel, infoOpacity: Float, + isComplete: Boolean, modifier: Modifier = Modifier, ) { - val count = if (data.remainingDays >= 0) "D+" else "D-" - val chipBackgroundColor = - if (data.remainingDays >= 0) { - BbangZipTheme.colors.labelAlternative_282119_61 - } else { - BbangZipTheme.colors.statusDestructive_FF8345 - } + fun getColor(baseColor: Color): Color { + return if (isComplete) baseColor.copy(alpha = infoOpacity) else baseColor + } + + val count = + if (data.remainingDays >= 0) stringResource(R.string.card_d_minus) + else stringResource(R.string.card_d_plus) + + val chipBackgroundColor = if (data.remainingDays >= 0) { + getColor(BbangZipTheme.colors.labelAlternative_282119_61) + } else { + getColor(BbangZipTheme.colors.statusDestructive_FF8345) + } + Column(modifier = modifier) { Column(modifier = Modifier.padding(start = 4.dp)) { Text( @@ -100,7 +115,7 @@ fun ToDoInfo( data.examName ), style = BbangZipTheme.typography.caption2Medium, - color = BbangZipTheme.colors.labelAssistive_282119_28.copy(alpha = infoOpacity), + color = getColor(BbangZipTheme.colors.labelAssistive_282119_28), ) Spacer(modifier = Modifier.height(2.dp)) @@ -108,7 +123,7 @@ fun ToDoInfo( Text( text = data.studyContents, style = BbangZipTheme.typography.caption1Medium, - color = BbangZipTheme.colors.labelAlternative_282119_61.copy(alpha = infoOpacity), + color = getColor(BbangZipTheme.colors.labelAlternative_282119_61), ) Spacer(modifier = Modifier.height(4.dp)) @@ -120,7 +135,7 @@ fun ToDoInfo( data.finishPage ), style = BbangZipTheme.typography.label1Bold, - color = BbangZipTheme.colors.labelNormal_282119.copy(alpha = infoOpacity), + color = getColor(BbangZipTheme.colors.labelNormal_282119), ) } @@ -129,7 +144,7 @@ fun ToDoInfo( Row(verticalAlignment = Alignment.CenterVertically) { BbangZipChip( text = count + data.remainingDays, - backgroundColor = chipBackgroundColor.copy(alpha = infoOpacity), + backgroundColor = chipBackgroundColor, ) Spacer(modifier = Modifier.width(8.dp)) @@ -137,7 +152,7 @@ fun ToDoInfo( Text( text = stringResource(R.string.card_deadline_text, data.deadline), style = BbangZipTheme.typography.caption1Bold, - color = BbangZipTheme.colors.labelAlternative_282119_61.copy(alpha = infoOpacity), + color = getColor(BbangZipTheme.colors.labelAlternative_282119_61), ) } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt index e31b8d4..c7e87ee 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt @@ -11,6 +11,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.composed +import androidx.compose.ui.contentcapture.ContentCaptureManager.Companion.isEnabled import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.Color @@ -43,6 +44,7 @@ fun Modifier.noRippleClickable( fun Modifier.applyFilterOnClick( baseColor: Color = Color.Transparent, radius: Dp = 0.dp, + isDisabled: Boolean = true, filterColor: Color = Color(0xFF282119).copy(alpha = 0.12f), onClick: () -> Unit = {} ): Modifier = composed { @@ -53,7 +55,7 @@ fun Modifier.applyFilterOnClick( val isPressed by interactionSource.collectIsPressedAsState() this - .background(if (isPressed) finalFilteredColor else baseColor, shape = RoundedCornerShape(size = radius)) + .background(if (isPressed && !isDisabled) finalFilteredColor else baseColor, shape = RoundedCornerShape(size = radius)) .clickable( interactionSource = interactionSource, indication = null, // Ripple 제거 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 211f70f..2e5e9ae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,8 +16,10 @@ 프로필 이미지입니다. 더보기 버튼입니다. 사장님 - D-%s + D-%s %s까지 %sp - %sp %s / %s + D+ + D- \ No newline at end of file From d2014eccf7c3ad3dbc8fd371d8054ddb35cc35a4 Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 17:11:26 +0900 Subject: [PATCH 27/29] =?UTF-8?q?[feat]=20#7=20ktlint=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/card/BbangZipCardState.kt | 2 +- .../presentation/component/card/FriendCard.kt | 4 +- .../component/card/SubjectCard.kt | 94 ++++----- .../presentation/component/card/ToDoCard.kt | 197 +++++++++--------- .../presentation/type/BbangZipCardType.kt | 5 +- .../presentation/util/modifier/ModifierExt.kt | 33 +-- .../org/android/bbangzip/ui/theme/Opacity.kt | 2 +- 7 files changed, 171 insertions(+), 166 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt index e77cb32..3bc15d7 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/BbangZipCardState.kt @@ -39,4 +39,4 @@ fun BbangZipCardState.getShadowOptions(): BbangZipShadowType = stateToTypeMap[th fun BbangZipCardState.getCheckBoxBackgroundColor(): Color = stateToTypeMap[this]?.checkBoxBackgroundColor ?: Color.Transparent -fun BbangZipCardState.getInfoOpacity(): Float = stateToTypeMap[this]?.infoOpacity ?: 1f \ No newline at end of file +fun BbangZipCardState.getInfoOpacity(): Float = stateToTypeMap[this]?.infoOpacity ?: 1f diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index 6d1cd87..51e6380 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -58,8 +58,8 @@ fun FriendCard( color = state.getBackgroundColor(), shape = RoundedCornerShape(size = radius), ) - .applyFilterOnClick(baseColor = state.getBackgroundColor(), radius = radius) { onClick() } - .padding(16.dp) + .applyFilterOnClick(baseColor = state.getBackgroundColor(), radius = radius) { onClick() } + .padding(16.dp), ) { Row( modifier = Modifier.fillMaxWidth(), diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index 9100e14..c7fc6aa 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -41,25 +41,25 @@ fun SubjectCard( val radius = state.getRadius() Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(radius), - ) - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .applyFilterOnClick( - baseColor = state.getBackgroundColor(), - radius = radius - ) { onClick() } - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp) + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .applyFilterOnClick( + baseColor = state.getBackgroundColor(), + radius = radius, + ) { onClick() } + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -77,7 +77,7 @@ fun SubjectCard( } } -//TODO +// TODO @Composable fun SubjectInfo( data: SubjectCardModel, @@ -139,9 +139,9 @@ fun BbangZipPushIcon( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp), + modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), @@ -168,40 +168,40 @@ fun SubjectCardPreview() { SubjectCard( state = BbangZipCardState.DEFAULT, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKED, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKABLE, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 6485cf8..67a3446 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -43,43 +43,43 @@ fun ToDoCard( val infoOpacity = state.getInfoOpacity() Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(size = radius), - ) - .fillMaxWidth() - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .applyFilterOnClick( - baseColor = state.getBackgroundColor(), - isDisabled = isDeleted, - radius = radius - ) { if (!isDeleted) onClick() } - .padding(horizontal = 16.dp, vertical = 10.dp) + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(size = radius), + ) + .fillMaxWidth() + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .applyFilterOnClick( + baseColor = state.getBackgroundColor(), + isDisabled = isDeleted, + radius = radius, + ) { if (!isDeleted) onClick() } + .padding(horizontal = 16.dp, vertical = 10.dp), ) { Row( modifier = - Modifier - .fillMaxWidth(), + Modifier + .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, ) { ToDoInfo( data = data, infoOpacity = infoOpacity, - isComplete = state == BbangZipCardState.COMPLETE + isComplete = state == BbangZipCardState.COMPLETE, ) CheckSpace( backgroundColor = state.getCheckBoxBackgroundColor(), - isCompleted = state == BbangZipCardState.COMPLETE + isCompleted = state == BbangZipCardState.COMPLETE, ) } } @@ -97,23 +97,28 @@ fun ToDoInfo( } val count = - if (data.remainingDays >= 0) stringResource(R.string.card_d_minus) - else stringResource(R.string.card_d_plus) + if (data.remainingDays >= 0) { + stringResource(R.string.card_d_minus) + } else { + stringResource(R.string.card_d_plus) + } - val chipBackgroundColor = if (data.remainingDays >= 0) { - getColor(BbangZipTheme.colors.labelAlternative_282119_61) - } else { - getColor(BbangZipTheme.colors.statusDestructive_FF8345) - } + val chipBackgroundColor = + if (data.remainingDays >= 0) { + getColor(BbangZipTheme.colors.labelAlternative_282119_61) + } else { + getColor(BbangZipTheme.colors.statusDestructive_FF8345) + } Column(modifier = modifier) { Column(modifier = Modifier.padding(start = 4.dp)) { Text( - text = stringResource( - R.string.card_subject_exam_name_text, - data.subjectName, - data.examName - ), + text = + stringResource( + R.string.card_subject_exam_name_text, + data.subjectName, + data.examName, + ), style = BbangZipTheme.typography.caption2Medium, color = getColor(BbangZipTheme.colors.labelAssistive_282119_28), ) @@ -129,11 +134,12 @@ fun ToDoInfo( Spacer(modifier = Modifier.height(4.dp)) Text( - text = stringResource( - R.string.card_start_end_day_text, - data.startPage, - data.finishPage - ), + text = + stringResource( + R.string.card_start_end_day_text, + data.startPage, + data.finishPage, + ), style = BbangZipTheme.typography.label1Bold, color = getColor(BbangZipTheme.colors.labelNormal_282119), ) @@ -167,11 +173,10 @@ fun CheckSpace( Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) - .height(32.dp) - .width(32.dp) - + modifier + .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) + .height(32.dp) + .width(32.dp), // TODO 여기 어떤식으로 기기대응하는지 물어보기 ) { if (isCompleted) { @@ -184,7 +189,7 @@ fun CheckSpace( } } -//TODO +// TODO @Preview(showBackground = true) @Composable fun ToDoCardPreview() { @@ -193,70 +198,70 @@ fun ToDoCardPreview() { ToDoCard( state = BbangZipCardState.DEFAULT, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( state = BbangZipCardState.CHECKABLE, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( state = BbangZipCardState.CHECKED, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) ToDoCard( state = BbangZipCardState.COMPLETE, data = - ToDoCardModel( - subjectName = "경제통계학개론", - examName = "중간고사", - studyContents = "경제통계학", - startPage = 36, - finishPage = 60, - deadline = "2025년 4월 25일", - pieceId = "1", - remainingDays = 1, - ), + ToDoCardModel( + subjectName = "경제통계학개론", + examName = "중간고사", + studyContents = "경제통계학", + startPage = 36, + finishPage = 60, + deadline = "2025년 4월 25일", + pieceId = "1", + remainingDays = 1, + ), modifier = - Modifier - .padding(16.dp), + Modifier + .padding(16.dp), ) } } diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt index f1d47b2..e5e9cbc 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt @@ -3,7 +3,6 @@ package org.android.bbangzip.presentation.type import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import org.android.bbangzip.ui.theme.BbangZipTheme import org.android.bbangzip.ui.theme.defaultBbangZipColors import org.android.bbangzip.ui.theme.defaultBbangZipOpacity @@ -14,7 +13,7 @@ enum class BbangZipCardType( val radius: Dp = 24.dp, val shadowOptions: BbangZipShadowType = BbangZipShadowType.EMPTY, val checkBoxBackgroundColor: Color = defaultBbangZipColors.fillStrong_68645E_16, - val infoOpacity: Float = 1f + val infoOpacity: Float = 1f, ) { DEFAULT( backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, @@ -39,6 +38,6 @@ enum class BbangZipCardType( borderColor = defaultBbangZipColors.lineAlternative_68645E_08, borderWidth = 1.dp, checkBoxBackgroundColor = defaultBbangZipColors.secondaryNormal_FFCD80, - infoOpacity = defaultBbangZipOpacity.opacity40 + infoOpacity = defaultBbangZipOpacity.opacity40, ), } diff --git a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt index c7e87ee..1349110 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/util/modifier/ModifierExt.kt @@ -11,7 +11,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.composed -import androidx.compose.ui.contentcapture.ContentCaptureManager.Companion.isEnabled import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.Color @@ -46,22 +45,24 @@ fun Modifier.applyFilterOnClick( radius: Dp = 0.dp, isDisabled: Boolean = true, filterColor: Color = Color(0xFF282119).copy(alpha = 0.12f), - onClick: () -> Unit = {} -): Modifier = composed { - val finalFilteredColor = remember(baseColor, filterColor) { - filterColor.compositeOver(baseColor) - } - val interactionSource = remember { MutableInteractionSource() } - val isPressed by interactionSource.collectIsPressedAsState() + onClick: () -> Unit = {}, +): Modifier = + composed { + val finalFilteredColor = + remember(baseColor, filterColor) { + filterColor.compositeOver(baseColor) + } + val interactionSource = remember { MutableInteractionSource() } + val isPressed by interactionSource.collectIsPressedAsState() - this - .background(if (isPressed && !isDisabled) finalFilteredColor else baseColor, shape = RoundedCornerShape(size = radius)) - .clickable( - interactionSource = interactionSource, - indication = null, // Ripple 제거 - onClick = { onClick() } - ) -} + this + .background(if (isPressed && !isDisabled) finalFilteredColor else baseColor, shape = RoundedCornerShape(size = radius)) + .clickable( + interactionSource = interactionSource, + indication = null, + onClick = { onClick() }, + ) + } @Composable fun Modifier.dropShadow( diff --git a/app/src/main/java/org/android/bbangzip/ui/theme/Opacity.kt b/app/src/main/java/org/android/bbangzip/ui/theme/Opacity.kt index 524768e..51da2ec 100644 --- a/app/src/main/java/org/android/bbangzip/ui/theme/Opacity.kt +++ b/app/src/main/java/org/android/bbangzip/ui/theme/Opacity.kt @@ -13,7 +13,7 @@ data class BbangZipOpacity( val opacity22: Float, val opacity28: Float, val opacity35: Float, - val opacity40 : Float, + val opacity40: Float, val opacity43: Float, val opacity52: Float, val opacity61: Float, From 045562d5856ef970c5ea96dcfba9a9f3e3dcb73e Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 23:12:33 +0900 Subject: [PATCH 28/29] =?UTF-8?q?[feat]=20#7=20=EA=B0=80=EB=A1=9C=20?= =?UTF-8?q?=EA=B8=B0=EA=B8=B0=EB=8C=80=EC=9D=91=20subjectCard=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 --- .../component/card/SubjectCard.kt | 104 ++++++++++-------- .../presentation/type/BbangZipCardType.kt | 6 +- 2 files changed, 59 insertions(+), 51 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index c7fc6aa..febbe01 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -7,6 +7,7 @@ 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.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width @@ -19,6 +20,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview @@ -39,33 +41,37 @@ fun SubjectCard( modifier: Modifier = Modifier, ) { val radius = state.getRadius() + val width = (LocalConfiguration.current.screenWidthDp - 48) / 2 Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(radius), - ) - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .applyFilterOnClick( - baseColor = state.getBackgroundColor(), - radius = radius, - ) { onClick() } - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .width(width = width.dp) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .applyFilterOnClick( + baseColor = state.getBackgroundColor(), + radius = radius, + ) { onClick() } + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, + modifier = Modifier.fillMaxWidth() ) { SubjectInfo( data = data, + modifier = Modifier.weight(1f) ) Icon( @@ -77,7 +83,6 @@ fun SubjectCard( } } -// TODO @Composable fun SubjectInfo( data: SubjectCardModel, @@ -135,13 +140,16 @@ fun BbangZipPushIcon( text: String, modifier: Modifier = Modifier, ) { - Row(verticalAlignment = Alignment.CenterVertically) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = modifier + ) { Box( contentAlignment = Alignment.Center, modifier = - modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp), + Modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), @@ -168,40 +176,40 @@ fun SubjectCardPreview() { SubjectCard( state = BbangZipCardState.DEFAULT, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKED, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKABLE, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] ", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt index e5e9cbc..47c23db 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipCardType.kt @@ -19,19 +19,19 @@ enum class BbangZipCardType( backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, borderColor = defaultBbangZipColors.lineAlternative_68645E_08, borderWidth = 1.dp, - shadowOptions = BbangZipShadowType.Emphasize, + shadowOptions = BbangZipShadowType.EMPHASIZE, ), CHECKABLE( backgroundColor = defaultBbangZipColors.backgroundAlternative_F5F5F5, borderColor = defaultBbangZipColors.lineAlternative_68645E_08, borderWidth = 1.dp, - shadowOptions = BbangZipShadowType.Strong, + shadowOptions = BbangZipShadowType.STRONG, ), CHECKED( backgroundColor = defaultBbangZipColors.backgroundAlternative_F5F5F5, borderColor = defaultBbangZipColors.lineStrong_68645E_52, borderWidth = 3.dp, - shadowOptions = BbangZipShadowType.Emphasize, + shadowOptions = BbangZipShadowType.EMPHASIZE, ), COMPLETE( backgroundColor = defaultBbangZipColors.backgroundNormal_FFFFFF, From 8656a321c7ba0a579fd741269333e7495f8df8f9 Mon Sep 17 00:00:00 2001 From: beom84 Date: Wed, 15 Jan 2025 23:20:25 +0900 Subject: [PATCH 29/29] =?UTF-8?q?[feat]=20#7=20ktlint=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/component/card/FriendCard.kt | 2 +- .../component/card/SubjectCard.kt | 102 +++++++++--------- .../presentation/component/card/ToDoCard.kt | 4 +- 3 files changed, 53 insertions(+), 55 deletions(-) diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt index 51e6380..2eee1fb 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/FriendCard.kt @@ -36,9 +36,9 @@ import org.android.bbangzip.ui.theme.BbangZipTheme fun FriendCard( state: BbangZipCardState, data: FriendCardModel, + modifier: Modifier = Modifier, onClick: () -> Unit = {}, onActionIconClick: () -> Unit = {}, - modifier: Modifier = Modifier, ) { val radius = state.getRadius() Box( diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt index febbe01..70f0136 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/SubjectCard.kt @@ -37,41 +37,41 @@ import org.android.bbangzip.ui.theme.BbangZipTheme fun SubjectCard( state: BbangZipCardState, data: SubjectCardModel, - onClick: () -> Unit = {}, modifier: Modifier = Modifier, + onClick: () -> Unit = {}, ) { val radius = state.getRadius() val width = (LocalConfiguration.current.screenWidthDp - 48) / 2 Box( modifier = - modifier - .applyShadows( - shadowType = state.getShadowOptions(), - shape = RoundedCornerShape(radius), - ) - .border( - width = state.getBorderWidth(), - color = state.getBorderColor(), - shape = RoundedCornerShape(size = radius), - ) - .width(width = width.dp) - .background( - color = state.getBackgroundColor(), - shape = RoundedCornerShape(size = radius), - ) - .applyFilterOnClick( - baseColor = state.getBackgroundColor(), - radius = radius, - ) { onClick() } - .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), + modifier + .applyShadows( + shadowType = state.getShadowOptions(), + shape = RoundedCornerShape(radius), + ) + .border( + width = state.getBorderWidth(), + color = state.getBorderColor(), + shape = RoundedCornerShape(size = radius), + ) + .width(width = width.dp) + .background( + color = state.getBackgroundColor(), + shape = RoundedCornerShape(size = radius), + ) + .applyFilterOnClick( + baseColor = state.getBackgroundColor(), + radius = radius, + ) { onClick() } + .padding(end = 8.dp, start = 16.dp, top = 16.dp, bottom = 16.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) { SubjectInfo( data = data, - modifier = Modifier.weight(1f) + modifier = Modifier.weight(1f), ) Icon( @@ -142,14 +142,14 @@ fun BbangZipPushIcon( ) { Row( verticalAlignment = Alignment.CenterVertically, - modifier = modifier + modifier = modifier, ) { Box( contentAlignment = Alignment.Center, modifier = - Modifier - .background(color = backgroundColor, shape = CircleShape) - .padding(horizontal = 6.dp, vertical = 3.dp), + Modifier + .background(color = backgroundColor, shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), ) { Text( text = count.toString(), @@ -176,40 +176,40 @@ fun SubjectCardPreview() { SubjectCard( state = BbangZipCardState.DEFAULT, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKED, data = - SubjectCardModel( - subjectName = "[경영] 경제통계학", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] 경제통계학", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) SubjectCard( state = BbangZipCardState.CHECKABLE, data = - SubjectCardModel( - subjectName = "[경영] ", - examName = "중간고사", - pendingCount = 0, - inProgressCount = 6, - subjectId = 1, - examRemainingDays = 1, - ), + SubjectCardModel( + subjectName = "[경영] ", + examName = "중간고사", + pendingCount = 0, + inProgressCount = 6, + subjectId = 1, + examRemainingDays = 1, + ), modifier = Modifier.padding(16.dp), ) } diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt index 67a3446..fa0929d 100644 --- a/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt +++ b/app/src/main/java/org/android/bbangzip/presentation/component/card/ToDoCard.kt @@ -35,9 +35,9 @@ import org.android.bbangzip.ui.theme.BbangZipTheme fun ToDoCard( state: BbangZipCardState, data: ToDoCardModel, + modifier: Modifier = Modifier, isDeleted: Boolean = false, onClick: () -> Unit = {}, - modifier: Modifier = Modifier, ) { val radius = state.getRadius() val infoOpacity = state.getInfoOpacity() @@ -177,7 +177,6 @@ fun CheckSpace( .background(color = backgroundColor, shape = RoundedCornerShape(12.dp)) .height(32.dp) .width(32.dp), - // TODO 여기 어떤식으로 기기대응하는지 물어보기 ) { if (isCompleted) { Icon( @@ -189,7 +188,6 @@ fun CheckSpace( } } -// TODO @Preview(showBackground = true) @Composable fun ToDoCardPreview() {