Skip to content

Commit

Permalink
Merge branch 'develop' into feat/dashboard-bottom-sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Feb 14, 2025
2 parents d97ba84 + 15e478b commit 92c11cd
Show file tree
Hide file tree
Showing 30 changed files with 388 additions and 130 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ dependencies {
implementation(projects.core.designsystem)
implementation(projects.core.model)
implementation(projects.core.notifications)
implementation(projects.core.ui)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/kotlin/com/chipichipi/dobedobe/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package com.chipichipi.dobedobe
import android.content.pm.ActivityInfo
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
Expand All @@ -28,7 +31,12 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT.also { requestedOrientation = it }

enableEdgeToEdge()
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.light(
Color.Transparent.toArgb(),
Color.Transparent.toArgb(),
),
)

lifecycleScope.launch {
lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
package com.chipichipi.dobedobe.onboarding

import androidx.compose.foundation.layout.Column
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.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.chipichipi.dobedobe.R
import com.chipichipi.dobedobe.core.designsystem.component.DobeDobeTextButton
import com.chipichipi.dobedobe.core.designsystem.theme.DobeDobeTheme
import com.chipichipi.dobedobe.core.model.CharacterType
import com.chipichipi.dobedobe.core.ui.SelectCharacterScreen
import org.koin.androidx.compose.koinViewModel

@Composable
Expand All @@ -27,60 +18,17 @@ internal fun OnboardingSelectCharacterRoute(
) {
val selectedCharacter by viewModel.selectedCharacter.collectAsStateWithLifecycle()

OnboardingSelectCharacterScreen(
modifier = modifier,
SelectCharacterScreen(
selectedCharacter = selectedCharacter,
onCharacterToggled = viewModel::toggleCharacter,
onOnboardingCompleted = viewModel::completeOnboarding,
)
}

@Composable
private fun OnboardingSelectCharacterScreen(
selectedCharacter: CharacterType,
onCharacterToggled: () -> Unit,
onOnboardingCompleted: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
onCompleted = viewModel::completeOnboarding,
buttonText = R.string.onboarding_all_completed,
modifier = modifier
.fillMaxSize()
.padding(horizontal = 24.dp)
.padding(
top = 48.dp,
bottom = 32.dp,
),
) {
Text(
text = stringResource(R.string.onboarding_select_character_title),
style = DobeDobeTheme.typography.heading1,
color = DobeDobeTheme.colors.black,
)
Spacer(modifier = Modifier.height(48.dp))

OnboardingBirdCard(
selected = selectedCharacter == CharacterType.Bird,
onClick = onCharacterToggled,
)
Spacer(modifier = Modifier.height(32.dp))

OnboardingRabbitCard(
selected = selectedCharacter == CharacterType.Rabbit,
onClick = onCharacterToggled,
)
Spacer(modifier = Modifier.weight(1f))

DobeDobeTextButton(
modifier = Modifier
.fillMaxWidth()
.heightIn(56.dp),
onClick = onOnboardingCompleted,
) {
Text(
text = stringResource(R.string.onboarding_all_complete),
style = DobeDobeTheme.typography.heading2,
color = DobeDobeTheme.colors.white,
)
}
}
)
}
6 changes: 1 addition & 5 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@
<string name="onboarding_goal_hint">ex) Read 1 book per day</string>
<string name="onboarding_goal_support_message">The simpler the goal, the better the focus.</string>
<string name="onboarding_goal_completed">Complete</string>

<string name="onboarding_select_character_title">함께 할 러닝메이트를\n선택해 주세요</string>
<string name="onboarding_all_complete">시작하기</string>
<string name="onboarding_bird_character_description">마구 쪼는 잔소리무새</string>
<string name="onboarding_rabbit_character_description">공감 만점 럭키 토끼</string>
<string name="onboarding_all_completed">Start</string>
</resources>
6 changes: 1 addition & 5 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,5 @@
<string name="onboarding_goal_hint">ex) 1일 1책 읽기</string>
<string name="onboarding_goal_support_message">목표가 간결할수록 집중력이 높아져요.</string>
<string name="onboarding_goal_completed">작성 완료</string>

