-
Notifications
You must be signed in to change notification settings - Fork 9
Naming & Architecture of Files
Classes must be CamelCase formatted. For specific package suffixes read the Architecture of directories page.
This attributes must begin with letter ‘m’ and then the representative name in camelcase.
e.g. mEmailEditText
Static final attributes must be in upper case underscores separated.
e.g. PARAM_USER_NAME
type_name
e.g. shape_circle_indicator_unselected.xml
ic_name
e.g. ic_star
-
For activities:
activity_name
e.g. activity_main
-
For fragments:
fragment_name
e.g. fragment_sign_in
-
For list view items:
item_name
e.g. item_user
-
For layouts that will be included in different files:
layout_name
e.g. layout_banner
-
For components that will be included in different files:
componentname
e.g. tool_bar
context_layoutname_description_viewtype
(viewtype name must be formatted with the lateral standard attached at the bottom of this page)
e.g. activity_login_password_et
context_description
e.g. activity_login_password_hint
colorname_number
e.g. red_1
Colors related to the app style will be named as primary, primary_light, primary_dark
context_viewtype_description
Description refers to the property e.g. margin, padding, height, width, etc.
e.g. activity_list_item_padding_top
The style name must be a simple description with CamelCase.
e.g. FacebookButton
- TextView: tv
- EditText: et
- ImageView: iv
- Switch: sw
- ListView: lv
- RecyclerView: rv
- FloatingActionButton: fab
- Button: bt
- Checkbox: cb
- RadioButton: rb
- RadioGroup: rg
- TableLayout: tl
- TableRow: tr
- RelativeLayout: rl
- LinearLayout: ll
- GridLayout: gl
- ScrollView: sv
- NestedScrollView: nsv
For these files please follow this structure:
Atributes
- Static and final.
- Data structure. (e.g. ListView, ArrayList, HashMap, Array)
- UI variables following the order that they have in the layout.
- Other.
Methods
- Constructor
- Lifecycle (e.g. onCreate(), onStart(), onResume())
- UI events (e.g. onClick())
- Public methods
- Protected methods
- Private methods
- Callbacks
- System events (e.g. onSaveInstanceState(), onBackPressed())
It's important that on every case we have to respect the order public, protected, private.
This files must be structured in groups of elements divided by their context. This means that in a first group or block we will add items of a specific activity or fragment, and then we will create another block for the next activities or fragments that we create.
As an example, here's a simple string file:
<!-- Home -->
<string name="home_drawer_open">Abierto</string>
<string name="home_drawer_close">Cerrado</string>
<string name="home_search_title">Buscar</string>
<string name="home_search_hint">¿Qué estás buscando?</string>
<string name="home_menu_clear_searchbar">Borrar</string>
<string name="home_menu_voice_recognition">Buscar por voz</string>
<string name="home_no_location_toast_message">No tienes una ubicación definida</string>
<!-- Sign In -->
<string name="sign_in_toolbar_title">Iniciar sesión</string>
<string name="sign_in_google_bt">Ingresar con Google</string>
<string name="sign_in_facebook_bt">Ingresar con Facebook</string>
<string name="sign_in_progress_dialog_title">Iniciando sesión</string>
<string name="sign_in_progress_dialog_text">Esto tomará solo unos segundos…</string>
<string name="sign_in_error_message">No pudimos registrarte, por favor intenta nuevamente.</string>