Skip to content

Conversation

@ChaMinZi
Copy link

2๋‹จ๊ณ„ ๋ฆฌ๋ทฐ ์ž˜ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค ๐Ÿ™‡โ€โ™€๏ธ

[ ๊ธฐ๋Šฅ ์ถ”๊ฐ€ ์‚ฌํ•ญ ]

  1. ์นด๋“œ ๋ชฉ๋ก ํ™”๋ฉด์„ ๊ตฌํ˜„ํ•˜์—ฌ ์นด๋“œ ์ถ”๊ฐ€ ํ™”๋ฉด๊ณผ ์—ฐ๊ฒฐ
    • navigation ์ด์šฉ
  2. ์ƒˆ๋กœ์šด ์นด๋“œ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์„ ๋•Œ ์นด๋“œ ๋ชฉ๋ก์ด ์—…๋ฐ์ดํŠธ
  3. ์นด๋“œ ๋ชฉ๋ก ์ƒํƒœ์— ๋”ฐ๋ฅธ UI ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ๋…ธ์ถœํ•œ๋‹ค.
    • ์นด๋“œ ๋ชฉ๋ก์ด ๋น„์–ด์žˆ์„ ๋•Œ์—๋Š” "์ƒˆ๋กœ์šด ์นด๋“œ๋ฅผ ๋“ฑ๋กํ•ด์ฃผ์„ธ์š”" ์•ˆ๋‚ด๊ฐ€ ๋…ธ์ถœ
    • ์นด๋“œ ๋ชฉ๋ก์— ์นด๋“œ๊ฐ€ ํ•œ ๊ฐœ ์žˆ์„ ๋•Œ์˜ ์นด๋“œ ์ถ”๊ฐ€ UI๋Š” ๋ชฉ๋ก ํ•˜๋‹จ์— ๋…ธ์ถœ
    • ์นด๋“œ ๋ชฉ๋ก์— ์นด๋“œ๊ฐ€ ์—ฌ๋Ÿฌ ๊ฐœ ์žˆ์„ ๋•Œ์˜ ์นด๋“œ ์ถ”๊ฐ€ UI๋Š” ์ƒ๋‹จ๋ฐ”์— ๋…ธ์ถœ

Screen shot

Screen_recording_20250323_232847.mp4

ChaMinZi added 15 commits March 19, 2025 14:34
change
- CreditCardUiState ์ถ”๊ฐ€
- Card ๋ชฉ๋ก ๊ฐœ์ˆ˜์— ๋”ฐ๋ฅธ ์ปดํฌ๋„ŒํŠธ ๋ถ„๋ฆฌ
Copy link

@laco-dev laco-dev left a comment

Choose a reason for hiding this comment

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

๊ตฌํ˜„ํ•ด์ฃผ์‹  ๊ฒƒ ์ž˜ ๋ดค์Šต๋‹ˆ๋‹ค.
๋„ค๋น„๊ฒŒ์ด์…˜์„ ์‚ฌ์šฉํ•ด์ฃผ์‹  ๊ฒƒ๊ณผ ๋„๋ฉ”์ธ ๋กœ์ง์„ ๊ผผ๊ผผํžˆ ์ž‘์„ฑํ•ด์ฃผ์‹  ์  ์ธ์ƒ๊นŠ๊ฒŒ ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ ๋ทฐ๋ชจ๋ธ ํ•˜๋‚˜๋กœ ๋ชจ๋“  ๋กœ์ง์„ ๋‹ค ๋„ฃ์€ ์ ์€ ์กฐ๊ธˆ ์•„์‰ฌ์› ์Šต๋‹ˆ๋‹ค.
๋ช‡๊ฐ€์ง€ ์˜๊ฒฌ ๋‚จ๊ฒจ๋“œ๋ ธ์œผ๋‹ˆ ํ™•์ธ ํ•ด์ฃผ์„ธ์š”.

์ •๊ทœ ๊ฐ•์˜ ์‹œ๊ฐ„์€ ๋ชจ๋‘ ์ข…๋ฃŒ๋˜์–ด์„œ 24์‹œ๊ฐ„ ๋‚ด์— ๋ฆฌ๋ทฐ ๋‹ต๋ณ€์„ ๋“œ๋ฆฌ์ง€ ๋ชปํ•  ํ™•๋ฅ ์ด ๋†’์Šต๋‹ˆ๋‹ค.
์ด ์  ์–‘ํ•ด ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

Comment on lines 32 to 38
PaymentCardsScreen(
uiState = creditCardUiState,
onAddClick = {
navController.navigate(Destination.ADD_CARD.name)
},
modifier = Modifier.fillMaxSize()
)

Choose a reason for hiding this comment

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

ํ•˜๋‚˜์˜ ๋ทฐ๋ชจ๋ธ์—์„œ ๋ชจ๋“  ์ฒ˜๋ฆฌ๊ฐ€ ์ด๋ฃจ์–ด ์ง€๊ณ  ์žˆ๋Š”๋ฐ,
PaymentCardsScreen์„ ์œ„ํ•œ ๋ทฐ๋ชจ๋ธ์„ ๊ฐ€์ง€๋„๋ก ๋งŒ๋“ค์–ด๋ณด์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

Comment on lines 3 to 11
interface Card {
val cardNumber: String
val expiredDate: String
val ownerName: String
val password: String

fun getFormattedCardNumber(): String
fun getFormattedExpiredDate(): String
} No newline at end of file

Choose a reason for hiding this comment

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

Card๋ฅผ ์ธํ„ฐํŽ˜์ด์Šค๋กœ ๋งŒ๋“  ์ด์œ ๊ฐ€ ์žˆ์„๊นŒ์š”?

Copy link
Author

@ChaMinZi ChaMinZi Apr 2, 2025

Choose a reason for hiding this comment

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

์ดํ›„ ์‹ ์šฉ/์ฒดํฌ/๋ฉค๋ฒ„์‹ญ ์นด๋“œ ๋“ฑ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์นด๋“œ๋กœ ๋ถ„๋ฆฌ๋  ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™๊ณ , ๊ฐ ๋ณ€์ˆ˜๋Š” ์นด๋“œ๋ผ๋ฉด ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๋Š” ๊ฐ’์œผ๋กœ ๋ณด์—ฌ interface ๋กœ ์ž‘์„ฑํ•ด๋ดค์Šต๋‹ˆ๋‹ค : )

Comment on lines 29 to 33
is CreditCardUiState.One -> OneCardScreen(
card = uiState.card,
modifier.padding(innerPadding),
onAddClick
)

Choose a reason for hiding this comment

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

์–ด๋–ค๊ฑด ์ด๋ฆ„์„ ์ง€์ •ํ•˜๊ณ  ์–ด๋–ค๊ฑด ์•ˆํ•˜๊ณ  ํ•˜๋‹ค๋ณด๋ฉด ๊ฐ€๋…์„ฑ์ด ๋งŽ์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค. ๋ชจ๋‘ ์ด๋ฆ„์„ ์ง€์ •ํ•ด์ฃผ๋ฉด ์–ด๋–จ๊นŒ์š”?

Comment on lines 29 to 38
if (uiState is CreditCardUiState.Many) {
Text(
text = stringResource(R.string.add),
fontSize = 18.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(end = 16.dp)
.clickable { onAddClick() }
)
}

Choose a reason for hiding this comment

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

TopBar๊ฐ€ "์ถ”๊ฐ€" ๋ฒ„ํŠผ๋งŒ ๊ฒฐ์ •ํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™์€๋ฐ UiState์— ์˜์กดํ•  ํ•„์š”๊ฐ€ ์žˆ์„๊นŒ์š”?

