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 0a735541..04de6a28 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 @@ -11,14 +11,12 @@ 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.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.platform.LocalConfiguration import androidx.compose.ui.res.stringResource @@ -28,6 +26,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.android.bbangzip.R import org.android.bbangzip.presentation.component.chip.BbangZipChip +import org.android.bbangzip.presentation.component.pushicon.BbangZipPushIconWithText import org.android.bbangzip.presentation.model.card.SubjectCardModel import org.android.bbangzip.presentation.util.modifier.applyFilterOnClick import org.android.bbangzip.presentation.util.modifier.applyShadows @@ -121,7 +120,7 @@ fun SubjectInfo( Spacer(modifier = Modifier.height(44.dp)) Column { - BbangZipPushIcon( + BbangZipPushIconWithText( backgroundColor = BbangZipTheme.colors.statusDestructive_FF8345, count = data.pendingCount, text = stringResource(R.string.card_subject_pending_icon_description), @@ -129,7 +128,7 @@ fun SubjectInfo( Spacer(modifier = Modifier.height(4.dp)) - BbangZipPushIcon( + BbangZipPushIconWithText( backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, count = data.inProgressCount, text = stringResource(R.string.card_subject_studying_icon_description), @@ -138,41 +137,6 @@ fun SubjectInfo( } } -@Composable -fun BbangZipPushIcon( - backgroundColor: Color, - count: Int, - text: String, - modifier: Modifier = Modifier, -) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = modifier, - ) { - 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() { diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/BbangZipBasicProgressBar.kt b/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/BbangZipBasicProgressBar.kt new file mode 100644 index 00000000..803684cd --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/BbangZipBasicProgressBar.kt @@ -0,0 +1,60 @@ +package org.android.bbangzip.presentation.component.progressbar + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.android.bbangzip.ui.theme.BbangZipTheme + +@Composable +fun BbangZipBasicProgressBar( + progress: Float, + modifier: Modifier = Modifier, + backgroundColor: Color = BbangZipTheme.colors.fillStrong_68645E_16, + progressColor: Color = BbangZipTheme.colors.labelNormal_282119, + clipShape: Shape = RoundedCornerShape(4.dp), +) { + Box( + modifier = + modifier + .clip(clipShape) + .background(backgroundColor) + .height(8.dp) + .fillMaxWidth(), + ) { + Box( + modifier = + Modifier + .clip(clipShape) + .background(progressColor) + .fillMaxHeight() + .fillMaxWidth(progress), + ) + } +} + +@Preview(showBackground = true) +@Composable +fun BbangZipProgressBarPreview() { + Column( + modifier = + Modifier + .background(color = Color.Gray) + .fillMaxSize(), + ) { + BbangZipBasicProgressBar( + progress = 0.5f, + ) + } +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/BbangZipLevelProgressBar.kt b/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/BbangZipLevelProgressBar.kt new file mode 100644 index 00000000..6c2e9a32 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/BbangZipLevelProgressBar.kt @@ -0,0 +1,116 @@ +package org.android.bbangzip.presentation.component.progressbar + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.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.stringResource +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.chip.BbangZipChip +import org.android.bbangzip.presentation.type.BbangZipLevelType +import org.android.bbangzip.ui.theme.BBANGZIPTheme +import org.android.bbangzip.ui.theme.BbangZipTheme + +@Composable +fun BbangZipLevelProgressBar( + level: Int, + currentPoint: Int, + modifier: Modifier = Modifier, +) { + val levelType = BbangZipLevelType.entries[level - 1] + + Column( + modifier = modifier, + ) { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically, + ) { + Row { + BbangZipChip( + backgroundColor = BbangZipTheme.colors.statusPositive_3D3730, + text = stringResource(R.string.progressbar_chip_level, level.toString()), + ) + + Spacer(modifier = Modifier.padding(8.dp)) + + Text( + text = levelType.bbangZipName, + style = BbangZipTheme.typography.body1Bold, + color = BbangZipTheme.colors.labelNormal_282119, + ) + } + + BbangZipPoint( + currentPoint = currentPoint.toString(), + totalPoint = levelType.bbangZipLevelPoint.toString(), + ) + } + + Spacer(Modifier.height(4.dp)) + + BbangZipBasicProgressBar( + progress = currentPoint.toFloat() / levelType.bbangZipLevelPoint.toFloat(), + ) + } +} + +@Composable +private fun BbangZipPoint( + modifier: Modifier = Modifier, + currentPoint: String, + totalPoint: String, +) { + Row( + modifier = modifier, + horizontalArrangement = Arrangement.Start, + verticalAlignment = Alignment.CenterVertically, + ) { + Icon( + imageVector = ImageVector.vectorResource(R.drawable.ic_trophy_default_24), + contentDescription = stringResource(R.string.bbangzip_trophy_description), + tint = BbangZipTheme.colors.labelAlternative_282119_61, + ) + + Text( + text = stringResource(R.string.bbangzip_level_point, currentPoint, totalPoint), + modifier = Modifier.padding(start = 1.dp), + style = BbangZipTheme.typography.label2Medium, + color = BbangZipTheme.colors.labelAlternative_282119_61, + ) + } +} + +@Preview(showBackground = true) +@Composable +fun BbangZipLevelProgressBarPreview() { + BBANGZIPTheme { + Column( + modifier = + Modifier + .background(Color.Yellow) + .fillMaxSize(), + ) { + BbangZipLevelProgressBar( + level = 1, + currentPoint = 50, + ) + } + } +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/OnboardingProgressBar.kt b/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/OnboardingProgressBar.kt new file mode 100644 index 00000000..9c6c7ca6 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/progressbar/OnboardingProgressBar.kt @@ -0,0 +1,74 @@ +package org.android.bbangzip.presentation.component.progressbar + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +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.pushicon.BbangZipPushIcon +import org.android.bbangzip.presentation.model.BbangZipPushIconState +import org.android.bbangzip.presentation.type.OnboardingType +import org.android.bbangzip.ui.theme.BbangZipTheme + +@Composable +fun OnboardingProgressBar( + onboardingType: OnboardingType, + modifier: Modifier = Modifier, +) { + val currentPage = onboardingType.ordinal + 1 + val progress = + when (onboardingType) { + OnboardingType.FIRST -> 0.04f + OnboardingType.SECOND -> 0.5f + OnboardingType.THIRD -> 1f + } + + Column(modifier = modifier) { + Row( + horizontalArrangement = Arrangement.SpaceBetween, + modifier = Modifier.fillMaxWidth(), + ) { + OnboardingType.entries.forEachIndexed { index, _ -> + val state = + if (index < currentPage) { + BbangZipPushIconState.Positive + } else { + BbangZipPushIconState.Disable + } + + BbangZipPushIcon( + pushIconText = (index + 1).toString(), + bbangZipPushIconState = state, + ) + } + } + } + + Spacer(modifier = Modifier.height(8.dp)) + + BbangZipBasicProgressBar( + progress = progress, + backgroundColor = BbangZipTheme.colors.fillStrong_68645E_16, + ) +} + +@Preview(showBackground = true) +@Composable +fun OnboardingProgressBarPreview() { + val testPages = listOf(0, 1, 2) + + Column { + testPages.forEach { currentPage -> + OnboardingProgressBar( + onboardingType = OnboardingType.entries[currentPage], + ) + + Spacer(modifier = Modifier.height(8.dp)) + } + } +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/pushicon/BbangZipPushIcon.kt b/app/src/main/java/org/android/bbangzip/presentation/component/pushicon/BbangZipPushIcon.kt new file mode 100644 index 00000000..75c98855 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/pushicon/BbangZipPushIcon.kt @@ -0,0 +1,56 @@ +package org.android.bbangzip.presentation.component.pushicon + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.android.bbangzip.presentation.model.BbangZipPushIconState +import org.android.bbangzip.presentation.model.getBackgroundColor +import org.android.bbangzip.ui.theme.BBANGZIPTheme +import org.android.bbangzip.ui.theme.BbangZipTheme + +@Composable +fun BbangZipPushIcon( + modifier: Modifier = Modifier, + pushIconText: String, + bbangZipPushIconState: BbangZipPushIconState = BbangZipPushIconState.Disable, +) { + Box( + contentAlignment = Alignment.Center, + modifier = + modifier + .background(color = bbangZipPushIconState.getBackgroundColor(), shape = CircleShape) + .padding(horizontal = 6.dp, vertical = 3.dp), + ) { + Text( + text = pushIconText, + style = BbangZipTheme.typography.caption2Bold, + color = BbangZipTheme.colors.staticWhite_FFFFFF, + ) + } +} + +@Preview(showBackground = true) +@Composable +private fun BbangZipPushIconPreview() { + BBANGZIPTheme { + Row { + BbangZipPushIcon( + pushIconText = "1", + bbangZipPushIconState = BbangZipPushIconState.Positive, + ) + + BbangZipPushIcon( + pushIconText = "2", + bbangZipPushIconState = BbangZipPushIconState.Disable, + ) + } + } +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/component/pushicon/BbangZipPushIconWithText.kt b/app/src/main/java/org/android/bbangzip/presentation/component/pushicon/BbangZipPushIconWithText.kt new file mode 100644 index 00000000..0401b488 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/component/pushicon/BbangZipPushIconWithText.kt @@ -0,0 +1,51 @@ +package org.android.bbangzip.presentation.component.pushicon + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.shape.CircleShape +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.unit.dp +import org.android.bbangzip.ui.theme.BbangZipTheme + +@Composable +fun BbangZipPushIconWithText( + backgroundColor: Color, + count: Int, + text: String, + modifier: Modifier = Modifier, +) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = modifier, + ) { + 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, + ) + } +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/model/BbangZipPushIconState.kt b/app/src/main/java/org/android/bbangzip/presentation/model/BbangZipPushIconState.kt new file mode 100644 index 00000000..b1e85998 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/model/BbangZipPushIconState.kt @@ -0,0 +1,27 @@ +package org.android.bbangzip.presentation.model + +import android.os.Parcelable +import androidx.compose.ui.graphics.Color +import kotlinx.parcelize.Parcelize +import org.android.bbangzip.presentation.type.PushIconType + +@Parcelize +sealed class BbangZipPushIconState : Parcelable { + data object Positive : BbangZipPushIconState() + + data object Disable : BbangZipPushIconState() +} + +private val stateToTypeMap = + mapOf( + BbangZipPushIconState.Positive to PushIconType.POSITIVE, + BbangZipPushIconState.Disable to PushIconType.DISABLE, + ) + +fun BbangZipPushIconState.getBackgroundColor(): Color { + return stateToTypeMap[this]?.backgroundColor ?: Color.Transparent +} + +fun BbangZipPushIconState.getTextColor(): Color { + return stateToTypeMap[this]?.textColor ?: Color.Transparent +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipLevelType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipLevelType.kt new file mode 100644 index 00000000..13710d53 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/BbangZipLevelType.kt @@ -0,0 +1,28 @@ +package org.android.bbangzip.presentation.type + +enum class BbangZipLevelType( + val bbangZipName: String, + val bbangZipImg: String, + val bbangZipDescription: String, + val bbangZipLevelPoint: Int, +) { + // TODO 결정된 레벨 타입에 따라 String 추출 + LEVEL1( + bbangZipName = "돗자리", + bbangZipImg = "https://thumbnail8.coupangcdn.com/thumbnails/remote/492x492ex/image/vendor_inventory/ffe8/2a8662f3a23e240506209ff00b716729ef4240b7089129c1209ec06a4513.png", + bbangZipDescription = "빵집을 시작한지 얼마 안된\n사장님의 첫 빵집이에요", + bbangZipLevelPoint = 200, + ), + LEVEL2( + bbangZipName = "가판대", + bbangZipImg = "https://w7.pngwing.com/pngs/355/333/png-transparent-coffee-shop-store-drawing-cartoon-food-stall-shop-shopping-market-thumbnail.png", + bbangZipDescription = "열심히 노력해서 가판대가 생겼군요\n 사장님의 열정을 응원해요!", + bbangZipLevelPoint = 300, + ), + LEVEL3( + bbangZipName = "진짜 빵집", + bbangZipImg = "https://cdn-icons-png.flaticon.com/512/5223/5223875.png", + bbangZipDescription = "레전드 빵집차렸네 너 쩐다 ㄷㄷ", + bbangZipLevelPoint = 400, + ), +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/OnboardingType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/OnboardingType.kt new file mode 100644 index 00000000..26e35552 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/OnboardingType.kt @@ -0,0 +1,21 @@ +package org.android.bbangzip.presentation.type + +import androidx.annotation.StringRes +import org.android.bbangzip.R + +enum class OnboardingType( + @StringRes val title: Int, + @StringRes val description: Int? = null, +) { + FIRST( + title = R.string.onboarding_first_title, + ), + SECOND( + title = R.string.onboarding_second_title, + description = R.string.onboarding_second_description, + ), + THIRD( + title = R.string.onboarding_third_title, + description = R.string.onboarding_third_description, + ), +} diff --git a/app/src/main/java/org/android/bbangzip/presentation/type/PushIconType.kt b/app/src/main/java/org/android/bbangzip/presentation/type/PushIconType.kt new file mode 100644 index 00000000..2e120b03 --- /dev/null +++ b/app/src/main/java/org/android/bbangzip/presentation/type/PushIconType.kt @@ -0,0 +1,18 @@ +package org.android.bbangzip.presentation.type + +import androidx.compose.ui.graphics.Color +import org.android.bbangzip.ui.theme.defaultBbangZipColors + +enum class PushIconType( + val backgroundColor: Color, + val textColor: Color, +) { + POSITIVE( + backgroundColor = defaultBbangZipColors.statusPositive_3D3730, + textColor = defaultBbangZipColors.staticWhite_FFFFFF, + ), + DISABLE( + backgroundColor = defaultBbangZipColors.fillAlternative_68645E_05, + textColor = defaultBbangZipColors.labelDisable_282119_12, + ), +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2e5e9ae3..3760fad4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -22,4 +22,19 @@ %s / %s D+ D- + + + Lv %s + 가판대 + 가판대 + 가판대 + %s/%s + This is a point icon that tells you the current bakery level. + + + 사장님의 이름을\n알려주세요 + 현재 재학 중인\n학기를 알려주세요 + %s 사장님, 안녕하세요! + 수강하는 과목 중 한 가지만 먼저 입력해 볼까요? + >%s %s에 재학 중이시네요! \ No newline at end of file