-
Notifications
You must be signed in to change notification settings - Fork 12
Home
Welcome to the dagger2-clean-mvp-example wiki!
Here we will document some of the conventions followed during the Development
UI Classes conventions are the ones followed by Android, plus some more trivial ones
- activities: Must end with
Activity
. e.g.UserDetailActivity
,UsersActivity
- fragments: Must end with
Fragment
. e.g.UserProfileFragment
- CustomViews: Must end with
View
, e.g.GroupStatsView
- renderers: Must finish with
Renderer
- layouts: everything lowercase, words separated by underscores, starting with layout type
- view_group_stats.xml
- row_user.xml
- activity_users.xml
- fragment_user_profile.xml
- widgets: structure will be composed by:
- screen name separated by underscores
- type of widget (tv for
Textview
, et forEditText
, iv forImageView
, lyt for Layouts) - semantic name of the widget, optionally separated by underscores
- examples: user_profile_tv_name, user_detail_et_description
- type of widget prefixes:
-
tv_
forTextView
-
iv_
forImageView
-
et_
forEditText
-
btn_
forButton
or ProgressButtonView -
ibtn_
forImageButton
-
v_
forView
or exceptionally its semantic name -
scrv_
forScrollView
or exceptionallyscrollView
* -
pbr_
forProgressBar
or exceptionallyprogressBar
* -
rv_
forRecyclerView
or exceptionallyrecyclerView
*
-
- naming exceptions:
- If there is only one widget of a given type, exceptional names (*) can be used
- A
View
can be named with its role in the layout, e.g.users_list_separator
oruser_detail_vertical_padding
In Kotlin we will be using anko
, so widgets naming will be simpler. Rest will remain the same.
- widgets: structure will be composed by:
- widget type (tv, et, lyt, v, iv...)
- semantic name (title, fullDescription, text)
We will always keep semantic names as simple as possible. For example, we will use text
instead of fullDescription
or descriptiveText
We follow the checkstyle guide from square to manage the horizontal spacing, such as parentheses after if
or block openings.
For the vertical spacing, we only use two kinds of vertical spacing: Consecutive lines and one-line spacing. The last one is used to separate blocks that are logically or semantically independent and may need differentation. For the rest, consecutive lines will be used. A two or more-line vertical spacing won't be accepted.