Skip to content
Merged
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,8 @@ dependencies {

//실시간 위치
implementation(libs.play.services.location)

// 회원가입
implementation ("androidx.compose.foundation:foundation:1.4.0")

Comment on lines +96 to +98
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

뺏으니까 확인 필요하면 toml에 설정할 수 있도록 해주세요

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

넹!

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -152,7 +153,7 @@ fun CourseDetail(
style = PawKeyTheme.typography.caption12Sb1,
color = PawKeyTheme.colors.gray200
)
Divider(modifier = Modifier.padding(10.dp))
HorizontalDivider(modifier = Modifier.padding(10.dp))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

굿


Text(
text = "이런 점이 좋았어요",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.paw.key.core.designsystem.component

import androidx.compose.foundation.BorderStroke
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
Expand All @@ -11,11 +14,14 @@ import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.draw.clip
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.paw.key.core.designsystem.theme.PawKeyTheme
import com.paw.key.core.util.noRippleClickable


@Preview(showBackground = true)
Expand Down Expand Up @@ -91,7 +97,6 @@ fun PawkeyButton(
}

val borderColor = when {
isBorder -> Color.Transparent
enabled && isBackGround -> PawKeyTheme.colors.green500
!enabled && isBackGround -> PawKeyTheme.colors.gray200
else -> PawKeyTheme.colors.white1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ private fun PreviewSubChip() {
SubChip(
text = "4km"
)

}

@Composable
Expand All @@ -36,9 +35,7 @@ fun SubChip(
Text(
text = text,
color = PawKeyTheme.colors.gray300,

style = PawKeyTheme.typography.body14M
)
}

}
26 changes: 26 additions & 0 deletions app/src/main/java/com/paw/key/core/designsystem/theme/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ val PretendardRegular = FontFamily(Font(R.font.pretendard_regular, FontWeight.No
// Todo : 네이밍과 함께 나중에 lineHeight 등 변경 예정
@Stable
class PawKeyTypography internal constructor(
head24B: TextStyle,
head24Sb: TextStyle,
head22B: TextStyle,
head22Sb: TextStyle,
head20B1: TextStyle,
Expand All @@ -38,6 +40,10 @@ class PawKeyTypography internal constructor(
caption12M: TextStyle,
caption12R: TextStyle
) {
var head24B: TextStyle by mutableStateOf(head24B)
private set
var head24Sb: TextStyle by mutableStateOf(head24B)
private set
var head22B: TextStyle by mutableStateOf(head22B)
private set
var head22Sb: TextStyle by mutableStateOf(head22Sb)
Expand Down Expand Up @@ -70,6 +76,8 @@ class PawKeyTypography internal constructor(
private set

fun copy(
head24B: TextStyle = this.head24B,
head24Sb: TextStyle = this.head24Sb,
head22B: TextStyle = this.head22B,
head22Sb: TextStyle = this.head22Sb,
head20B1: TextStyle = this.head20B1,
Expand All @@ -86,6 +94,8 @@ class PawKeyTypography internal constructor(
caption12M: TextStyle = this.caption12M,
caption12R: TextStyle = this.caption12R
): PawKeyTypography = PawKeyTypography(
head24B,
head24Sb,
head22B,
head22Sb,
head20B1,
Expand All @@ -104,6 +114,8 @@ class PawKeyTypography internal constructor(
)

fun update(other: PawKeyTypography) {
head24B = other.head24B
head24Sb = other.head24Sb
head22B = other.head22B
head22Sb = other.head22Sb
head20B1 = other.head20B1
Expand Down Expand Up @@ -143,6 +155,20 @@ fun pawKeyTextStyle(
@Composable
fun pawKeyTypography(): PawKeyTypography {
return PawKeyTypography(
head24B = pawKeyTextStyle(
fontFamily = PretendardBold,
fontWeight = FontWeight.Bold,
fontSize = 24.sp,
lineHeight = (24 * 1.0).sp,
letterSpacing = TextUnit.Unspecified
),
head24Sb = pawKeyTextStyle(
fontFamily = PretendardSemiBold,
fontWeight = FontWeight.SemiBold,
fontSize = 24.sp,
lineHeight = (24 * 1.4).sp,
letterSpacing = TextUnit.Unspecified
),
head22B = pawKeyTextStyle(
fontFamily = PretendardBold,
fontWeight = FontWeight.Bold,
Expand Down
48 changes: 20 additions & 28 deletions app/src/main/java/com/paw/key/presentation/ui/home/HomeScreen.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

? 확인예정


package com.paw.key.presentation.ui.home

import android.app.Activity
Expand All @@ -14,15 +16,17 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
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.graphics.toArgb
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.view.ViewCompat
import androidx.hilt.navigation.compose.hiltViewModel
Expand All @@ -37,21 +41,28 @@ import com.paw.key.presentation.ui.home.component.TrackingCard
import com.paw.key.presentation.ui.home.component.WeatherCard
import com.paw.key.presentation.ui.home.viewmodel.HomeViewModel

@Preview
@Composable
private fun HomeScreenPreview() {
PawKeyTheme {
HomeScreen(
paddingValues = PaddingValues(),
navigateNext = {},)
}

}

@Composable
fun HomeRoute(
paddingValues: PaddingValues,
navigateUp: () -> Unit,
navigateNext: () -> Unit,
snackBarHostState: SnackbarHostState,
modifier: Modifier = Modifier,
viewModel: HomeViewModel = hiltViewModel(),
) {

HomeScreen(
paddingValues = paddingValues,
navigateUp = navigateUp,
navigateNext = navigateNext,
snackBarHostState = snackBarHostState,
modifier = modifier,
viewModel = viewModel
)
Expand All @@ -60,13 +71,11 @@ fun HomeRoute(
@Composable
fun HomeScreen(
paddingValues: PaddingValues,
navigateUp: () -> Unit,
navigateNext: () -> Unit,
snackBarHostState: SnackbarHostState,
modifier: Modifier = Modifier,
viewModel: HomeViewModel,
viewModel: HomeViewModel = hiltViewModel(),
) {
val isLocationMenuVisible = viewModel.isLocationMenuVisible
val state by viewModel.state.collectAsState()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

collectAsState는 Composable 앱이 백그라운드로 가거나 화면이 가려져도 Flow는 계속 데이터를 발행하고 이에 따라 UI 상태도 계속 업데이트될 수 있습ㄴ니다 그렇기에?! 안드로이드 생명주기에 맞게 조정될 수 있도록 collectAsStateWithLifecycle로 해주세요

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

생명주기 생각하면서 적용해보겠습니답

val view = LocalView.current
val window = (view.context as? Activity)?.window

Expand Down Expand Up @@ -113,7 +122,7 @@ fun HomeScreen(

Spacer(modifier = Modifier.width(12.dp))

TrackingCard(onClick = {navigateNext()})
TrackingCard(onClick = { navigateNext() })
}

Spacer(modifier = Modifier.height(12.dp))
Expand All @@ -124,7 +133,7 @@ fun HomeScreen(
}

}
if (isLocationMenuVisible) {
if (state.isLocationMenuVisible) {
Box(
modifier = Modifier
.fillMaxSize()
Expand All @@ -146,20 +155,3 @@ fun HomeScreen(
}
}
}

//@Preview
//@Composable
//private fun HomeScreenPreview() {
// PawKeyTheme {
// HomeScreen(
// paddingValues = PaddingValues(),
// navigateUp = {},
// navigateNext = {},
// snackBarHostState = SnackbarHostState(),
//
// )
//
// }
//
//}
// viewmodel 을 파라미터로 넣으면 못본다! 알고싶지않았음
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@ import com.paw.key.core.designsystem.theme.PawKeyTheme

@Preview(showBackground = true)
@Composable
private fun previewDaytimeCard() {
private fun PreviewDaytimeCard() {
PawKeyTheme {
DaytimeCard(daytime = "05:06", daystate = "일출")
}
}

@Composable
internal fun DaytimeCard(
fun DaytimeCard(
daytime: String,
daystate: String,
modifier: Modifier = Modifier,
) {
Box(
modifier = Modifier
modifier = modifier
.width(81.dp)
.height(110.dp)
.background(color = PawKeyTheme.colors.white1)
Expand All @@ -42,7 +43,6 @@ internal fun DaytimeCard(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(31.dp),
modifier = Modifier
.fillMaxWidth()
.fillMaxWidth()
.padding(horizontal = 11.dp, vertical = 12.dp),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ private fun PreviewHistoryCard() {
}

@Composable
internal fun HistoryCard(

fun HistoryCard(
modifier: Modifier = Modifier,
) {
Box(
modifier = Modifier
modifier = modifier
.fillMaxWidth()
.height(298.dp)
.clip(RoundedCornerShape(12.dp))
.background(
color = PawKeyTheme.colors.white2,
shape = RoundedCornerShape(12.dp)
),

) {
Column()
{
Column {
Box(
modifier = Modifier
.fillMaxWidth()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private fun PreviewHistoryChip() {
}

@Composable
internal fun HistoryChip(
fun HistoryChip(
text: String,
modifier: Modifier = Modifier,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ private fun PreviewRowCalendar() {
}

@Composable
internal fun RowCalendar(
fun RowCalendar(
date: String,
modifier: Modifier = Modifier,
) {
Box(
modifier = Modifier
modifier = modifier
.fillMaxWidth()
.height(103.dp)
.border(
Expand Down Expand Up @@ -100,11 +101,12 @@ internal fun RowCalendar(
private fun CalendarItem(
date: String,
day: String,
modifier: Modifier = Modifier,
state: Boolean = false,
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
modifier = modifier
.width(42.dp)
.height(74.dp),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private fun PreviewSettingButton() {
}

@Composable
internal fun SettingButton(){
fun SettingButton(){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

상위에서 하위 컴ㅁ포넌트를 아직은 조절하지 않더라도 꼭 선언해서 사용해주세요 재사용성을 위해 통로를 열어두는 것을 위해!

Box(
modifier = Modifier
.height(64.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private fun PreviewTopBar() {
}

@Composable
internal fun TopBar(
fun TopBar(
location: String,
onLocationClick: () -> Unit,
modifier: Modifier = Modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private fun PreviewTrackingCard() {
}

@Composable
internal fun TrackingCard(
fun TrackingCard(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

modifier .. ㅡㅡ

onClick: () -> Unit,
) {
Box(
Expand Down
Loading