diff --git a/app/src/main/java/com/example/remind/core/common/component/BasicTextButton.kt b/app/src/main/java/com/example/remind/core/common/component/BasicTextButton.kt new file mode 100644 index 0000000..9c71b0c --- /dev/null +++ b/app/src/main/java/com/example/remind/core/common/component/BasicTextButton.kt @@ -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) + ) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/remind/core/common/component/MedicineItem.kt b/app/src/main/java/com/example/remind/core/common/component/MedicineItem.kt new file mode 100644 index 0000000..a7329a1 --- /dev/null +++ b/app/src/main/java/com/example/remind/core/common/component/MedicineItem.kt @@ -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 = {}) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/remind/core/common/component/StarRatingBar.kt b/app/src/main/java/com/example/remind/core/common/component/StarRatingBar.kt new file mode 100644 index 0000000..b00a519 --- /dev/null +++ b/app/src/main/java/com/example/remind/core/common/component/StarRatingBar.kt @@ -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)) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/remind/data/model/CalendarUiModel.kt b/app/src/main/java/com/example/remind/data/model/CalendarUiModel.kt new file mode 100644 index 0000000..baa1459 --- /dev/null +++ b/app/src/main/java/com/example/remind/data/model/CalendarUiModel.kt @@ -0,0 +1,24 @@ +package com.example.remind.data.model + +import android.os.Build +import androidx.annotation.RequiresApi +import java.time.LocalDate +import java.time.format.DateTimeFormatter +import java.util.Date + +data class CalendarUiModel( + val selectedDate: Date, + val visibleDates: List +) { + val startDate: Date = visibleDates.first() + val endDate: Date = visibleDates.last() + + data class Date( + val date: LocalDate, + val isSelected: Boolean, + val isToday: Boolean + ) { + @RequiresApi(Build.VERSION_CODES.O) + val day: String = date.format(DateTimeFormatter.ofPattern("E")) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/remind/data/repository/CalendarDataSource.kt b/app/src/main/java/com/example/remind/data/repository/CalendarDataSource.kt new file mode 100644 index 0000000..4334077 --- /dev/null +++ b/app/src/main/java/com/example/remind/data/repository/CalendarDataSource.kt @@ -0,0 +1,55 @@ +package com.example.remind.data.repository + +import android.os.Build +import androidx.annotation.RequiresApi +import com.example.remind.data.model.CalendarUiModel +import java.time.DayOfWeek +import java.time.LocalDate +import java.time.temporal.ChronoUnit +import java.util.stream.Collectors +import java.util.stream.Stream + +class CalendarDataSource { + val today: LocalDate + @RequiresApi(Build.VERSION_CODES.O) + get() { + return LocalDate.now() + } + @RequiresApi(Build.VERSION_CODES.O) + fun getData(startDate: LocalDate = today, lastSelectedDate: LocalDate): CalendarUiModel { + val firstDayOfWeek = startDate.with(DayOfWeek.MONDAY) + val endDayOfWeek = firstDayOfWeek.plusDays(7) + val visibleDates = getDateBetween(firstDayOfWeek,endDayOfWeek) + return toUiModel(visibleDates, lastSelectedDate) + } + + @RequiresApi(Build.VERSION_CODES.O) + private fun getDateBetween(startDate: LocalDate, endDate: LocalDate): List { + val numOfDays = ChronoUnit.DAYS.between(startDate, endDate) + return Stream.iterate(startDate) { date -> + date.plusDays(1) + } + .limit(numOfDays) + .collect(Collectors.toList()) + } + + @RequiresApi(Build.VERSION_CODES.O) + private fun toUiModel( + dateList: List, + lastSelectedDate: LocalDate + ): CalendarUiModel { + return CalendarUiModel( + selectedDate = toItemUiModel(lastSelectedDate, true), + visibleDates = dateList.map { + toItemUiModel(it, it.isEqual(lastSelectedDate)) + } + ) + } + + @RequiresApi(Build.VERSION_CODES.O) + private fun toItemUiModel(date: LocalDate, isSelectedDate: Boolean) = CalendarUiModel.Date( + isSelected = isSelectedDate, + isToday = date.isEqual(today), + date = date + ) +} \ No newline at end of file diff --git a/app/src/main/java/com/example/remind/feature/screens/patience/CheeringScreen.kt b/app/src/main/java/com/example/remind/feature/screens/patience/CheeringScreen.kt new file mode 100644 index 0000000..341a6ab --- /dev/null +++ b/app/src/main/java/com/example/remind/feature/screens/patience/CheeringScreen.kt @@ -0,0 +1,28 @@ +package com.example.remind.feature.screens.patience + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.painter.Painter +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import com.example.remind.R +import com.example.remind.core.designsystem.theme.RemindTheme + +@Composable +fun CheeringScreen(){ + RemindTheme { + Image( + modifier = Modifier.fillMaxSize(), + painter = painterResource(id = R.drawable.img_example_cheer), + contentDescription = null + ) + } +} + +@Preview +@Composable +fun CheeringPreview() { + CheeringScreen() +} \ No newline at end of file diff --git a/app/src/main/java/com/example/remind/feature/screens/patience/HomeScreen.kt b/app/src/main/java/com/example/remind/feature/screens/patience/HomeScreen.kt index 08dde4e..9565119 100644 --- a/app/src/main/java/com/example/remind/feature/screens/patience/HomeScreen.kt +++ b/app/src/main/java/com/example/remind/feature/screens/patience/HomeScreen.kt @@ -1,38 +1,390 @@ package com.example.remind.feature.screens.patience +import android.os.Build +import androidx.annotation.RequiresApi import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.border +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.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.itemsIndexed +import androidx.compose.foundation.layout.wrapContentSize +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton 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.draw.clip +import androidx.compose.ui.draw.shadow +import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource 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 com.example.remind.R +import com.example.remind.core.common.component.BasicButton import com.example.remind.core.common.component.BasicListItem import com.example.remind.core.designsystem.theme.RemindTheme +import com.example.remind.data.model.CalendarUiModel +import com.example.remind.data.repository.CalendarDataSource import com.example.remind.feature.viewmodel.CustomViewModel +@RequiresApi(Build.VERSION_CODES.O) @Composable fun HomeScreen(){ + val dataSource = CalendarDataSource() + var calendarUiModel by remember { mutableStateOf(dataSource.getData(lastSelectedDate = dataSource.today)) } + val scrollState = rememberScrollState() + RemindTheme { + Column( + modifier = Modifier + .fillMaxSize() + .background(color = RemindTheme.colors.white) + ) { + HomeTopBar(onClick = {}) + DateSelectHeader(previousBtn = {}, nextBtn = {}, calendarBtn = {}) + Content( + modifier = Modifier.fillMaxWidth(), + data = calendarUiModel, + onDateClicked = { date -> + calendarUiModel = calendarUiModel.copy( + selectedDate = date, + visibleDates = calendarUiModel.visibleDates.map { + it.copy( + isSelected = it.date.isEqual(date.date) + ) + } + ) + } + ) + Spacer(modifier = Modifier.height(10.dp)) + Box( + modifier = Modifier + .fillMaxWidth() + .shadow( + shape = RoundedCornerShape( + topStart = 20.dp, + topEnd = 20.dp, + bottomStart = 0.dp, + bottomEnd = 0.dp + ), + elevation = 2.dp, + ambientColor = Color(0xFF042340).copy(alpha = 0.4f), + ) + .background( + shape = RoundedCornerShape( + topStart = 20.dp, + topEnd = 20.dp, + bottomStart = 0.dp, + bottomEnd = 0.dp + ), + color = RemindTheme.colors.white, + ) + ) { + Column( + modifier = Modifier + .padding(horizontal = 20.dp) + .verticalScroll(scrollState), + horizontalAlignment = Alignment.Start + ) { + Spacer(modifier = Modifier.height(20.dp)) + Text( + text = stringResource(id = R.string.약_복용_체크), + style = RemindTheme.typography.b2Bold.copy(color = Color(0xFF1F2937)) + ) + Spacer(modifier = Modifier.height(10.dp)) + EmptyMedicineList() + Spacer(modifier = Modifier.height(23.dp)) + Text( + text = stringResource(id = R.string.오늘_하루_기분이_어떠셨나요), + style = RemindTheme.typography.b2Bold.copy(color = Color(0xFF1F2937)) + ) + Spacer(modifier = Modifier.height(2.dp)) + Text( + text = stringResource(id = R.string.당신의_하루가_궁금해요), + style = RemindTheme.typography.b3Medium.copy(color = Color(0xFF9B9B9B)) + ) + Spacer(modifier = Modifier.height(10.dp)) + EmptyTodayMoodContainer(clickToWrite = {}) + Spacer(modifier = Modifier.height(80.dp)) + } + } + } + } +} + +@Composable +fun HomeTopBar( + modifier: Modifier = Modifier, + onClick: () -> Unit +) { + Row( + modifier = modifier + .fillMaxWidth() + .background(color = RemindTheme.colors.white) + .padding(start = 20.dp, end = 20.dp, top = 23.6.dp), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically + ) { + Image( + painter = painterResource(id = R.drawable.ic_logo), + contentDescription = null, + modifier = modifier + .size( + width = 37.dp, + height = 22.dp + ) + ) + Spacer(Modifier.weight(1f)) + IconButton( + onClick = onClick, + ) { + Icon( + painter = painterResource(id = R.drawable.ic_sos), + contentDescription = null, + modifier = modifier + .size(width = 24.dp, height = 32.dp), + tint = RemindTheme.colors.sub_3 + ) + } + } +} + +@Composable +fun DateSelectHeader( + modifier: Modifier = Modifier, + previousBtn: () -> Unit, + nextBtn: () -> Unit, + calendarBtn: () -> Unit +) { + Row( + modifier = modifier + .fillMaxWidth() + .background(color = RemindTheme.colors.white) + .padding(start = 20.dp, end = 20.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = "2024년 4월 1주차", + style = RemindTheme.typography.c1Medium.copy(color = RemindTheme.colors.grayscale_3) + ) + Spacer(modifier = modifier.weight(1f)) + IconButton( + onClick = nextBtn, + ) { + Icon( + painter = painterResource(id = R.drawable.ic_calendar_previous), + contentDescription = null, + modifier = Modifier + .size(width = 17.dp, height = 17.dp), + tint = RemindTheme.colors.slate_400 + ) + } + IconButton( + onClick = calendarBtn, + ) { + Icon( + painter = painterResource(id = R.drawable.ic_calendar_next), + contentDescription = null, + modifier = modifier + .size(width = 17.dp, height = 17.dp), + tint = RemindTheme.colors.slate_400 + ) + } + IconButton( + onClick = calendarBtn, + ) { + Icon( + painter = painterResource(id = R.drawable.ic_calendar), + contentDescription = null, + modifier = modifier + .size(width = 14.dp, height = 14.dp), + tint = RemindTheme.colors.slate_500 + ) + } + } +} +@RequiresApi(Build.VERSION_CODES.O) +@Composable +fun Content( + modifier: Modifier = Modifier, + data: CalendarUiModel, + onDateClicked: (CalendarUiModel.Date) -> Unit +) { + LazyRow( + modifier = modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceEvenly + ) { + items(items = data.visibleDates) { date -> + DayItem( + date = date, + onDateClicked = onDateClicked + ) + } + } } +@RequiresApi(Build.VERSION_CODES.O) +@Composable +fun DayItem( + modifier: Modifier = Modifier, + date: CalendarUiModel.Date, + onDateClicked: (CalendarUiModel.Date) -> Unit +) { + Card( + modifier = modifier + .clickable { + onDateClicked(date) + }, + colors = CardDefaults.cardColors( + containerColor = if (date.isSelected) RemindTheme.colors.main_6 else RemindTheme.colors.white + ) + ) { + Column( + ) { + Text( + text = date.day, + modifier = Modifier + .align(Alignment.CenterHorizontally) + .padding(top = 6.dp, bottom = 7.dp), + style = RemindTheme.typography.b2Medium.copy( + color = if(date.isSelected) RemindTheme.colors.white else RemindTheme.colors.slate_800 + ) + ) + Text( + text = date.date.dayOfMonth.toString(), + modifier = Modifier + .align(Alignment.CenterHorizontally) + .padding(vertical = 1.dp, horizontal = 7.dp) + .background(color = RemindTheme.colors.white, shape = CircleShape), + style = RemindTheme.typography.b2Medium.copy(color = RemindTheme.colors.slate_800) + ) + Spacer(modifier = modifier.height(3.dp)) + } + } +} +@Composable +fun EmptyMedicineList( + modifier: Modifier = Modifier +) { + Box( + modifier = modifier + .fillMaxWidth() + .border( + width = 1.dp, + color = RemindTheme.colors.grayscale_1, + shape = RoundedCornerShape(12.dp) + ) + ) { + Text( + modifier = modifier + .align(Alignment.Center) + .padding(vertical = 30.dp), + text = stringResource(id = R.string.등록된_약이_없어요), + style = RemindTheme.typography.c1Medium.copy(color = RemindTheme.colors.slate_400) + ) + } +} + +@Composable +fun EmptyTodayMoodContainer( + modifier: Modifier = Modifier, + clickToWrite: () -> Unit +) { + Box( + modifier = modifier + .fillMaxWidth() + .border( + width = 1.dp, + color = RemindTheme.colors.grayscale_1, + shape = RoundedCornerShape(12.dp) + ) + ) { + Image( + modifier = modifier + .padding( + start = 50.dp, + end = 50.dp, + top = 21.dp, + bottom = 70.dp + ) + .align(Alignment.Center), + painter = painterResource(id = R.drawable.img_emptymood), + contentDescription = null + ) + BasicButton( + modifier = modifier + .align(Alignment.BottomCenter) + .fillMaxWidth() + .padding(start = 53.dp, end = 54.dp, bottom = 31.dp), + text = stringResource(id = R.string.오늘의_기분_기록하기), + RoundedCorner = 29.dp, + backgroundColor = RemindTheme.colors.main_6, + textColor = RemindTheme.colors.white, + verticalPadding = 10.dp, + onClick = clickToWrite, + textStyle = RemindTheme.typography.b2Bold + ) + } +} +//다이얼로그 +@Composable +fun DialogContent() { + Column { + Spacer( + modifier = Modifier + .height(9.dp) + .fillMaxWidth() + ) + Text( + text = stringResource(id = R.string.약_미복용_사유), + textAlign = TextAlign.Center, + modifier = Modifier + .fillMaxWidth() + .wrapContentSize() + .padding(top = 9.dp), + style = RemindTheme.typography.b1Bold.copy(color = RemindTheme.colors.text) + ) + Spacer( + modifier = Modifier + .height(29.dp) + .fillMaxWidth() + ) + + } +} + + + +@RequiresApi(Build.VERSION_CODES.O) +@Preview +@Composable +fun HomePreview() { + EmptyTodayMoodContainer(clickToWrite = {}) +} diff --git a/app/src/main/java/com/example/remind/feature/screens/patience/MedicineScreen.kt b/app/src/main/java/com/example/remind/feature/screens/patience/MedicineScreen.kt index aaf729c..5affb14 100644 --- a/app/src/main/java/com/example/remind/feature/screens/patience/MedicineScreen.kt +++ b/app/src/main/java/com/example/remind/feature/screens/patience/MedicineScreen.kt @@ -4,16 +4,35 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.mutableStateListOf +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.sp - +import com.example.remind.core.designsystem.theme.RemindTheme +import com.patrykandpatrick.vico.compose.style.ChartStyle +import com.patrykandpatrick.vico.core.chart.line.LineChart +import com.patrykandpatrick.vico.core.entry.ChartEntryModelProducer +import com.patrykandpatrick.vico.core.entry.FloatEntry +import com.patrykandpatrick.vico.views.chart.line.lineSpec +//그래프 연습용 @Composable fun MedicineScreen(){ - Box(modifier = Modifier - .fillMaxSize(), - contentAlignment = Alignment.Center){ - Text(text = "ThirdScreen", - fontSize = 22.sp) - } +// val refreshDataset = remember { mutableIntStateOf(0) } +// val modelProducer = remember {ChartEntryModelProducer()} +// val datasetForModel = remember { mutableStateListOf() } +// val datasetLineSpec = remember{ arrayListOf() } +// LaunchedEffect(refreshDataset.intValue) { +// datasetForModel.clear() +// datasetLineSpec.clear() +// var xPos = 0f +// val dataPoints = arrayListOf() +// datasetLineSpec.add( +// ) +// } +// RemindTheme { +// +// } } \ No newline at end of file diff --git a/app/src/main/java/com/example/remind/feature/screens/patience/MoodChartScreen.kt b/app/src/main/java/com/example/remind/feature/screens/patience/MoodChartScreen.kt index 396255c..40cc517 100644 --- a/app/src/main/java/com/example/remind/feature/screens/patience/MoodChartScreen.kt +++ b/app/src/main/java/com/example/remind/feature/screens/patience/MoodChartScreen.kt @@ -2,19 +2,103 @@ package com.example.remind.feature.screens.patience import android.content.Context import android.util.Log +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Box 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.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Button import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.example.remind.R +import com.example.remind.core.common.component.BasicButton +import com.example.remind.core.common.component.BasicTextButton +import com.example.remind.core.designsystem.theme.RemindTheme +import com.example.remind.feature.screens.auth.onboarding.typeButton import com.kakao.sdk.auth.model.OAuthToken import com.kakao.sdk.common.model.ClientError import com.kakao.sdk.common.model.ClientErrorCause import com.kakao.sdk.user.UserApiClient +import com.patrykandpatrick.vico.compose.chart.Chart +import com.patrykandpatrick.vico.compose.style.ChartStyle +import com.patrykandpatrick.vico.views.chart.line.lineChart @Composable -fun MoodChartScreen(){ - val context = LocalContext.current - Column() { +fun MoodChartScreen() { + val scrollState = rememberScrollState() + RemindTheme { + Column( + modifier = Modifier + .padding(horizontal = 20.dp) + .verticalScroll(scrollState) + ) { + Spacer(modifier = Modifier.height(19.6.dp)) + Text( + text = stringResource(id = R.string.무드_차트), + style = RemindTheme.typography.h2Bold.copy(Color(0xFF303030)) + ) + Spacer(modifier = Modifier.height(22.dp)) + BasicTextButton( + modifier = Modifier.fillMaxWidth(), + backgroundColor = RemindTheme.colors.slate_600, + text = "17일째 연속으로 기록 중이에요! 파이팅:)", + textColor = RemindTheme.colors.slate_100, + onClick = { }, + verticalPadding = 6.dp, + enable = false + ) + Spacer(modifier = Modifier.height(12.dp)) + Text( + text = stringResource(id = R.string.주간_차트_기록), + style = RemindTheme.typography.b1Bold.copy(color = RemindTheme.colors.slate_800,) + ) + Spacer(modifier = Modifier.height(8.dp)) + BasicButton( + text = "기록 확인", + RoundedCorner = 12.dp, + backgroundColor = RemindTheme.colors.main_6, + textColor = RemindTheme.colors.white, + verticalPadding = 18.dp, + onClick = { }, + textStyle = RemindTheme.typography.b3Bold + ) } } +} + +//@Composable +//fun MoodChart( +// modifier: Modifier = Modifier +//) { +// Box( +// modifier = modifier +// .background(RemindTheme.colors.white, shape = RoundedCornerShape(12.dp)) +// .border(width = 1.dp, color = RemindTheme.colors.grayscale_2, shape = RoundedCornerShape(12.dp)) +// ) { +// Chart( +// modifier = modifier.align(Alignment.Center), +// chart = lineChart(), +// chartModelProducer = +// ) +// } +//} + +@Preview +@Composable +fun ChartPreview() { + +} diff --git a/app/src/main/res/drawable/ic_close.xml b/app/src/main/res/drawable/ic_close.xml new file mode 100644 index 0000000..0394d31 --- /dev/null +++ b/app/src/main/res/drawable/ic_close.xml @@ -0,0 +1,20 @@ + + + + diff --git a/app/src/main/res/drawable/ic_phone_fill.xml b/app/src/main/res/drawable/ic_phone_fill.xml new file mode 100644 index 0000000..37b91eb --- /dev/null +++ b/app/src/main/res/drawable/ic_phone_fill.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/ic_star_fill.xml b/app/src/main/res/drawable/ic_star_fill.xml new file mode 100644 index 0000000..8c48fbc --- /dev/null +++ b/app/src/main/res/drawable/ic_star_fill.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_star_unfill.xml b/app/src/main/res/drawable/ic_star_unfill.xml new file mode 100644 index 0000000..5be32c7 --- /dev/null +++ b/app/src/main/res/drawable/ic_star_unfill.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/img_example_cheer.xml b/app/src/main/res/drawable/img_example_cheer.xml new file mode 100644 index 0000000..9344325 --- /dev/null +++ b/app/src/main/res/drawable/img_example_cheer.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3df8b08..0d7e2fb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -24,6 +24,20 @@ 반갑습니다.\n%1$s 담당자 님! 반갑습니다. %1$s님! 시작하기 + 중요도 + 복용 + 미복용 + 약 미복용 사유 + + 무드 차트 + 주간 차트 기록 + + + 약 복용 체크 + 등록된 약이 없어요! + 오늘 하루 기분이 어떠셨나요? + 당신의 하루가 궁금해요 + 오늘의 기분 기록하기 사용 입장 선택 어떤 입장에서 사용하실지 선택해주세요!