Skip to content

Development convention

yujin45 edited this page Nov 7, 2024 · 3 revisions

โœ… string resource ๊ด€๋ฆฌ ๊ทœ์น™

  • ๋นˆ ์ค„๋กœ ๊ฐ ํ™”๋ฉด ์˜์—ญ์—์„œ ์“ฐ์ด๋Š” ๊ฒƒ ๊ตฌ๋ถ„ํ•ด์ฃผ๊ธฐ
  • ๊ฐ ํ™”๋ฉด ๋ณ„ ์–ด๋–ค ๋ฌธ์žฅ์ด๊ณ  ์–ด๋–ค VIEW์ธ์ง€ ์“ฐ๊ธฐ
  • ์Šค๋„ค์ดํฌ๋กœ ์ž‘์„ฑ

์˜ˆ์‹œ

  • uiํ™”๋ฉด_์ง์—ญ_button
  • uiํ™”๋ฉด_์ง์—ญ_description
<string name="login_screen_login_button">๋กœ๊ทธ์ธ</string>
<string name="login_screen_login_button_description">๋ˆ„๋ฅด๋ฉด ๋กœ๊ทธ์ธ ํ•˜๋Š” ๋ฒ„ํŠผ</string>

<string name="photo_screen_tree_image_view_title">๋‚ด๊ฐ€ ์ฐ์€ ๋‚˜๋ฌด</string>
<string name="photo_screen_tree_image_view_description">๋‚ด๊ฐ€ ์ฐ์€ ๋‚˜๋ฌด ์‚ฌ์ง„</string>

โ“ ์™œ ์ด๋ ‡๊ฒŒ 1:1 ๋Œ€์‘์œผ๋กœ ๊ด€๋ฆฌํ•˜๋Š”๊ฐ€?

  • ๋™์ผํ•œ string resource๋กœ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค ๊ฐ component ๋ณ„ string resource๋ฅผ ๋ถ„๋ฆฌํ•˜์—ฌ ๊ด€๋ฆฌํ•˜๋ฉด ์ข‹์€ ์ 
    • UI ๋””์ž์ธ ์š”๊ตฌ์‚ฌํ•ญ์ด ๋ณ€๊ฒฝ๋˜์—ˆ์„ ๋•Œ ์ˆ˜์ •์ด ์šฉ์ดํ•˜๋‹ค.
    • XML์„ ์ฐพ์ง€ ์•Š๊ณ  string ํŒŒ์ผ๋งŒ ๋ณด๊ณ  ์š”๊ตฌ์‚ฌํ•ญ์„ ์ˆ˜์ •์„ ๋ฐ˜์˜ํ•  ์ˆ˜ ์žˆ๋‹ค. ๐Ÿ‘
  • ์ฆ‰, ์œ ์ง€๋ณด์ˆ˜์„ฑ๊ณผ ํŽธ๋ฆฌ์„ฑ์ด ์ข‹์•„์ง„๋‹ค.

โœ… XML์˜ id ๊ทœ์น™

  • ์•„๋ž˜์˜ ๋งํฌ์— ๋ช…์‹œ๋œ ๋Œ€๋กœ ์ง„ํ–‰ํ•˜๊ธฐ

https://github.com/PRNDcompany/android-style-guide/blob/main/Resource.md

โœ… Room DB ๋„ค์ด๋ฐ ๊ทœ์น™

  • @Entity, @ColumnInfo๋ฅผ ๋ชจ๋‘ ๋ช…์‹œํ•œ๋‹ค.
  • tableName๊ณผ column name์€ snake ํ˜•์‹์œผ๋กœ ์ž‘์„ฑํ•œ๋‹ค.
@Entity(tableName = "label")
data class Label(
    @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") val id: Int,
    @ColumnInfo(name = "back_color") val backgroundColor: String,
    @ColumnInfo(name = "name") val name: String
)

โœ… commit ์ „ ์ฒดํฌํ•  ํ•ญ๋ชฉ

  • ๊ณ ์ฐจํ•จ์ˆ˜ it ๋Œ€์‹  ๋ณ€์ˆ˜๋ช… ์ง€์ •ํ•ด์ฃผ๊ธฐ (ํƒ€์ž…์€ X)
  • button ๋“ฑ์˜ ์•„์ง ๊ฐœ๋ฐœ ์ „์ธ onClick์— TODO๋กœ ์ฃผ์„ ์จ์ฃผ๊ธฐ
Button(
            onClick = {/*TODO*/},
  • ํŒŒ๋ผ๋ฏธํ„ฐ ๋ช…์‹œํ•˜๊ธฐ!
  RadioButton(
      selected = selected,
      {}, // <- onClick = { .. } ์œผ๋กœ ์ˆ˜์ •ํ•˜๊ธฐ!
      modifier = modifier
          .size(24.dp)
  )
  • enabledEgeToEdge ์ œ๊ฑฐํ•˜๊ธฐ (scaffold๊ฐ€ ์—ญํ•  ๋Œ€์‹ )
  • commit ์ „ import ์ •๋ฆฌํ•˜๊ธฐ
  • commit ์ „ ์ž๋™ ์ •๋ ฌํ•˜๊ธฐ
  • ํŒŒ์ผ ๋ Enter ์ถ”๊ฐ€ํ•˜๊ธฐ
    • ์•„๋ž˜์™€ ๊ฐ™์ด ํ‘œ์‹œ๋˜๋ฉด ์•ˆ๋จ

      image

โœ… ์ ‘๊ทผ์„ฑ ๊ด€๋ จ

  • description ์ถ”๊ฐ€ํ•˜๊ธฐ
  • role ์ถ”๊ฐ€ํ•˜๊ธฐ

โœ… Preview ๊ด€๋ จ

  • ์•„๋ž˜์ฒ˜๋Ÿผ uiMode Configuration ์ƒ๋žตํ•˜๊ณ  ๋ฐ”๋กœ ์“ฐ๊ธฐ
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_YES)
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_NO)
@Composable
fun HomePreview() {
    NatureAlbumTheme {
        HomeScreen {}
    }
}

๐ŸŽจ ๊ธฐํš ๋ฐ ๋””์ž์ธ


โค๏ธ ๊ทธ๋ผ์šด๋“œ ๋ฃฐ


๐Ÿ“š ๋ฌธ์„œ


๐Ÿ“‘ ๋ฏธํŒ… ๊ธฐ๋ก

๋ฐ์ผ๋ฆฌ ์Šคํฌ๋Ÿผ

1์ฃผ์ฐจ

2์ฃผ์ฐจ

3์ฃผ์ฐจ

4์ฃผ์ฐจ

5์ฃผ์ฐจ

ํšŒ์˜๋ก

1์ฃผ์ฐจ

2์ฃผ์ฐจ

3์ฃผ์ฐจ

4์ฃผ์ฐจ

5์ฃผ์ฐจ


Clone this wiki locally