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

[UI/YAF-85] 알람 메인 화면 배경을 구현합니다. #54

Merged
merged 13 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navOptions
import com.yapp.common.navigation.destination.MissionDestination
import com.yapp.common.navigation.destination.HomeDestination
import com.yapp.common.navigation.destination.TopLevelDestination

class OrbitNavigator(
val navController: NavHostController,
) {
val startDestination = MissionDestination.Route.route
val startDestination = HomeDestination.Route.route

private val currentDestination: NavDestination?
@Composable get() = navController
Expand Down
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.
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.
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.
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.
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.
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.
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.
10 changes: 10 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_mail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="33dp"
android:height="32dp"
android:viewportWidth="33"
android:viewportHeight="32">
<path
android:pathData="M6.278,13.251C6.278,10.348 8.632,7.994 11.535,7.994H20.678C23.582,7.994 25.935,10.348 25.935,13.251V18.737C25.935,21.64 23.582,23.994 20.678,23.994H11.535C8.632,23.994 6.278,21.64 6.278,18.737V13.251ZM11.072,12.651C10.74,12.403 10.27,12.47 10.022,12.802C9.773,13.133 9.84,13.603 10.172,13.851L14.457,17.066C15.435,17.799 16.779,17.799 17.757,17.066L22.043,13.851C22.374,13.603 22.441,13.133 22.193,12.802C21.944,12.47 21.474,12.403 21.143,12.651L16.857,15.866C16.413,16.199 15.802,16.199 15.357,15.866L11.072,12.651Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
45 changes: 45 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_main_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="506dp"
android:height="821dp"
android:viewportWidth="506"
android:viewportHeight="821">
<path
android:pathData="M499.6,314.05V806.74C499.6,812.26 495.12,816.74 489.6,816.74H16.6C11.07,816.74 6.6,812.26 6.6,806.74V314.05V308.45C6.6,308.32 6.7,308.22 6.82,308.22C6.93,308.22 7.03,308.14 7.04,308.03C14.79,256.16 121.99,215.06 253.1,215.06C384.21,215.06 491.41,256.16 499.15,308.03C499.17,308.14 499.26,308.22 499.37,308.22C499.5,308.22 499.6,308.32 499.6,308.45V314.05Z"
android:fillType="evenOdd">
<aapt:attr name="android:fillColor">
<gradient
android:startX="245.42"
android:startY="95.22"
android:endX="245.42"
android:endY="816.74"
android:type="linear">
<item android:offset="0" android:color="#FF172E51"/>
<item android:offset="1" android:color="#FF184385"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M121.96,109.07L123.9,107.33C124.61,106.69 125.73,107.32 125.54,108.27L125.01,110.97C124.94,111.32 125.06,111.67 125.32,111.91L127.08,113.5C127.64,114.01 127.46,114.93 126.75,115.19L124.38,116.04C124.12,116.13 123.91,116.32 123.8,116.57L122.86,118.69C122.51,119.49 121.38,119.49 121.03,118.69L120.2,116.78C120.05,116.42 119.69,116.19 119.3,116.18L116.5,116.15C115.73,116.14 115.26,115.32 115.64,114.66L117.13,112.04C117.22,111.88 117.27,111.69 117.26,111.5L117.15,108.88C117.12,108.1 117.96,107.58 118.64,107.97L120.8,109.19C121.17,109.41 121.64,109.36 121.96,109.07Z"
android:strokeAlpha="0.6"
android:fillColor="#2548A7"
android:fillAlpha="0.6"/>
<path
android:pathData="M476.8,29.24L486.08,26.05L493.91,33.3L494.64,43.16L499.42,52.3L501.6,61.87L501.02,72.89L489.42,70.57L478.11,73.76L467.67,65.93L456.36,69.41L445.34,67.52L435.33,65.64L425.19,64.19L415.18,65.78L405.03,66.07L395.03,64.19L384.88,67.38L374.73,70.28L364.72,67.23L354.58,70.86L344.57,66.22L334.42,67.67L324.27,70.13L314.27,66.94L312.24,58.39L321.23,52.88L325.58,44.9L336.02,42.73L347.33,41.71L357.33,35.91L365.16,29.68L374.73,30.69L384.44,31.13L387.2,20.83L398.94,17.64L408.51,13.44L417.5,7.49L428.67,7.35L440.99,4.74L450.13,13.15L453.89,27.21L467.81,19.82L476.8,29.24Z"
android:fillColor="#ffffff"
android:fillAlpha="0.05"/>
<path
android:pathData="M191.61,145.24L190.83,143.4C190.49,142.58 191.3,141.75 192.13,142.08L193.75,142.74C193.93,142.82 194.14,142.84 194.34,142.79L197.07,142.2C197.89,142.02 198.55,142.86 198.19,143.61L197.58,144.88C197.48,145.09 197.46,145.33 197.52,145.56L198.09,147.72C198.29,148.5 197.55,149.18 196.79,148.92L195.09,148.34C194.87,148.26 194.63,148.26 194.41,148.35L192.51,149.07C191.76,149.35 191,148.68 191.18,147.9L191.66,145.86C191.71,145.65 191.69,145.44 191.61,145.24Z"
android:fillColor="#F0F0F0"/>
<path
android:pathData="M357.75,145.29L357.64,143.29C357.59,142.4 358.64,141.9 359.31,142.49L360.61,143.66C360.76,143.8 360.95,143.88 361.15,143.91L363.92,144.27C364.75,144.38 365.09,145.39 364.5,145.97L363.5,146.96C363.33,147.13 363.23,147.35 363.21,147.59L363.02,149.81C362.95,150.61 362.02,151.01 361.39,150.51L359.99,149.38C359.8,149.24 359.58,149.16 359.34,149.16L357.31,149.2C356.51,149.21 356.02,148.33 356.45,147.65L357.59,145.89C357.71,145.71 357.76,145.51 357.75,145.29Z"
android:fillColor="#7CA7E8"/>
<path
android:pathData="M35.7,155.6L29.3,153.4L23.9,158.4L23.4,165.2L14.1,171.5L4.6,178.1L5,185.7L27,184.1L34.8,186.3L42,180.9L49.8,183.3L57.4,182L64.3,180.7L71.3,179.7L78.2,180.8L85.2,181L92.1,179.7L99.1,181.9L106.1,183.9L113,181.8L120,184.3L126.9,181.1L133.9,182.1L140.9,183.8L147.8,181.6L149.2,175.7L143,171.9L140,166.4L132.8,164.9L125,164.2L118.1,160.2L112.7,155.9L106.1,156.6L99.4,156.9L97.5,149.8L89.4,147.6L82.8,144.7L76.6,140.6L68.9,140.5L60.4,138.7L54.1,144.5L51.5,154.2L41.9,149.1L35.7,155.6Z"
android:fillColor="#ffffff"
android:fillAlpha="0.05"/>
<path
android:pathData="M326.05,162.02L328.04,159.65C328.54,159.04 329.52,159.24 329.76,159.99L330.43,162.14C330.54,162.48 330.81,162.73 331.15,162.81L333.76,163.46C334.61,163.67 334.8,164.8 334.06,165.27L332.46,166.3C332.17,166.48 332,166.79 332,167.13L331.98,169.79C331.97,170.5 331.25,170.97 330.59,170.7L327.1,169.26C326.93,169.19 326.74,169.16 326.56,169.19L323.54,169.65C322.81,169.76 322.22,169.08 322.43,168.38L322.99,166.52C323.09,166.2 323.02,165.85 322.8,165.59L321.45,164C320.89,163.35 321.36,162.35 322.22,162.35L325.28,162.38C325.57,162.38 325.86,162.25 326.05,162.02Z"
android:fillColor="#F3EFBF"
android:fillAlpha="0.3"/>
</vector>
10 changes: 10 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_plus.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M9.999,3.167C10.552,3.167 10.999,3.614 10.999,4.167V9H15.833C16.385,9 16.833,9.448 16.833,10C16.833,10.552 16.385,11 15.833,11H10.999V15.833C10.999,16.386 10.552,16.833 9.999,16.833C9.447,16.833 8.999,16.386 8.999,15.833V11H4.166C3.614,11 3.166,10.552 3.166,10C3.166,9.448 3.614,9 4.166,9H8.999V4.167C8.999,3.614 9.447,3.167 9.999,3.167Z"
android:fillColor="#17191F"
android:fillType="evenOdd"/>
</vector>
10 changes: 10 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_setting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="25dp"
android:viewportWidth="24"
android:viewportHeight="25">
<path
android:pathData="M10.092,3.884C9.906,3.747 9.688,3.658 9.459,3.625C9.23,3.592 8.997,3.615 8.779,3.693C7.76,4.067 6.814,4.614 5.983,5.311C5.592,5.639 5.449,6.118 5.492,6.542C5.562,7.247 5.438,7.929 5.098,8.516C4.76,9.104 4.231,9.553 3.584,9.844C3.373,9.938 3.187,10.082 3.044,10.264C2.901,10.446 2.805,10.66 2.764,10.888C2.579,11.955 2.579,13.046 2.764,14.113C2.851,14.616 3.195,14.981 3.584,15.157C4.231,15.448 4.76,15.898 5.099,16.485C5.438,17.073 5.562,17.753 5.492,18.459C5.45,18.883 5.592,19.363 5.983,19.69C6.814,20.387 7.76,20.934 8.779,21.307C8.997,21.385 9.23,21.408 9.459,21.375C9.688,21.342 9.905,21.253 10.091,21.117C10.668,20.702 11.321,20.469 12,20.469C12.679,20.469 13.331,20.702 13.908,21.117C14.255,21.366 14.742,21.483 15.221,21.307C16.24,20.934 17.186,20.387 18.017,19.69C18.408,19.363 18.551,18.884 18.508,18.459C18.438,17.753 18.562,17.072 18.902,16.485C19.24,15.897 19.769,15.449 20.416,15.157C20.804,14.982 21.149,14.616 21.236,14.113C21.421,13.046 21.421,11.955 21.236,10.888C21.195,10.66 21.099,10.446 20.956,10.264C20.813,10.082 20.628,9.938 20.416,9.844C19.769,9.553 19.24,9.104 18.901,8.516C18.562,7.929 18.438,7.247 18.508,6.542C18.533,6.312 18.501,6.08 18.416,5.865C18.33,5.651 18.193,5.46 18.017,5.311C17.186,4.614 16.24,4.067 15.221,3.693C15.004,3.616 14.77,3.592 14.542,3.625C14.313,3.659 14.095,3.747 13.909,3.884C13.331,4.297 12.678,4.532 12,4.532C11.322,4.532 10.669,4.298 10.092,3.884ZM9.188,12.5C9.188,11.754 9.484,11.039 10.011,10.512C10.539,9.984 11.254,9.688 12,9.688C12.746,9.688 13.461,9.984 13.989,10.512C14.516,11.039 14.813,11.754 14.813,12.5C14.813,13.246 14.516,13.962 13.989,14.489C13.461,15.017 12.746,15.313 12,15.313C11.254,15.313 10.539,15.017 10.011,14.489C9.484,13.962 9.188,13.246 9.188,12.5Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>
1 change: 1 addition & 0 deletions core/designsystem/src/main/res/raw/fortune_0_to_49.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/designsystem/src/main/res/raw/fortune_50_to_79.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/designsystem/src/main/res/raw/fortune_80_to_100.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/designsystem/src/main/res/raw/fortune_preload.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/designsystem/src/main/res/raw/step2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/designsystem/src/main/res/raw/step3.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ android {

dependencies {
implementation(projects.core.designsystem)
implementation(libs.compose.material)
implementation(libs.orbit.core)
implementation(libs.orbit.compose)
implementation(libs.orbit.viewmodel)
Expand Down
210 changes: 210 additions & 0 deletions core/ui/src/main/java/com/yapp/ui/component/dialog/OrbitDialog.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
package com.yapp.ui.component.dialog

import androidx.compose.foundation.background
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.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import com.yapp.designsystem.theme.OrbitTheme
import com.yapp.ui.component.button.OrbitButton

@Composable
fun OrbitDialog(
title: String,
message: String,
confirmText: String,
cancelText: String? = null,
onConfirm: () -> Unit,
onCancel: (() -> Unit)? = null,
confirmButtonContainerColor: Color = OrbitTheme.colors.main,
confirmButtonContentColor: Color = OrbitTheme.colors.gray_900,
cancelButtonContainerColor: Color = OrbitTheme.colors.gray_600,
cancelButtonContentColor: Color = OrbitTheme.colors.white,
cornerRadius: Dp = 20.dp,
modifier: Modifier = Modifier,
) {
Dialog(
onDismissRequest = {
if (cancelText == null) {
onConfirm()
} else {
onCancel?.invoke()
}
},
Comment on lines +49 to +55
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
취소랑 확인을 onDismissRequest 하나로 취합하고 있는 구조 인가요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인만 있는 Dialog의 경우 다른 영역을 눌러서 onDismissRequest 를 호출할 때 onCofirm()을 호출하는 구조며
확인/취소가 있는 Dialog라면 다른 영역을 눌렀을 때 onCancel()을 호출하는 구조입니다.

부자연스러운 흐름인 것 같다면 말씀해주세요!

) {
Column(
modifier = modifier
.fillMaxWidth()
.background(
color = OrbitTheme.colors.gray_700,
shape = RoundedCornerShape(cornerRadius),
)
.padding(20.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
text = title,
style = OrbitTheme.typography.heading1SemiBold,
color = OrbitTheme.colors.gray_50,
textAlign = TextAlign.Center,
)
Spacer(modifier = Modifier.height(20.dp))
Text(
text = message,
style = OrbitTheme.typography.body1Regular,
color = OrbitTheme.colors.gray_300,
textAlign = TextAlign.Center,
)
Spacer(modifier = Modifier.height(20.dp))
if (cancelText != null && onCancel != null) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
) {
DialogButton(
text = cancelText,
containerColor = cancelButtonContainerColor,
contentColor = cancelButtonContentColor,
onClick = onCancel,
modifier = Modifier
.weight(1f)
.padding(end = 8.dp),
)
DialogButton(
text = confirmText,
containerColor = confirmButtonContainerColor,
contentColor = confirmButtonContentColor,
onClick = onConfirm,
modifier = Modifier
.weight(1f)
.padding(start = 8.dp),
)
}
} else {
DialogButton(
text = confirmText,
containerColor = confirmButtonContainerColor,
contentColor = confirmButtonContentColor,
onClick = onConfirm,
modifier = Modifier.fillMaxWidth(),
)
}
}
}
}

@Composable
private fun DialogButton(
text: String,
containerColor: Color,
contentColor: Color,
onClick: () -> Unit,
modifier: Modifier = Modifier,
) {
Button(
onClick = onClick,
modifier = modifier.height(48.dp),
colors = ButtonDefaults.buttonColors(
containerColor = containerColor,
contentColor = contentColor,
),
shape = RoundedCornerShape(16.dp),
) {
Text(
text = text,
style = OrbitTheme.typography.body1SemiBold,
)
}
}

@Preview
@Composable
fun PreviewCustomDialogSingleButton() {
var isDialogOpen by remember { mutableStateOf(true) }

OrbitTheme {
Box(
modifier = Modifier
.fillMaxSize()
.background(OrbitTheme.colors.gray_900),
contentAlignment = Alignment.Center,
) {
OrbitButton(
label = "알림창 열기",
enabled = true,
onClick = {
isDialogOpen = true
},
)

if (isDialogOpen) {
OrbitDialog(
title = "받은 운세가 없어요",
message = "알람이 울린 후 미션을 수행하면\n오늘의 운세를 받을 수 있어요.",
confirmText = "닫기",
onConfirm = {
isDialogOpen = false
},
)
}
}
}
}

@Preview
@Composable
fun PreviewCustomDialogDoubleButton() {
var isDialogOpen by remember { mutableStateOf(true) }

OrbitTheme {
Box(
modifier = Modifier
.fillMaxSize()
.background(OrbitTheme.colors.gray_900),
contentAlignment = Alignment.Center,
) {
OrbitButton(
label = "알림창 열기",
enabled = true,
onClick = {
isDialogOpen = true
},
)

if (isDialogOpen) {
OrbitDialog(
title = "나가면 운세를 받을 수 없어요",
message = "미션을 수행하지 않고 나가시겠어요?",
confirmText = "나가기",
cancelText = "취소",
onConfirm = {},
onCancel = {
isDialogOpen = false
},
)
}
}
}
}
1 change: 1 addition & 0 deletions feature/home/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ android {
dependencies {
implementation(projects.core.ui)
implementation(projects.core.common)
implementation(projects.domain)
implementation(libs.orbit.core)
implementation(libs.orbit.compose)
implementation(libs.orbit.viewmodel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ private fun AlarmAddEditTopBar(
Box(
modifier = Modifier
.fillMaxWidth()
.height(56.dp)
.statusBarsPadding(),
.statusBarsPadding()
.height(56.dp),
contentAlignment = Alignment.Center,
) {
Icon(
Expand Down
24 changes: 24 additions & 0 deletions feature/home/src/main/java/com/yapp/home/HomeContract.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.yapp.home

import com.yapp.domain.model.Alarm
import com.yapp.ui.base.UiState

sealed class HomeContract {

data class State(
val alarms: List<Alarm> = listOf(Alarm()),
val lastFortuneScore: Int = -1,
) : UiState

sealed class Action

sealed class SideEffect : com.yapp.ui.base.SideEffect {
data class Navigate(
val route: String,
val popUpTo: String? = null,
val inclusive: Boolean = false,
) : SideEffect()

data object NavigateBack : SideEffect()
}
}
6 changes: 4 additions & 2 deletions feature/home/src/main/java/com/yapp/home/HomeNavGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ fun NavGraphBuilder.homeNavGraph(
) {
navigation(
route = HomeDestination.Route.route,
startDestination = HomeDestination.AlarmAddEdit.route,
startDestination = HomeDestination.Home.route,
) {
composable(route = HomeDestination.Home.route) {
HomeRoute()
HomeRoute(
navigator = navigator,
)
}

composable(route = HomeDestination.AlarmAddEdit.route) {
Expand Down
Empty file.
Loading
Loading