-
Notifications
You must be signed in to change notification settings - Fork 4
๐จ Resource Convention
yangsooplus edited this page Nov 7, 2022
·
1 revision
<WHAT>_<WHERE>
Prefix | ์ค๋ช |
---|---|
activity_ |
Activity์์ ์ฐ์ด๋ layout |
fragment_ |
Fragment์์ ์ฐ์ด๋ layout |
dialog_ |
Dialog์์ ์ฐ์ด๋ layout |
view_ |
CustomView์์ ์ฐ์ด๋ layout |
item_ |
RecyclerView, GridView, ListView๋ฑ์์ ViewHolder์ ์ฐ์ด๋ layout |
layout_ |
<include/> ๋ก ์ฌ์ฌ์ฉ๋๋ ๊ณตํต์ layout |
-
activity_main
: MainActivity์ layout -
fragment_request
: RequestFragment์ layout -
dialog_contact
: ๋ฌธ์์๋ด Dialog์ layout -
view_rating
: ์ปค์คํ ์ผ๋ก ๋ง๋ RatingView์ layout -
item_my_car
: ๋ด์ฐจ๋ ๋ชฉ๋ก์์ ์ฌ์ฉ๋๋ ๊ฐ๊ฐ์ item์ layout -
layout_dealer_review
: ์ฌ์ฌ์ฉ๋๋ ๋๋ฌ๋ฆฌ๋ทฐ layout
<WHAT>_<DESCRIPTION>
- View์ ๋๋ฌธ์๋ฅผ ์ถ์ฝํ์ฌ
<WHAT>
์ Prefix๋ก ์ฌ์ฉํ๋ค. - ์๋ ์ด๋ฆ๊ท์น์ ์ ์ฉํ๋ค.
- Android์ View๋ CamelCase์ ๋๋ฌธ์๋ฅผ ์ถ์ฝํ ํํ๋ก ์ ํ๋ค.
:
TextView -> tv_
- ๋ง์ฝ View์ ์ด๋ฆ์ด Space, Switch์ ๊ฐ์ด 1๊ฐ์ ๋๋ฌธ์๋ง ์กด์ฌํ๋ค๋ฉด ๋ชจ๋ ์๋ฌธ์์ธ ์์ด๋๋ก ์ ํ๋ค.
:
Switch -> switch_
- CustomView๋ ์ ์ฒดView์ ์ด๋ฆ์ snake case์ด๋ฆ์ผ๋ก ์ ํ๋ค.
:
MyCustomView -> my_custom_view
(๋ง์ฝ 1๊ฐ์ xml์ ๊ฐ์ ์ฌ๋ฌ CustomView๊ฐ ์กด์ฌํ๋ค๋ฉด<WHAT>_<DESCRIPTION>
์ ํํ๋ก ์ ํ๋ค.) - ์๋ํ์ ํด๋น View์ Prefix๊ฐ ์ ์๋์ด ์์ง ์๋ค๋ฉด ํ์์ ์์ํด์ ์ด๋ฆ์ ์ ํ๋ค ์ถ๊ฐํ๋ค.
View | Prefix |
---|---|
TextView | tv_ |
ImageView | iv_ |
CheckBox | cb_ |
RecyclerView | rv_ |
EditText | et_ |
ProgressBar | pb_ |
FrameLayout | fl_ |
NestedScrollView | nsv_ |
Space | space_ |
Switch | switch |
AbcDeFgh | adf_ |
Abcdef | abcdef_ |
MyCustomView | my_custom_view |
YourView | your_view |
- ํด๋น View๋ฅผ ํน์ ๊ธฐ๋ฅ๊ณผ ์๊ด์์ด
VISIBLE/GONE
๋ฑ์ View์ ์ฉ๋๋ก ์ฌ์ฉํ๋ค๋ฉดview_xxx
๋ก ์ฌ์ฉํ๋๊ฒ๋ ํ์ฉํ๋ค. - ๋ฒํผ๊ธฐ๋ฅ์ ์ํ View๋ ImageView, TextView๋ก๋ง ์ฌ์ฉํ๋ค. (Button, ImageButton์ ์กด์ฌ์ ์๋ฏธ๊ฐ ์์)
- ํน์ ์ปดํฌ๋ํธ์ ๋ํ ์ ๋ชฉ : tv__label [์์]
- CardView๋ Fragment ๊ฐ์ ์ปดํฌ๋ํธ์ ๊ฒฝ์ฐ์๋ tv_title / tv_description
-
iv_close
: ๋ซ๊ธฐ ImageView -
tv_select
: ์ ํ TextView -
rv_car_list
: ์๋์ฐจ ๋ชฉ๋ก RecyclerView -
view_etc_model
: ๊ธฐํ ๋ชจ๋ธ ํ๋ฉด LinearLayout
<WHAT>(_<WHERE>)_<DESCRIPTION>(_<SIZE>)
- ์ด๋ฏธ์ง๊ฐ ์ฌ๋ฌ๊ตฐ๋ฐ์์ ํ์ฉ๋ ๊ฒฝ์ฐ,
<WHERE>
๋ ์๋ต ๊ฐ๋ฅํ๋ค. - ์ด๋ฏธ์ง์ ํฌ๊ธฐ๊ฐ 1๊ฐ๋ฐ์ ์๋ ๊ฒฝ์ฐ,
<SIZE>
๋ ์๋ต ๊ฐ๋ฅํ๋ค.
Prefix | ์ค๋ช |
---|---|
btn_ |
๋ฒํผ์ผ๋ก ์ฐ์ด๋ ์ด๋ฏธ์ง |
ic_ |
๋ฒํผ์ด ์๋ ํ๋ฉด์ ๋ณด์ฌ์ง๋ ์ด๋ฏธ์ง |
bg_ |
๋ฒํผ์ด ์๋ ํ๋ฉด์ ๋ณด์ฌ์ง๋ ์ด๋ฏธ์ง |
img_ |
์ค์ ์ฌ์ง์ด๊ฑฐ๋ ์์ด์ฝํํ๊ฐ ์๋ ์ผ๋ฌ์คํธํํ์ ์ด๋ฏธ์ง |
div_ |
divider๋ก ํ์ฉ๋๋ ์ด๋ฏธ์ง |
- ๋ฐฐ๊ฒฝ์ด๋ ๋ฒํผ์์ View์ ์ํ์ ๋ฐ๋ผ์ drawable์ด ๋ณํด์ผ ํ๋ ๊ฒฝ์ฐ์ ๋ํ ์ด๋ฆ์ ์๋์ ๊ฐ๋ค.
์ํ | Suffix |
---|---|
Normal | _normal |
Pressed | _pressed |
Focused | _focused |
Disabled | _disabled |
Selected | _selected |
- ๋ฐฐ๊ฒฝ์์ด pressed์ํ์ ๋ฐ๋ผ์ white -> sky_blue๋ก ๋ณํ๋ ๊ฒฝ์ฐ๋
bg_white_to_sky_blue.xml
๋ก ํ๋ค. - ๋ฐฐ๊ฒฝ์ด white์์ 24dp๋ก corner ๊ทธ๋ฆฌ๋ ๊ฒฝ์ฐ๋
bg_white_radius_24dp.xml
๋ก ํ๋ค. - ๋ฐฐ๊ฒฝ์ด ํฌ๋ช
ํ๋ฉฐ ๋ฐฐ๊ฒฝ์ ์ ๋ง์ sky_blue์์ 8dp๋ก corner ๊ทธ๋ฆฌ๋ ๊ฒฝ์ฐ๋
bg_stroke_sky_blue_radius_8dp.xml
๋ก ํ๋ค.
-
img_xxx
์ ๊ฒฝ์ฐ ํ์ผ์ ํฌ๊ธฐ๊ฐ ํฐ๊ฒฝ์ฐ๊ฐ ๋ง์ผ๋ฏ๋ก tinypng์์ ํ์ผํฌ๊ธฐ๋ฅผ ์ค์ธ๋ค์ ์ถ๊ฐ ํด์ฃผ์ด์ผ ํ๋ค. (GitHub imgbot์ ์ฌ์ฉํ๋ค๋ฉด ์๋ต ๊ฐ๋ฅ)- ๋๋ถ๋ถ ์ฉ๋์ด ํฐ ํ์ผ์ด์ด์ xxxhdpi์๋ง ๋ฃ๋๋ค.
-
btn_call_normal.png
: ์ ํ๊ฑธ๊ธฐ ๋ฒํผ ์ด๋ฏธ์ง -
btn_call_pressed.png
: ์ ํ๊ฑธ๊ธฐ ๋ฒํผ ๋๋ ธ์๋์ ์ด๋ฏธ์ง -
btn_call.xml
: ์ ํ๊ฑธ๊ธฐ ๋ฒํผ ์ด๋ฏธ์ง์ selector xml -
ic_dealer_gift.png
: ๋๋ฌ๊ฐ ๋ณด๋ด์ค ๊ธฐํํฐ์ฝ์ ๋ณด์ฌ์ค๋ ํ์๋๋ ์ด๋ฏธ์ง -
img_splash_chart.png
: ์คํ๋์ ํ๋ฉด์์ ๋ณด์ฌ์ง๋ ์ฐจํธ ์ด๋ฏธ์ง
<WHERE>_<DESCRIPTION>
- ํน์ ํ๋ฉด์์ ์ฐ์ด๋ ํ
์คํธ ์๋๋ผ ์ฌ๋ฌ๊ตฐ๋ฐ์์ ๊ณตํต์ผ๋ก ์ฌ์ฌ์ฉ๋ ํ
์คํธ๋ผ๋ฉด
all_<DESCRIPTION>
๋ก ์ด๋ฆ์ ์ง๋๋ค
-
permission_dialog_camera_title
: ์นด๋ฉ๋ผ๊ถํ์ ์๊ตฌํ๋ Dialog์ ์ ๋ชฉ -
permission_dialog_camera_description
: ์นด๋ฉ๋ผ๊ถํ์ ์๊ตฌํ๋ Dialog์ ์ค๋ช ๋ด์ฉ -
all_yes
: ๋ค -
all_ok_understand
: ์ฌ๋ฌ Dialog์์๋ค, ์๊ฒ ์ต๋๋ค
๋ก ์ฐ์ด๋ ๊ณตํต์ ํ ์คํธ
- ๋ฌธ๋จํํ์ ๊ธด ๋ฌธ์์ด๋ก ๊ฐํ(
\n
)์ด ํ์ํ ๊ฒฝ์ฐ,\n
์ ๋ค์์ค์ ์์ ์ด๋ค.
<string name="sample">๋ฌธ๋จ ์ฒซ๋ฒ์งธ์ค
\n๋ฌธ๋จ ๋๋ฒ์งธ์ค
\n๋ฌธ๋จ ์ธ๋ฒ์งธ์ค</string>
- Theme๋
theme.xml
, Style์style.xml
์ ์ถ๊ฐํ๋ค. - 1๋ฒ๋ง ์ฐ์ด๋ ๊ฒฝ์ฐ์๋ style์ ๋ง๋ค์ง ์๋๋ค. (๋จ, ์์ผ๋ก ์ฌ์ฌ์ฉ๋ ๊ฐ๋ฅ์ฑ์ด ๋์ ๊ฒฝ์ฐ์๋ ๊ฐ๋ฅ)
- ๋ชจ๋ style์ parent๋ฅผ ๊ฐ๋๋ค.
- style์ ์ด๋ฆ์ parent์ ์ด๋ฆํจํด๊ณผ ๋ง์ถ๋ค
<style name=โWidget.HeyDealer.Buttonโ parent=โ@style/Widget.AppCompat.Buttonโ>
...
</style>
- parent์์ ์ผ๋ถ ๋ด์ฉ๋ง ์์ ํ๊ณ ์ ํ๋๊ฒฝ์ฐ, parent์ด๋ฆ ๋ค์ ๋ฌ๋ผ์ง ๋ด์ฉ์ ๋ด์ฉ์ ์ถ๊ฐํด์ค๋ค
<style name="Theme.HeyDealer.Transparent" parent="Theme.HeyDealer">
...
</style>
- Base Style๊ณผ Theme์ ๊ฒฝ์ฐ๋ ์์
Base
๋ฅผ ๋ถ์ธ๋ค.
<style name="Base.Theme" parent="..." />
<style name="Base.Theme.Transparent">...</style>
<style name="HeyDealerTheme" parent="Base.Theme">...</style>
<style name="HeyDealerTheme.Transparent" parent="Base.Theme.Transparent" />
<style name="Base.TextAppearance.HeyDealer" parent="...">...</style>
<style name="Base.TextAppearance.HeyDealer.Headline">...</style>
<style name="TextAppearance.HeyDealer.Headline1" parent="Base.TextAppearance.HeyDealer.Headline">...</style>
<style name="TextAppearance.HeyDealer.Headline2" parent="Base.TextAppearance.HeyDealer.Headline">...</style>
- Attribute์ด๋ฆ์
camelCase
๋ก ํ๋ค.
<attr name="numStars" format="integer" />
- ๊ธฐ์กด์ ์ ์๋์ด์๋
android:xxx
์ ๊ฐ์ ๋์์ ์ ๋ํ๋ ๊ฒฝ์ฐ, ์ด tag๋ฅผ ์ฌ์ฌ์ฉํ๋ค.
<declare-styleable name="SpannedGridLayoutManager">
<attr name="android:orientation" />
...
</declare-styleable>
-
android:xxxLeft/android:xxxRight
๋์android:xxxStart/android:xxxEnd
๋ก ์ฌ์ฉํ๋ค.(๊ธฐํ Left/Right๋ก ์ฌ์ฉํ๋ ๋ถ๋ถ ๋ชจ๋)
- ๋ฐ์ฝ๋์ ๋ํด ์์๋ณด์!
- ์คํฌ๋กค์ด ์ ์ด์ํ๊ฒ ๋์ํ ๊น
- Room ์์ Flow ๋ก ๋ฐํ๋ฐ์์ StateFlow ๋ก ์ฌ์ฉํ๊ธฐ
- Jetpack Compose์์ ์ํ๋ฅผ ๊ด๋ฆฌํ๋ ๋ฒ
- ์๋๋ก์ด๋์์ ์ง๋ฌธ ์ธ์ฆ ํ๊ธฐ!
- Firebase Google ๋ก๊ทธ์ธ ์ธํ ์ค ๊ฒช์ ์ค๋ฅ
- ์ํ์ ์ viewModelScope.launch ์ด์ธ์ฌ๊ฑด ์์ฌ์ผ์ง
- ์ฟ! KeyStore๊ณผ Cipher
- WorkManager ์๋ฆผ๊ณผ ์์ ฏ์ ์ฌ์ฉํด๋ณด์!
- ์ ๋๋ฉ์ด์ ์ผ๋ก ์ก์ ์จ๊ฒฐ ๋ถ์ด๋ฃ๊ธฐ
- ๋ฒกํฐ ์ด๋ฏธ์ง๋ฅผ ํธ์งํด๋ณด์!
- ItemDecorator ๋ฅผ ์ด์ฉํ ์์ดํ Offset ์ค์ !
- String Resource ViewModel ์์ ์์ํ๊ฒ ์จ๋ณด์
- ๋ฆฌ๋ทฐ์ด ๋ฑ๋ก์ ์๋์ผ๋ก ํด๋ณด์
- Mockk์ ํ์ฉํ ํ ์คํธ
- ๊ฒ์ ๊ฒฐ๊ณผ๋ฅผ Room์ ์บ์ฑํด๋ณด์!
- Room One to Many
- CustomException ๊ณผ Result๋ฅผ ์ ๊ทน ํ์ฉํด๋ณด์!
- View์ Event๋ฅผ ์ฒ๋ฆฌํ๊ธฐ ์ํ ์ํ ํด๋์ค๋ฅผ ๋ง๋ค์ด๋ณด์!
- WorkManager ์๋ฆผ๊ณผ ์์ ฏ์ ์ฌ์ฉํด๋ณด์!