- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Android Coding Convention
- 기본적으로 공식문서인 Kotlin Coding Conventions과 Kotlin style guide를 준수한다.
- 
안드로이드 스튜디오의 Optimize imports 기능과 Reformat Code 기능을 이용한다. 
- 
Optimize imports (Ctrl+Alt+O) : 사용하지 않는 Class를 import하고 있는 경우 제거해준다. 
- 
Reformat Code (Ctrl+Alt+L) : 코드의 Kotlin Style Guide를 적용하여 Code를 Reformat한다. 
- 
_ 방식으로 사용한다. 
- 
TextViewtv_
- 
ImageViewiv_
- 
EditTextet_
- 
Button, ImageButtonbtn_
- 
Toolbartb_
- 
ConstraintLayoutcl_
- 
LinearLayoutll_
- 
BottomNavigationViewbnv_
- 
Fragmentfr_
- 
Menumenu_
- 
custom view의 경우 prefix에 custom_ 를 추가한다. 
- 
_ 방식으로 사용한다. 
- 
Activityactivity_
- 
Fragmentfragment_
- 
Dialogdialog_
- 
CustomViewview_
- 
Itemitem_
예시
SignInActivity.kt → activity_sign_in.xml
CustomCalendarView.kt → view_custom_calendar.xml
- 
_ 방식으로 사용한다. 
- 
Iconic_
- 
Imageimg_
- 
Backgroundbg_
- 
selectorselector_
- 
Shape<shame>_<color>_<radius>_<value>
예시 : ic_error.xml, rectangle_yellow_radius_20.xml
- menu_ 방식으로 사용한다.
- 앞에 형용사를 붙여 색을 정의한다.
예시: dark_red , light_red
- 
WHERE/WHAT_DESCRIPTION 방식을 사용한다. 
- 
단, format string인 경우 format_<WHERE/WHAT>_ 방식을 사용한다. 
- MaterialComponents.에서 Component을 활용한다.
예시 : 
<style name="TextSubtitle1" parent="TextAppearance.MaterialComponents.Subtitle1">
        <item name="android:textColor">@color/shoppi_black_01</item>
</style>
- 
DO/WHAT 방식을 사용한다. 
- 
CRUD에 따른 함수명 
Create - create<WHAT>
Read - return 값이 있는 경우 : get<WHAT>, 없는 경우 : fetch<WHAT>
Update - update<WHAT>
Delete - delete<WHAT>
- 
Boolean Type은 앞에 is 또는 has를 붙인다. 약자로 줄여쓰지 않는다. 
- 
const 변수는 Upper snake case로 한다. 
- 방식을 사용한다.
예시 : UserData, UserRepository, UserDataSource