Skip to content

Commit

Permalink
Merge pull request #9 from Team-ReMind/feat/onboarding
Browse files Browse the repository at this point in the history
Feat/onboarding-환자용 온보딩 완료
  • Loading branch information
seunghee17 authored May 16, 2024
2 parents 97b7a84 + e05b8c5 commit 32012fc
Show file tree
Hide file tree
Showing 70 changed files with 2,540 additions and 155 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
implementation("androidx.benchmark:benchmark-macro:1.2.4")
implementation("com.google.android.engage:engage-core:1.5.1")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
Expand Down
16 changes: 0 additions & 16 deletions app/src/main/java/com/example/remind/app/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
package com.example.remind.app

import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface
import androidx.compose.material.TopAppBar
import androidx.compose.ui.Modifier
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import com.example.remind.core.designsystem.theme.RemindTheme
import com.google.firebase.Firebase
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -35,15 +28,6 @@ class MainActivity : ComponentActivity() {
}
}
}
//곧 지워질 코드
Firebase.messaging.token.addOnCompleteListener { task ->
if(!task.isSuccessful) {
Log.e("tagg", "failed")
} else {
val token = task.result
Log.d("taag", "$token")
}
}
}
}

5 changes: 5 additions & 0 deletions app/src/main/java/com/example/remind/app/Screens.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ sealed class Screens(val route: String) {
object Register: Screens("register") {
object Login: Screens("login")
object SelectType: Screens("selecttype")
object OnBoardingPatience: Screens("patience_onboarding")
object OnBoardingCheckDoctor: Screens("doctor_1")
object OnBoardingLoadingDoctor: Screens("doctor_2")
object OnBoardingCenter: Screens("center_onboarding")
object OnBoardingFinal: Screens("final_onboarding")
}

object Doctor: Screens("doctor") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
Expand All @@ -18,36 +19,26 @@ import com.example.remind.core.designsystem.theme.RemindTheme
fun BasicButton(
modifier: Modifier = Modifier,
text: String,
RoundedCorner: Dp,
backgroundColor: Color,
textColor: Color,
verticalPadding: Dp,
onClick: () -> Unit
onClick: () -> Unit,
textStyle: TextStyle
) {
Button(
modifier = modifier.fillMaxWidth(),
modifier = modifier,
onClick = onClick,
shape = RoundedCornerShape(20.dp),
shape = RoundedCornerShape(RoundedCorner),
contentPadding = PaddingValues(vertical = verticalPadding),
colors = ButtonDefaults.buttonColors(
containerColor = backgroundColor,
contentColor = textColor
),
contentPadding = PaddingValues(vertical = verticalPadding),
) {
Text(
text = text,
style = RemindTheme.typography.c1Medium
style = textStyle
)
}
}

@Composable
@Preview
fun BasicButtonPreview() {
BasicButton(
text = "삭제",
backgroundColor = RemindTheme.colors.main_6,
onClick = {},
verticalPadding = 0.dp,
textColor = RemindTheme.colors.text
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.example.remind.core.common.component

import androidx.compose.foundation.background
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.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.example.remind.R
import com.example.remind.core.designsystem.theme.RemindTheme

@Composable
fun BasicOnBoardingAppBar(
modifier : Modifier = Modifier,
weight: Float,
title: String
) {
Column(
modifier = modifier.fillMaxWidth()
) {
Text(
modifier = modifier.padding(top = 20.dp, bottom = 16.dp),
textAlign = TextAlign.Center,
text = title,
style = RemindTheme.typography.b1Bold.copy(color = RemindTheme.colors.text)
)
Row(
modifier = Modifier
.fillMaxWidth()
) {
Box(
modifier = modifier
.weight(weight)
.height(4.dp)
.padding(start = 0.dp)
.clip(shape = RoundedCornerShape(23.dp))
.background(color = RemindTheme.colors.main_6)
)
Spacer(modifier = modifier.weight(0.7f))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.example.remind.core.common.component

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
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.text.PlatformTextStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.LineHeightStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.remind.core.designsystem.theme.Pretendard
import com.example.remind.core.designsystem.theme.RemindTheme

@Composable
fun BasicTextButton(
modifier: Modifier = Modifier,
backgroundColor: Color,
text: String,
textColor: Color,
onClick: () -> Unit,
verticalPadding: Dp,
enable: Boolean
) {
Box(
modifier = modifier
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(color = backgroundColor)
.clickable(
enabled = enable,
onClick = onClick
)
) {
Text(
modifier = modifier
.padding(vertical = verticalPadding),
text = text,
textAlign = TextAlign.Center,
style = RemindTheme.typography.c1Medium.copy(color = textColor)
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package com.example.remind.core.common.component

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
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.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.res.stringResource
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.sp
import com.example.remind.R
import com.example.remind.core.designsystem.theme.RemindTheme

@Composable
fun MedicineItem(
modifier: Modifier = Modifier,
time: String,
score: Float,
doseClick: () -> Unit,
unadministeredClick: () -> Unit,
) {
Box(
modifier = modifier
.background(color = RemindTheme.colors.slate_50, shape = RoundedCornerShape(12.dp))
) {
Column(
horizontalAlignment = Alignment.Start,
) {
Text(
modifier = modifier.padding(start = 12.dp, top = 7.dp),
text = time,
style = RemindTheme.typography.b3Bold.copy(color = RemindTheme.colors.slate_600)
)
Row(
modifier = modifier.padding(
start = 12.dp,
end = 12.dp,
top = 2.dp,
bottom = 4.dp
)
) {
Text(
text = stringResource(id = R.string.중요도),
style = RemindTheme.typography.c3Medium.copy(color = RemindTheme.colors.slate_400)
)
Spacer(modifier = modifier.width(6.dp))
StarRatingBar(
rating = score,
onRatingChanged = {}
)
}
Spacer(modifier = modifier.height(4.dp))
Row() {
//시간이 정해져있을 경우 바꿔지도록 하기
Text(
modifier = modifier
.weight(0.5f)
.background(
color = RemindTheme.colors.main_6,
shape = RoundedCornerShape(bottomStart = 12.dp)
)
.clickable { doseClick },
text = stringResource(id = R.string.복용),
textAlign= TextAlign.Center,
style = RemindTheme.typography.c1Bold.copy(
color = RemindTheme.colors.white,
lineHeight = 20.sp
)
)
Spacer(modifier = modifier.width(2.dp))
Text(
modifier = modifier
.weight(0.5f)
.background(
color = RemindTheme.colors.main_5,
shape = RoundedCornerShape(bottomEnd = 12.dp)
)
.clickable { unadministeredClick },
text = stringResource(id = R.string.미복용),
textAlign= TextAlign.Center,
style = RemindTheme.typography.c1Bold.copy(
color = RemindTheme.colors.white,
lineHeight = 20.sp
)
)
}
}
}
}

@Preview
@Composable
fun ItemPreview() {
//MedicineItem(time = "아침", score= 2.0, doseClick = {}, unadministeredClick = {})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.example.remind.core.common.component

import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.material3.Icon
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.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.example.remind.R
import com.example.remind.core.designsystem.theme.RemindTheme

@Composable
fun StarRatingBar(
maxStars: Int = 3,
rating: Float,
onRatingChanged: (Float) -> Unit
) {
val density = LocalDensity.current.density
val starSize = (12f * density).dp
val starSpacing = (0.5f * density).dp

Row(
modifier = Modifier.selectableGroup(),
verticalAlignment = Alignment.CenterVertically
) {
for (i in 1..maxStars) {
val isSelected = i <= rating
val icon = if (isSelected) R.drawable.ic_star_fill else R.drawable.ic_star_unfill
val iconTintColor = if (isSelected) RemindTheme.colors.main_4 else RemindTheme.colors.slate_200
Icon(
painter = painterResource(id = icon),
contentDescription = null,
tint = iconTintColor,
modifier = Modifier
.selectable(
selected = isSelected,
onClick = {
onRatingChanged(i.toFloat())
}
)
.width(starSize)
.height(starSize)
)

if (i < maxStars) {
Spacer(modifier = Modifier.width(starSpacing))
}
}
}
}
Loading

0 comments on commit 32012fc

Please sign in to comment.