Skip to content

Instantly share code, notes, and snippets.

@RaulitoGC
Last active September 11, 2020 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RaulitoGC/abbaf4d019408dbc2c4d1c218ccf3319 to your computer and use it in GitHub Desktop.
Save RaulitoGC/abbaf4d019408dbc2c4d1c218ccf3319 to your computer and use it in GitHub Desktop.
Android template Names

Naming Convention

In order to make the code look consistent cross modules, we have decided to come up with naming conventions.

Item Naming Convention Example
Modules Bank-<name> Bank -login
Packages <main_package>.<name> com.bank.login
Android/Architecture Components <name><component> LoginViewModel
Arguments ARG_<name> ARG_EMAIL = "email"
Preferences KEY_<name> KEY_EMAIL = "com.bank.email"
XML Files <what>_<description>
  • activity_login.xml
  • fragment_login.xml
  • dialog_change_password.xml (layouts for any kind of dialog)
  • content_login_header.xml (specific layouts to be used within other layouts)
  • menu_login.xml
  • view_login.xml (custom views XML base specification)
  • item_login.xml (items for lists)
  • Resource Strings <what>_<description>
  • label_username (Messages, warnings, descriptions)
  • hint_username (Default description that appears within any kind of input)
  • title_login (For titles/subtitles and any kind of header text)
  • Resource Drawables <what>_<description>
  • ic_user_profile_photo.xml (Images/Icons)
  • bg_rounded_blue.xml (Backgrounds / Selectors)
  • color_button_blue (Colors under color directory)
  • view_circle_loading.xml (Custom drawable views)
  • Resource Dimensions {where}_<what>_{size}
  • size_10dp
  • width_10dp
  • toolbar_height
  • notification_header_padding_top_30dp (Works for padding & margins)
  • text_size_10sp
  • Resource Colors <name>_<value> blue_light
    Resource View IDs <prefix> + <description>
  • ly + Login (Any kind of layouts such as Constraints/AppBar/Linear and so on)
  • btn + Login (Any kind of button, such as Button, ImageButton, RadioButton, ToggleButton and so on)
  • tv + Username (All sort of non-editable labels such as TextViews)
  • et + Username (All sort of editable text inputs such as EditTexts)
  • chk + Policy (All views that require a check/uncheck interaction such as CheckBoxes)
  • img + Photo (All views that are used to show images such as ImageViews)
  • Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment