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

πŸš€ 2단계 - μž₯λ°”κ΅¬λ‹ˆ(μƒν’ˆ 상세) #81

Open
wants to merge 5 commits into
base: ethanchaee
Choose a base branch
from

Conversation

ethanchaee
Copy link

κ΅¬ν˜„

  • μƒν’ˆ 상세화면
  • μƒν’ˆ 상세화면 이동
    • μƒν’ˆ λͺ©λ‘μ—μ„œ μƒν’ˆ 클릭 μ‹œ, μƒν’ˆ μƒμ„Έν™”λ©΄μœΌλ‘œ 이동
    • λ’€λ‘œκ°€κΈ° λ²„νŠΌ λ˜λŠ” μ•„μ΄μ½˜ 클릭 μ‹œ, 직전 ν™”λ©΄μœΌλ‘œ 이동
  • μž₯λ°”κ΅¬λ‹ˆ ν™”λ©΄
  • μž₯λ°”κ΅¬λ‹ˆ ν™”λ©΄ 이동
    • μƒν’ˆ λͺ©λ‘μ—μ„œ μž₯λ°”κ΅¬λ‹ˆ μ•„μ΄μ½˜ 클릭 μ‹œ, μž₯λ°”κ΅¬λ‹ˆ ν™”λ©΄μœΌλ‘œ 이동
    • μƒν’ˆ μƒμ„Έμ—μ„œ μž₯λ°”κ΅¬λ‹ˆ λ‹΄κΈ° λ²„νŠΌ 클릭 μ‹œ, μž₯λ°”κ΅¬λ‹ˆ ν™”λ©΄μœΌλ‘œ 이동
    • λ’€λ‘œκ°€κΈ° λ²„νŠΌ λ˜λŠ” μ•„μ΄μ½˜ 클릭 μ‹œ, 직전 ν™”λ©΄μœΌλ‘œ 이동

μ˜μ§λ‹˜, step2 리뷰도 μž˜λΆ€νƒλ“œλ €μš” :)

Activity κ΄€μ μ—μ„œ ν…ŒμŠ€νŠΈ ν•˜λ €λ‹€ λ³΄λ‹ˆ, ActivitySenario κ°€ μ μ ˆν•˜μ§€ μ•Šμ€ 것 κ°™μ•„μ„œ μ°Ύμ•„λ³΄λ‹ˆ IntentsRule λΌλŠ”κ²Œ μžˆμ–΄μ„œ μ‚¬μš©ν•΄λ΄€μŠ΅λ‹ˆλ‹€.

@ethanchaee ethanchaee changed the title Step2 πŸš€ 2단계 - μž₯λ°”κ΅¬λ‹ˆ(μƒν’ˆ 상세) Feb 14, 2025
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.

2단계 λ―Έμ…˜ 고생 ν•˜μ…¨μŠ΅λ‹ˆλ‹€.

μ»΄ν¬μ €λΈ”μ—μ„œ 화면을 μ΄λ™ν•˜λ‹€λ³΄λ‹ˆ Intentλ₯Ό λΉ„λ‘―ν•΄ ν…ŒμŠ€νŠΈλ₯Ό μœ„ν•œ μ—¬λŸ¬ 고민을 많이 ν•˜μ‹  λͺ¨μŠ΅μ΄ λ„ˆλ¬΄ μ’‹μ•˜μŠ΅λ‹ˆλ‹€.

λ‹€λ§Œ 우리의 λͺ©ν‘œλŠ” 이처럼 ν…ŒμŠ€νŠΈ ν•˜κΈ° μ–΄λ €μš΄ 것을 보닀 ν…ŒμŠ€νŠΈ ν•˜κΈ° 쉽도둝 λ‚˜λˆ„λŠ” μ—°μŠ΅μ„ ν•˜λŠ” 것에 있기 λ•Œλ¬Έμ— κ΄€λ ¨ν•΄μ„œ λͺ‡κ°€μ§€ μ˜κ²¬μ„ 같이 λ“œλ ΈμŠ΅λ‹ˆλ‹€.

κ·Έ 점을 μΆ©λΆ„νžˆ μΈμ§€ν•œ μƒνƒœμ—μ„œ μ§€κΈˆμ˜ 도전을 ν•˜μ‹œλŠ” 점이라면 λ‚¨κ²¨μ£Όμ„Έμš”. :)
μ°Έκ³ ν•΄μ„œ 리뷰 ν•˜λ„λ‘ ν•˜κ² μŠ΅λ‹ˆλ‹€.

AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(imageUrl)
.diskCacheKey(id.toString())

Choose a reason for hiding this comment

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

λ””μŠ€ν¬ μΊμ‹œλŠ” μ–΄λ–€ 이유둜 μ½”λ“œλ₯Ό μΆ”κ°€ν•˜μ…¨λŠ”μ§€ μ•Œ 수 μžˆμ„κΉŒμš”?
Coilμ—μ„œ 기본적으둜 λ™μž‘μ„ ν•˜κ³  μžˆλŠ”κ²ƒμœΌλ‘œ μ•Œκ³  μžˆμŠ΅λ‹ˆλ‹€.

Comment on lines +33 to +35
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f),

Choose a reason for hiding this comment

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

별도 μ»΄ν¬λ„ŒνŠΈλ‘œ 뢄리할 λ•Œ 크기 μ œμ•½μ‚¬ν•­μ„ κ·ΈλŒ€λ‘œ μ‚¬μš©ν•˜λŠ” 것은 λ‹€μ†Œ μœ„ν—˜ν•©λ‹ˆλ‹€.
κ°€λ Ή, λ‚˜λŠ” 썸넀일 이미지λ₯Ό μ •μ‚¬κ°ν˜•μ΄ μ•„λ‹Œ λ‹€λ₯Έ 크기둜 그리고 μ‹Άλ‹€κ³  ν•˜λ”λΌλ„ 항상 μ •μ‚¬κ°ν˜•μœΌλ‘œ λ‚˜μ˜€κ²Œ λ©λ‹ˆλ‹€.

xml μ—μ„œλ„ layout_height, layout_widthλŠ” 직접 μ§€μ •ν•˜λŠ” 것 처럼 ν¬κΈ°λŠ” μ™ΈλΆ€μ—μ„œ 넣어쀄 수 μžˆλ„λ‘ ν•˜λŠ” 방법이 μ’‹μŠ΅λ‹ˆλ‹€.

Thumbnail(modifier: Modifier = Modifier) {
   AsyncImage(modifier = modifier.xxx)
}