<string name="onboarding_select_character_title">함께 할 러닝메이트를\n선택해 주세요</string>
<string name="onboarding_all_complete">시작하기</string>
<string name="onboarding_bird_character_description">마구 쪼는 잔소리무새</string>
<string name="onboarding_rabbit_character_description">공감 만점 럭키 토끼</string>
<string name="onboarding_all_completed">시작하기</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AndroidFeaturePlugin : Plugin<Project> {

dependencies {
"implementation"(project(":core:designsystem"))
"implementation"(project(":core:ui"))

"implementation"(libs.findLibrary("androidx.lifecycle.runtimeCompose").get())
"implementation"(libs.findLibrary("androidx.lifecycle.viewModelCompose").get())
Expand Down
1 change: 1 addition & 0 deletions core/ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
16 changes: 16 additions & 0 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
alias(libs.plugins.dobedobe.android.library)
alias(libs.plugins.dobedobe.android.compose)
}

android {
namespace = "com.chipichipi.dobedobe.core.ui"
}

dependencies {
api(projects.core.designsystem)
api(projects.core.model)

implementation(libs.coil.kt)
implementation(libs.coil.kt.compose)
}
4 changes: 4 additions & 0 deletions core/ui/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.chipichipi.dobedobe.onboarding
package com.chipichipi.dobedobe.core.ui

import androidx.annotation.DrawableRes
import androidx.compose.foundation.BorderStroke
Expand All @@ -23,39 +23,38 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.chipichipi.dobedobe.R
import com.chipichipi.dobedobe.core.designsystem.theme.DobeDobeTheme

@Composable
internal fun OnboardingBirdCard(
internal fun BirdCard(
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
CharacterCard(
modifier = modifier,
title = stringResource(R.string.onboarding_bird_character_description),
title = stringResource(R.string.bird_character_description),
characterAlignment = Alignment.BottomStart,
bubbleAlignment = Alignment.TopEnd,
characterRes = R.drawable.onboarding_bird,
characterRes = R.drawable.bird_character,
bubbleRes = R.drawable.bubble_bird,
selected = selected,
onClick = onClick,
)
}

@Composable
internal fun OnboardingRabbitCard(
internal fun RabbitCard(
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
CharacterCard(
modifier = modifier,
title = stringResource(R.string.onboarding_rabbit_character_description),
title = stringResource(R.string.rabbit_character_description),
characterAlignment = Alignment.BottomEnd,
bubbleAlignment = Alignment.TopStart,
characterRes = R.drawable.onboarding_rabbit,
characterRes = R.drawable.rabbit_character,
bubbleRes = R.drawable.bubble_rabbit,
selected = selected,
onClick = onClick,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.chipichipi.dobedobe.core.ui

import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.chipichipi.dobedobe.core.designsystem.component.DobeDobeTextButton
import com.chipichipi.dobedobe.core.designsystem.component.ThemePreviews
import com.chipichipi.dobedobe.core.designsystem.theme.DobeDobeTheme
import com.chipichipi.dobedobe.core.model.CharacterType

@Composable
fun SelectCharacterScreen(
selectedCharacter: CharacterType,
onCharacterToggled: () -> Unit,
onCompleted: () -> Unit,
@StringRes buttonText: Int,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier,
) {
Text(
text = stringResource(R.string.select_character_title),
style = DobeDobeTheme.typography.heading1,
color = DobeDobeTheme.colors.black,
)
Spacer(modifier = Modifier.height(48.dp))

BirdCard(
selected = selectedCharacter == CharacterType.Bird,
onClick = onCharacterToggled,
)
Spacer(modifier = Modifier.height(32.dp))

RabbitCard(
selected = selectedCharacter == CharacterType.Rabbit,
onClick = onCharacterToggled,
)
Spacer(modifier = Modifier.weight(1f))

DobeDobeTextButton(
modifier = Modifier
.fillMaxWidth()
.heightIn(56.dp),
onClick = onCompleted,
) {
Text(
text = stringResource(buttonText),
style = DobeDobeTheme.typography.heading2,
color = DobeDobeTheme.colors.white,
)
}
}
}

@ThemePreviews
@Composable
private fun SelectCharacterScreenPreview() {
DobeDobeTheme {
SelectCharacterScreen(
selectedCharacter = CharacterType.Rabbit,
onCharacterToggled = {},
onCompleted = {},
buttonText = R.string.select_character_title,
)
}
}
File renamed without changes
6 changes: 6 additions & 0 deletions core/ui/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="select_character_title">Please select your running mate</string>
<string name="bird_character_description">Nagging Bird</string>
<string name="rabbit_character_description">Empathetic Lucky Rabbit</string>
</resources>
6 changes: 6 additions & 0 deletions core/ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="select_character_title">함께 할 러닝메이트를\n선택해 주세요</string>
<string name="bird_character_description">마구 쪼는 잔소리무새</string>
<string name="rabbit_character_description">공감 만점 럭키 토끼</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private fun DashboardScreen(
when (uiState) {
is DashboardUiState.Error,
is DashboardUiState.Loading,
-> {
-> {
CircularProgressIndicator(
modifier = Modifier.size(24.dp),
)
Expand All @@ -138,7 +138,6 @@ private fun DashboardScreen(
navigateToSetting = navigateToSetting,
navigateToSearchGoal = navigateToSearchGoal,
onGoalToggled = onGoalToggled,
// TODO: 캐릭터 누르면 말풍선 바뀌는걸로 옮기기!
onChangeBubble = onChangeBubble,
onToggleMode = onToggleMode,
onUpsertPhotos = onUpsertPhotos,
Expand Down Expand Up @@ -241,11 +240,12 @@ private fun DashboardBody(
DashboardViewMode(
isViewMode = !isEditMode,
photoState = uiState.photoState,
bubbleTitle = uiState.bubbleTitle,
bubbleGoal = uiState.bubbleGoal,
photoFramesState = photoFramesState,
onChangeBubble = onChangeBubble,
onToggleExpansion = onToggleExpansion,
onToggleMode = onToggleMode,
navigateToGoalDetail = navigateToGoalDetail,
navigateToSetting = navigateToSetting,
resources = resources,
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.chipichipi.dobedobe.feature.dashboard

import com.chipichipi.dobedobe.core.model.CharacterType
import com.chipichipi.dobedobe.core.model.Goal
import com.chipichipi.dobedobe.feature.dashboard.model.BubbleGoal
import com.chipichipi.dobedobe.feature.dashboard.model.DashboardPhotoState

sealed interface DashboardUiState {
Expand All @@ -11,7 +12,7 @@ sealed interface DashboardUiState {
val photoState: List<DashboardPhotoState>,
val isSystemNotificationDialogDisabled: Boolean,
val goals: List<Goal>,
val bubbleTitle: String,
val bubbleGoal: BubbleGoal,
val character: CharacterType,
) : DashboardUiState

Expand Down
Loading

0 comments on commit 92c11cd

Please sign in to comment.