-
Notifications
You must be signed in to change notification settings - Fork 35
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
base: ethanchaee
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λμ€ν¬ μΊμλ μ΄λ€ μ΄μ λ‘ μ½λλ₯Ό μΆκ°νμ
¨λμ§ μ μ μμκΉμ?
Coilμμ κΈ°λ³Έμ μΌλ‘ λμμ νκ³ μλκ²μΌλ‘ μκ³ μμ΅λλ€.
modifier = Modifier | ||
.fillMaxWidth() | ||
.aspectRatio(1f), |
There was a problem hiding this comment.
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 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ§κΈ ꡬνμμλ μ₯λ°κ΅¬λ λ²νΌμ νμ 보μ΄λλ°μ.
μ΄ μ»΄ν¬λνΈλ₯Ό μ¬μ©νλ μ
μ₯μμλ showCartButton = falseλΌκ³ μ§μ νλ©΄, λ²νΌμ΄ μ보μΈλ€κ³ μκ°νλκ² μμ°μ€λ½μ§ μμκΉμ?
κ²°κ΅ λΉμ·ν μ¬λ‘κ° μκΈΈλλ§λ€ νλΌλ―Έν°λ‘ μμ²λκ² λ§μ νλκ° νμνκ² λ ν
λ° κ·Έλ΄ λ μ΄λ»κ² λμν κ²μΈμ§ κΆκΈν©λλ€.
μλ₯Ό λ€μ΄ μ‘μ
λ²νΌμ μ’
λ₯κ° 10κ°κ° λκ³ νλ©΄ μ΄λμ΄ μμκ°μ§λΌλ©΄μ?
class ActionButtonParameterProvider : CollectionPreviewParameterProvider<String>( | ||
listOf( | ||
"λ²νΌ", | ||
"κΈ΄ μ΄λ¦μ λ²νΌ κ²½μ°λ ν μ€νΈ ν΄λ³΄κ³ μΆμ΄μ κΈ΄ μ΄λ¦μ λ²νΌ κ²½μ°λ ν μ€νΈ ν΄λ³΄κ³ μΆμ΄μ κΈ΄ μ΄λ¦μ λ²νΌ κ²½μ°λ ν μ€νΈ ν΄λ³΄κ³ μΆμ΄μ κΈ΄ μ΄λ¦μ λ²νΌ κ²½μ°λ ν μ€νΈ ν΄λ³΄κ³ μΆμ΄μ", | ||
"", | ||
) | ||
) |
There was a problem hiding this comment.
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 { ... }
}
}
onClick = { | ||
context.toProductCart(model) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ»΄ν¬μ λΈ λ΄μμ νλ©΄μ μ΄λνλ λ°©λ²λ μ’μ΅λλ€. μ΄λ₯Ό ν μ€νΈ νκΈ° μν΄ κ³ λ―Όν΄μ£Όμ κ² ν¬ν¨ν΄μμ
κ·Έλ°λ° νλ©΄ μ΄λμ΄λΌλ κ²μ κ²°κ΅ μ»¨νΈλ‘€λ¬(μ‘ν°λΉν°)μ μν μ΄λΌκ³ μκ°μ ν©λλ€.
νΉμ μ»΄ν¬μ λΈμ΄ μ λ§ νλ©΄μ κ°νκ² κ²°ν©λμ΄ μμ΄ λ΄λΆμμ μ΄λμ ν μλ μκ² μ§λ§ μ μ΄λ νλ©΄ μ΄λκ³Ό κ°μ κ²μ ν
μ€νΈνκΈ° μ λ§ μ΄λ ΅κ² λ§λ€μ΄μ§λλ€.
κ·Έλ κΈ°μ λλ€λ₯Ό λμ΄μ¬λ €μ ν μ€νΈ κ°λ₯ν κ²κ³Ό ν μ€νΈ νκΈ° μ΄λ €μ΄ κ²μ λΆλ¦¬νλ μ°μ΅μ΄ νμν©λλ€.
ProductDetailScreen(
onCartButtonClick: () -> Unit
...
)
λμκ° νλ©΄ μ΄λμ ν
μ€νΈ νλ κ²μ UI ν
μ€νΈμλ μ΄μ§ λ€λ₯Έ ν΅ν© ν
μ€νΈ κ΄μ μμ λ°λΌλ΄μΌ ν©λλ€.
μ€μ ꡬνμμλ λ€νΈμν¬ μ½μ΄λ λ·°λͺ¨λΈ λΉμ¦λμ€ λ‘μ§ λ± μ¬λ¬κ°μ§ λ¬Έμ μ μ§λ©΄νκ² λλκΉμ.
onBackButtonClick = { | ||
onBackPressedDispatcher.onBackPressed() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
λ€λ‘κ°κΈ°λ₯Ό Dispatchersλ₯Ό μ΄μ©ν΄μ νΈμΆμ νμλκ΅°μ!?
μ λ μ‘ν°λΉν°λ©΄ κ΄μ±μ²λΌ Activity.onBackPressed()λ₯Ό νΈμΆνλ λ²λ¦ μ²λΌ λλ²λ Έλλ° νλ λ°°μ μ΅λλ€.
Scaffold( | ||
modifier = Modifier.fillMaxSize(), | ||
) { innerPadding -> | ||
ProductDetailScreen( | ||
model = intent.getProductModel(), | ||
modifier = Modifier.padding(innerPadding), | ||
onBackButtonClick = { | ||
onBackPressedDispatcher.onBackPressed() | ||
} | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μκΈ°μλ Scaffoldκ° κ·Έλ€μ§ μλ―Έκ° μμ΄λ³΄μ΄μ§ μμμ.
ProductDetailScreen λ΄λΆμ Scaffoldκ° μμ΄μΌ μμ°μ€λ½μ§ μμκΉμ?
ꡬν
μμ§λ, step2 리뷰λ μλΆνλλ €μ :)
Activity κ΄μ μμ ν μ€νΈ νλ €λ€ λ³΄λ, ActivitySenario κ° μ μ νμ§ μμ κ² κ°μμ μ°Ύμ보λ IntentsRule λΌλκ² μμ΄μ μ¬μ©ν΄λ΄€μ΅λλ€.