Comment on lines 32 to 41
Box(
contentAlignment = Alignment.BottomCenter,
modifier = modifier
.shadow(8.dp)
.size(width = 208.dp, height = 124.dp)
.background(
color = Color(0xFF333333),
shape = RoundedCornerShape(5.dp),
)
) {

Choose a reason for hiding this comment

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

๋ชจ์–‘์„ ๋น„๋กฏํ•œ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์„ค์ •์„ ์œ„ํ•ด์„œ Surface๋ฅผ ํ™œ์šฉํ•ด๋ณด์…”๋„ ์ข‹์Šต๋‹ˆ๋‹ค.

Comment on lines 22 to 26
LazyColumn(
modifier = modifier.padding(top = 12.dp),
verticalArrangement = Arrangement.spacedBy(36.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {

Choose a reason for hiding this comment

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

LazyColumn์˜ contentPaddding์€ Modifier.padding()๊ณผ ์–ด๋–ค ์ฐจ์ด๊ฐ€ ์žˆ์„๊นŒ์š”?

Copy link
Author

Choose a reason for hiding this comment

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

item์˜ ๊ฐœ์ˆ˜๊ฐ€ ๋Š˜์–ด๋‚ฌ์„ ๋•Œ, ์ฐจ์ด๊ฐ€ ์•„๋ž˜์™€ ๊ฐ™์ด ๋ณด์ด๋Š” ๊ฒƒ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค!
contentPadding์„ ์ ์šฉํ–ˆ์„ ๋•Œ์™€ ๊ฐ™์ด ๋™์ž‘ํ•  ๊ฒƒ์ด๋ผ ์ƒ๊ฐํ–ˆ๋Š”๋ฐ, UI ํ™•์ธ ์‹œ ์ข€ ๋” ์„ธ์‹ฌํžˆ ๋ด์•ผ๊ฒ ๋„ค์š”๐Ÿ˜ญ๐Ÿ˜ญ
๊ผผ๊ผผํ•œ ๋ฆฌ๋ทฐ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

[Modifier.padding() ์ ์šฉ์‹œ]

[LazyColumn์˜ contentPadding ์ ์šฉ์‹œ]

Comment on lines 27 to 33
items(cards) {
PaymentCard(
cardNumber = it.getFormattedCardNumber(),
expiredDate = it.getFormattedExpiredDate(),
ownerName = it.ownerName
)
}

Choose a reason for hiding this comment

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

items๋ฅผ ์ง€์ •ํ•  ๋•Œ key๊ฐ’์„ ๋ช…์‹œํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.
์ด key๊ฐ’์ด ์–ด๋–ค ๋™์ž‘์„ ํ•˜๋Š”์ง€๋Š” ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ  ํ•ด๋ณด์„ธ์š”
https://developer.android.com/develop/ui/compose/lists?hl=ko#item-keys

Comment on lines 43 to 46
navigateToCardList = {
navController.popBackStack()
newCardViewModel.resetAddCard()
},

Choose a reason for hiding this comment

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

์ฐธ๊ณ ๋กœ navigate { ... } ๋ฅผ ํ• ๋•Œ ํŠน์ • Stack๊นŒ์ง€ Popup์„ ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ด์šฉํ•ด์„œ ํ™”๋ฉด์„ ์ด๋™ํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

Comment on lines 9 to 23
override fun getFormattedCardNumber(): String {
return cardNumber.chunked(4)
.mapIndexed { index, part ->
if (index in 2..3) {
"****"
} else {
part
}
}
.joinToString("-")
}

override fun getFormattedExpiredDate(): String {
return expiredDate.chunked(2).joinToString(" / ")
}

Choose a reason for hiding this comment

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

ํฌ๋งคํŒ… ํ•ด์„œ ๋ฌธ์ž์—ด์„ ์ถœ๋ ฅํ•˜๋Š” ๊ฒƒ์€ ๋ชจ๋ธ์ด ํ•  ์ผ์ธ๊ฐ€์š”? UI๊ฐ€ ํ•  ์ผ์ธ๊ฐ€์š”?

ChaMinZi added 2 commits April 2, 2025 15:03
change
- Main Screen ๋ณ„๋กœ ViewModel ๋‚˜๋ˆ„๊ธฐ (NewCardScreen, PaymentCardsScreen)
- ์ปดํฌ์ €๋ธ” ํ•จ์ˆ˜ ์‚ฌ์šฉ ์‹œ, ๋ชจ๋“  ๋งค๊ฐœ๋ณ€์ˆ˜๋ช… ์ง€์ •
- PaymentCardsTopBar์—์„œ CreditCardUiState ์˜์กด์„ฑ ์ œ๊ฑฐ
- Box ๋Œ€์‹  Surface ์‚ฌ์šฉํ•˜์—ฌ ์Šคํƒ€์ผ ์ง€์ •
- LazyColumn items์— Key ์ง€์ •
- CardNumber, ExpiredDate ํฌ๋งทํŒ…์„ UI ๋ ˆ์ด์–ด์—์„œ ์ฒ˜๋ฆฌํ•˜๋„๋ก ๋ณ€๊ฒฝ
change
- navigate ์‹œ ํŠน์ • Stack๊นŒ์ง€ Popupํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ด์šฉํ•˜์—ฌ ์ด๋™ํ•˜๋„๋ก ์ˆ˜์ •
@ChaMinZi
Copy link
Author

ChaMinZi commented Apr 2, 2025

์•ˆ๋…•ํ•˜์„ธ์š”! 2๋‹จ๊ณ„ ๋ฆฌ๋ทฐ ์‚ฌํ•ญ๋“ค ๋ฐ˜์˜ํ•˜์˜€์Šต๋‹ˆ๋‹ค!
์‹œ๊ฐ„ ๋˜์‹ค ๋•Œ ํ™•์ธ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค~

Copy link

@laco-dev laco-dev left a comment

Choose a reason for hiding this comment

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

๊ณ ์ƒ ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค.

์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋‹ค ํ•ด๋ณด๊ธฐ์—๋Š” ๋ฏธ์…˜ ๋ฒ”์œ„๋‚˜ ์š”๊ตฌ์‚ฌํ•ญ์ด ์ ์ ˆํ•˜์ง€๋Š” ์•Š์•„์„œ ์ง€๊ธˆ์€ ์ต์ˆ™ํ•ด์ง€๋Š” ์ •๋„๋กœ๋งŒ ๋ด์ฃผ์‹œ๊ณ  ๋‚˜์ค‘์— ๋” ์—ฐ์Šตํ•˜์‹ค ๊ธฐํšŒ๊ฐ€ ๋งŽ์„๊ฑฐ์—์š”.

Comment on lines +20 to +23
NavigateScreen(
newCardViewModel = newCardViewModel,
paymentCardViewModel = paymentCardViewModel
)
Copy link

Choose a reason for hiding this comment

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

hiltViewModel์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์œผ๋ฉด ๋ทฐ๋ชจ๋ธ์„ ์œ„์—์„œ ๋ชจ๋‘ ์ดˆ๊ธฐํ™” ํ•˜๊ณ  ๋‚ด๋ ค์ค˜์•ผ ํ•  ๊ฒƒ ๊ฐ™๊ตฐ์š”.

์ง€๊ธˆ์€ ์•„๋‹ˆ์ง€๋งŒ, ๋‚˜์ค‘์— ๋” ์—ฐ์Šตํ•˜์‹ค ๋•Œ๋Š” ์ฐธ๊ณ ํ•ด๋ณด์‹œ๋ฉด ๋„์›€์ด ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
https://medium.com/kenneth-android/compose-hiltviewmodel-%EA%B3%BC-viewmodel-%EC%B0%A8%EC%9D%B4-6d5412efcb19

Comment on lines +65 to +67
@Preview
@Composable
private fun ManyPaymentCardsPreview() {
Copy link

Choose a reason for hiding this comment

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

๋งˆ์ด๋„ˆํ•œ ๋ถ€๋ถ„์ด์ง€๋งŒ, Preview ํ•จ์ˆ˜ ์ด๋ฆ„์„ ๋งค๋ฒˆ ๋งŒ๋“œ๋Š”๊ฒŒ ๋ฒˆ๊ฑฐ๋กœ์›Œ์„œ ์ €๋Š” ๊ฐœ์ธ์ ์œผ๋กœ ์ด๋ ‡๊ฒŒ ์ž‘์„ฑํ•˜๊ณ ๋Š” ํ•ฉ๋‹ˆ๋‹ค.
ํŒ€๋งˆ๋‹ค ์‚ฌ๋žŒ๋งˆ๋‹ค ๋‹ค๋ฅด๋”๋ผ๊ตฌ์š”

@Preview(name = "...")
fun Preview1() 

...

@laco-dev laco-dev merged commit a350895 into next-step:chaminzi Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants