Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/implement board setup UI #15

Merged
merged 33 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a633a42
init onboarding module
eshc123 Jul 25, 2024
40a74d0
fix material 중복 수정
eshc123 Aug 1, 2024
5681dc6
add onboarding resources
eshc123 Aug 1, 2024
5cd6d56
add Modifier dropShadow
eshc123 Aug 1, 2024
b3b4f44
add OnboardingRoute
eshc123 Aug 1, 2024
7ce81fa
add build.gradle 의존성
eshc123 Aug 1, 2024
6c18939
add OnboardingNavigation
eshc123 Aug 1, 2024
2b212ce
add Onboarding Navigation in MainNav
eshc123 Aug 1, 2024
70b65ee
add Custom Composable - OnboardingNavigationButton, OutlinedTextBox, …
eshc123 Aug 1, 2024
d5961cb
implement OnboardingScreen
eshc123 Aug 1, 2024
a4e3dee
chore material 의존성 수정
eshc123 Aug 1, 2024
0fe9572
chore startDestination 수정
eshc123 Aug 1, 2024
144a02b
Merge remote-tracking branch 'origin/dev' into feature/implement-boar…
eshc123 Aug 2, 2024
2ae1715
Merge remote-tracking branch 'origin/dev' into feature/implement-boar…
eshc123 Aug 2, 2024
d25989b
add image & string values in designsystem
eshc123 Aug 3, 2024
b2f2c3d
add string values in onboarding
eshc123 Aug 3, 2024
78287e6
add BoardSetupNavigationBar
eshc123 Aug 3, 2024
90cd346
add DateUtils
eshc123 Aug 3, 2024
22c7169
add DayOfWeek.getStringId()
eshc123 Aug 3, 2024
530a150
add StringUtils
eshc123 Aug 3, 2024
0de1e68
add DatePickerDialog
eshc123 Aug 3, 2024
ffebac5
add VerificationTimeType
eshc123 Aug 3, 2024
4c7611c
add BoardSetupMission
eshc123 Aug 3, 2024
61ab3c3
add BoardSetupSchedule
eshc123 Aug 3, 2024
d61e36f
add BoardSetupVerificationTime
eshc123 Aug 3, 2024
727433b
add BoardSetupSuccessScreen
eshc123 Aug 3, 2024
77d9f3d
add BoardSetupViewModel
eshc123 Aug 3, 2024
b19c8d8
add BoardSetupRoute
eshc123 Aug 3, 2024
c8d533c
implement OnboardingNavigation
eshc123 Aug 3, 2024
7d8bf43
implement windowSoftInputMode - adjustResize
eshc123 Aug 3, 2024
6ba2644
add BoardSetupSuccess - OnboardingRouteModel
eshc123 Aug 3, 2024
1ef18b3
add navigation in main
eshc123 Aug 3, 2024
32699be
refactor enabledDaysOfWeek
eshc123 Aug 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions core/designsystem/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<resources>
<string name="app_name">mission-mate</string>

<string name="monday_short">월</string>
<string name="tuesday_short">화</string>
<string name="wednesday_short">수</string>
<string name="thursday_short">목</string>
<string name="friday_short">금</string>
<string name="saturday_short">토</string>
<string name="sunday_short">일</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ sealed interface OnboardingRouteModel {
@Serializable
data object BoardSetup : OnboardingRouteModel

@Serializable
data object BoardSetupSuccess : OnboardingRouteModel

@Serializable
data object InvitationCode : OnboardingRouteModel
}
3 changes: 2 additions & 1 deletion feature/main/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.Missionmate">
android:theme="@style/Theme.Missionmate"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import com.goalpanzi.mission_mate.feature.login.loginNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.boardSetupNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.boardSetupSuccessNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.invitationCodeNavGraph
import com.goalpanzi.mission_mate.feature.onboarding.onboardingNavGraph