@@ -46,7 +50,7 @@ fun ShoppingCartTopBar(
},
actions = {
TopBarIcon(
onClick = onClickCart,
onClick = { context.toProductCart() }.takeIf { showCartButton },

Choose a reason for hiding this comment

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

μ§€κΈˆ κ΅¬ν˜„μ—μ„œλŠ” μž₯λ°”κ΅¬λ‹ˆ λ²„νŠΌμ€ 항상 λ³΄μ΄λŠ”λ°μš”.
이 μ»΄ν¬λ„ŒνŠΈλ₯Ό μ‚¬μš©ν•˜λŠ” μž…μž₯μ—μ„œλŠ” showCartButton = false라고 μ§€μ •ν•˜λ©΄, λ²„νŠΌμ΄ μ•ˆλ³΄μΈλ‹€κ³  μƒκ°ν•˜λŠ”κ²Œ μžμ—°μŠ€λŸ½μ§€ μ•Šμ„κΉŒμš”?

κ²°κ΅­ λΉ„μŠ·ν•œ 사둀가 μƒκΈΈλ•Œλ§ˆλ‹€ νŒŒλΌλ―Έν„°λ‘œ μ—„μ²­λ‚˜κ²Œ λ§Žμ€ ν•„λ“œκ°€ ν•„μš”ν•˜κ²Œ 될텐데 그럴 땐 μ–΄λ–»κ²Œ λŒ€μ‘ν•  것인지 κΆκΈˆν•©λ‹ˆλ‹€.
예λ₯Ό λ“€μ–΄ μ•‘μ…˜ λ²„νŠΌμ˜ μ’…λ₯˜κ°€ 10κ°œκ°€ λ„˜κ³  ν™”λ©΄ 이동이 μˆ˜μ‹­κ°€μ§€λΌλ©΄μš”?

Comment on lines +5 to +11
class ActionButtonParameterProvider : CollectionPreviewParameterProvider<String>(
listOf(
"λ²„νŠΌ",
"κΈ΄ μ΄λ¦„μ˜ λ²„νŠΌ κ²½μš°λ„ ν…ŒμŠ€νŠΈ 해보고 μ‹Άμ–΄μš” κΈ΄ μ΄λ¦„μ˜ λ²„νŠΌ κ²½μš°λ„ ν…ŒμŠ€νŠΈ 해보고 μ‹Άμ–΄μš” κΈ΄ μ΄λ¦„μ˜ λ²„νŠΌ κ²½μš°λ„ ν…ŒμŠ€νŠΈ 해보고 μ‹Άμ–΄μš” κΈ΄ μ΄λ¦„μ˜ λ²„νŠΌ κ²½μš°λ„ ν…ŒμŠ€νŠΈ 해보고 μ‹Άμ–΄μš”",
"",
)
)

Choose a reason for hiding this comment

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

PreviewParameterλ₯Ό μ‚¬μš©ν•΄μ„œ ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€λ₯Ό μž‘μ„±ν•˜λŠ” 방법도 μ’‹μ•„μš”.
λ‹€λ§Œ 맀번 λ§Œλ“€κΈ° λ²ˆκ±°λ‘­κ±°λ‚˜ ν•  κ²½μš°μ—λŠ” κ·Έλƒ₯ ν•˜λ‚˜μ˜ ν…ŒμŠ€νŠΈμ—μ„œ μ—¬λŸ¬κ°œλ₯Ό μž‘μ„±ν•˜λŠ” 방법도 μžˆμŠ΅λ‹ˆλ‹€.

참고만 ν•΄μ£Όμ„Έμš”~

fun Preview() {
   val texts = listOf("λ²„νŠΌ", "...", "...")
   Column {
       texts.forEach { ... }
   }
}

Comment on lines +81 to +83
onClick = {
context.toProductCart(model)
},

Choose a reason for hiding this comment

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

컴포저블 λ‚΄μ—μ„œ 화면을 μ΄λ™ν•˜λŠ” 방법도 μ’‹μŠ΅λ‹ˆλ‹€. 이λ₯Ό ν…ŒμŠ€νŠΈ ν•˜κΈ° μœ„ν•΄ κ³ λ―Όν•΄μ£Όμ‹  것 ν¬ν•¨ν•΄μ„œμš”

그런데 ν™”λ©΄ μ΄λ™μ΄λΌλŠ” 것은 κ²°κ΅­ 컨트둀러(μ•‘ν‹°λΉ„ν‹°)의 역할이라고 생각을 ν•©λ‹ˆλ‹€.
νŠΉμ • 컴포저블이 정말 화면에 κ°•ν•˜κ²Œ κ²°ν•©λ˜μ–΄ μžˆμ–΄ λ‚΄λΆ€μ—μ„œ 이동을 ν•  μˆ˜λ„ μžˆκ² μ§€λ§Œ 적어도 ν™”λ©΄ 이동과 같은 것은 ν…ŒμŠ€νŠΈν•˜κΈ° 정말 μ–΄λ ΅κ²Œ λ§Œλ“€μ–΄μ§‘λ‹ˆλ‹€.

그렇기에 λžŒλ‹€λ₯Ό λŒμ–΄μ˜¬λ €μ„œ ν…ŒμŠ€νŠΈ κ°€λŠ₯ν•œ 것과 ν…ŒμŠ€νŠΈ ν•˜κΈ° μ–΄λ €μš΄ 것을 λΆ„λ¦¬ν•˜λŠ” μ—°μŠ΅μ΄ ν•„μš”ν•©λ‹ˆλ‹€.

ProductDetailScreen(
   onCartButtonClick: () -> Unit
   ...
) 

λ‚˜μ•„κ°€ ν™”λ©΄ 이동을 ν…ŒμŠ€νŠΈ ν•˜λŠ” 것은 UI ν…ŒμŠ€νŠΈμ™€λŠ” 살짝 λ‹€λ₯Έ 톡합 ν…ŒμŠ€νŠΈ κ΄€μ μ—μ„œ 바라봐야 ν•©λ‹ˆλ‹€.
μ‹€μ œ κ΅¬ν˜„μ—μ„œλŠ” λ„€νŠΈμ›Œν¬ μ½œμ΄λ‚˜ λ·°λͺ¨λΈ λΉ„μ¦ˆλ‹ˆμŠ€ 둜직 λ“± μ—¬λŸ¬κ°€μ§€ λ¬Έμ œμ— μ§λ©΄ν•˜κ²Œ λ˜λ‹ˆκΉŒμš”.

Comment on lines +23 to +25
onBackButtonClick = {
onBackPressedDispatcher.onBackPressed()
}

Choose a reason for hiding this comment

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

λ’€λ‘œκ°€κΈ°λ₯Ό Dispatchersλ₯Ό μ΄μš©ν•΄μ„œ ν˜ΈμΆœμ„ ν•˜μ‹œλŠ”κ΅°μš”!?
μ €λŠ” μ•‘ν‹°λΉ„ν‹°λ©΄ κ΄€μ„±μ²˜λŸΌ Activity.onBackPressed()λ₯Ό ν˜ΈμΆœν•˜λŠ” 버릇 처럼 λ˜λ²„λ ΈλŠ”λ° ν•˜λ‚˜ λ°°μ› μŠ΅λ‹ˆλ‹€.

Comment on lines +19 to +29
Scaffold(
modifier = Modifier.fillMaxSize(),
) { innerPadding ->
ProductDetailScreen(
model = intent.getProductModel(),
modifier = Modifier.padding(innerPadding),
onBackButtonClick = {
onBackPressedDispatcher.onBackPressed()
}
)
}

Choose a reason for hiding this comment

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

μš”κΈ°μ„œλ„ Scaffoldκ°€ 그닀지 μ˜λ―Έκ°€ μžˆμ–΄λ³΄μ΄μ§€ μ•Šμ•„μš”.
ProductDetailScreen 내뢀에 Scaffoldκ°€ μžˆμ–΄μ•Ό μžμ—°μŠ€λŸ½μ§€ μ•Šμ„κΉŒμš”?

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