Expand All @@ -32,11 +33,23 @@ internal fun MainNavHost(
onBackClick = { navigator.popBackStack() }
)
onboardingNavGraph(
onClickBoardSetup = { },
onClickInvitationCode = { },
onClickBoardSetup = { navigator.navigationToBoardSetup() },
onClickInvitationCode = { navigator.navigationToInvitationCode() },
onClickSetting = { }
)
boardSetupNavGraph()
boardSetupNavGraph(
onSuccess = {
navigator.navigationToBoardSetupSuccess()
},
onBackClick = {
navigator.popBackStack()
}
)
boardSetupSuccessNavGraph(
onClickStart = {

}
)
invitationCodeNavGraph()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.navigation.compose.rememberNavController
import com.goalpanzi.mission_mate.core.navigation.RouteModel
import com.goalpanzi.mission_mate.feature.login.navigateToLogin
import com.goalpanzi.mission_mate.feature.onboarding.navigateToBoardSetup
import com.goalpanzi.mission_mate.feature.onboarding.navigateToBoardSetupSuccess
import com.goalpanzi.mission_mate.feature.onboarding.navigateToInvitationCode
import com.goalpanzi.mission_mate.feature.onboarding.navigateToOnboarding

Expand All @@ -33,6 +34,10 @@ class MainNavigator(
navController.navigateToBoardSetup()
}

fun navigationToBoardSetupSuccess() {
navController.navigateToBoardSetupSuccess()
}

fun navigationToInvitationCode() {
navController.navigateToInvitationCode()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.goalpanzi.mission_mate.core.navigation.OnboardingRouteModel
import com.goalpanzi.mission_mate.core.navigation.RouteModel
import com.goalpanzi.mission_mate.feature.onboarding.screen.OnboardingRoute
import com.goalpanzi.mission_mate.feature.onboarding.screen.boardsetup.BoardSetupRoute
import com.goalpanzi.mission_mate.feature.onboarding.screen.boardsetup.BoardSetupSuccessScreen

fun NavController.navigateToOnboarding() {
this.navigate(RouteModel.Onboarding)
Expand All @@ -14,14 +17,18 @@ fun NavController.navigateToBoardSetup() {
this.navigate(OnboardingRouteModel.BoardSetup)
}

fun NavController.navigateToBoardSetupSuccess() {
this.navigate(OnboardingRouteModel.BoardSetupSuccess)
}

fun NavController.navigateToInvitationCode() {
this.navigate(OnboardingRouteModel.InvitationCode)
}

fun NavGraphBuilder.onboardingNavGraph(
onClickBoardSetup : () -> Unit,
onClickInvitationCode : () -> Unit,
onClickSetting : () -> Unit
onClickBoardSetup: () -> Unit,
onClickInvitationCode: () -> Unit,
onClickSetting: () -> Unit
) {
composable<RouteModel.Onboarding> {
OnboardingRoute(
Expand All @@ -32,14 +39,29 @@ fun NavGraphBuilder.onboardingNavGraph(
}
}

fun NavGraphBuilder.boardSetupNavGraph() {
fun NavGraphBuilder.boardSetupNavGraph(
onSuccess: () -> Unit,
onBackClick: () -> Unit
) {
composable<OnboardingRouteModel.BoardSetup> {
BoardSetupRoute(
onSuccess = onSuccess,
onBackClick = onBackClick
)
}
}

fun NavGraphBuilder.boardSetupSuccessNavGraph(
onClickStart: () -> Unit
) {
composable<OnboardingRouteModel.BoardSetupSuccess> {
BoardSetupSuccessScreen(
onClickStart = onClickStart
)
}
}

fun NavGraphBuilder.invitationCodeNavGraph() {
composable<OnboardingRouteModel.InvitationCode> {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.goalpanzi.mission_mate.feature.onboarding.component

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowLeft
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray1_FF404249
import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography
import com.goalpanzi.mission_mate.feature.onboarding.R

@Composable
fun BoardSetupNavigationBar(
onBackClick: () -> Unit,
currentStep: () -> Int,
modifier: Modifier = Modifier,
maxStep: Int = 3,
) {
Column(
modifier = modifier
) {
IconButton(
modifier = Modifier.padding(start = 4.dp),
onClick = onBackClick
) {
Icon(
modifier = Modifier.size(24.dp),
imageVector = Icons.Default.KeyboardArrowLeft, // merge 전까지 임시 사용
contentDescription = null
)
}
Row(
modifier = Modifier.padding(16.dp),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = stringResource(
id = when (currentStep()) {
1 -> R.string.onboarding_board_setup_mission_title
2 -> R.string.onboarding_board_setup_schedule_title
else -> R.string.onboarding_board_setup_verification_time_title
}
),
modifier = Modifier
.wrapContentHeight()
.weight(1f)
.padding(start = 8.dp, end = 8.dp),
style = MissionMateTypography.heading_sm_bold,
color = ColorGray1_FF404249
)
OutlinedTextBox(
text = "${currentStep()}/$maxStep",
textStyle = MissionMateTypography.body_lg_regular
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.goalpanzi.mission_mate.feature.onboarding.component

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.DatePicker
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.SelectableDates
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.rememberDatePickerState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import com.goalpanzi.mission_mate.core.designsystem.component.MissionMateButton
import com.goalpanzi.mission_mate.core.designsystem.component.MissionMateButtonType
import com.goalpanzi.mission_mate.feature.onboarding.util.DateUtils.localDateToMillis
import java.time.LocalDate

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DatePickerDialog(
selectedDate: LocalDate?,
selectableStartDate: LocalDate?,
selectableEndDate: LocalDate?,
onSuccess: (Long) -> Unit,
onDismiss: () -> Unit
) {
val datePickerState = rememberDatePickerState(
initialSelectedDateMillis = selectedDate?.let { localDateToMillis(it) },
selectableDates = object : SelectableDates {
override fun isSelectableDate(utcTimeMillis: Long): Boolean {
val startMillis = localDateToMillis(selectableStartDate)
val endMillis = localDateToMillis(selectableEndDate)
val currentMillis = utcTimeMillis
return (startMillis ?: Long.MIN_VALUE) <= currentMillis && (endMillis
?: Long.MAX_VALUE) >= currentMillis
}
}
)
Dialog(
properties = DialogProperties(usePlatformDefaultWidth = false),
onDismissRequest = onDismiss
) {
Surface(
modifier = Modifier
.padding(horizontal = 4.dp, vertical = 12.dp)
.fillMaxWidth()
) {
Column(
verticalArrangement = Arrangement.spacedBy(4.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {

DatePicker(state = datePickerState)
MissionMateButton(
buttonType = if (datePickerState.selectedDateMillis == null) MissionMateButtonType.DISABLED
else MissionMateButtonType.SECONDARY,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 20.dp, vertical = 12.dp),
onClick = {
datePickerState.selectedDateMillis?.let { onSuccess(it) }
}
) {
Text(text = "Ok")
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.goalpanzi.mission_mate.feature.onboarding.model

import androidx.annotation.StringRes
import com.goalpanzi.mission_mate.feature.onboarding.R

enum class VerificationTimeType(
@StringRes val titleId : Int
) {
Am(R.string.onboarding_board_setup_verification_time_input_content_am),
Pm(R.string.onboarding_board_setup_verification_time_input_content_pm),
All(R.string.onboarding_board_setup_verification_time_input_content_all)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.goalpanzi.mission_mate.feature.onboarding
package com.goalpanzi.mission_mate.feature.onboarding.screen

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand All @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand All @@ -24,6 +25,7 @@ import androidx.compose.ui.unit.dp
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorGray1_FF404249
import com.goalpanzi.mission_mate.core.designsystem.theme.ColorWhite_FFFFFFFF
import com.goalpanzi.mission_mate.core.designsystem.theme.MissionMateTypography
import com.goalpanzi.mission_mate.feature.onboarding.R
import com.goalpanzi.mission_mate.feature.onboarding.component.OnboardingNavigationButton
import com.goalpanzi.mission_mate.feature.onboarding.component.OutlinedTextBox
import com.goalpanzi.mission_mate.feature.onboarding.component.StableImage
Expand Down Expand Up @@ -63,12 +65,12 @@ fun OnboardingScreen(
contentScale = ContentScale.FillWidth
)
Column(
modifier = modifier,
modifier = modifier.statusBarsPadding(),
horizontalAlignment = Alignment.CenterHorizontally
) {
IconButton(
modifier = Modifier
.padding(end = 10.dp, top = 24.dp)
.padding(end = 10.dp)
.align(Alignment.End),
onClick = onClickSetting
) {
Expand All @@ -85,7 +87,7 @@ fun OnboardingScreen(
color = ColorGray1_FF404249
)
OutlinedTextBox(
text = stringResource(id = R.string.onboarding_level_1),
text = stringResource(id = R.string.onboarding_level_1),
modifier = Modifier.padding(bottom = 23.dp)
)
Box(
Expand Down
Loading
Loading