Naming Convention - avinotec/Stundenplaner.FHE_EAH GitHub Wiki
We are using the conventions from here.
Layout files should match the name of the Android components that they are intended for, e.g. layout for SignInActivity should be named activity_sign_in.xml. Note that android will throw errors if you want to use anything except lower case letters and underscore in the file names (yes, no numbers or minus).
Layouts that are going to be inflated by an Adapter to populate a ListView
should start with "item_".
Examples:
Component | Class Name | Layout Name |
---|---|---|
Activity | MapsActivity | activity_maps.xml |
Fragment | MyTimeTableCalendarFragment | fragment_mytimetable_calendar.xml |
AdapterView item | -- | item_timetable_event.xml |
IDs of layouts like Textview, Listview, etc. and file names of drawables should be composed of <what>_<description>
. The description is usually composed of featurename_content. Content can be anything that is necessary for unterstanding what this drawable is or does. The ID is written in camel case, that is lower case used with underscore.
Examples:
Type | Prefix | Id |
---|---|---|
Button | btn_ | btn_mytimetable_calendar_modify_schedule |
TextView | tv_ | tv_mytimetable_coursetitle |
ListView | lv_ | lv_mytimetable_calendar_courses |
ViewPager2 | viewpager_ | viewager_navigation_dialog |
Icon | ic_ | ic_next_plan.xml |
Shape for Button | buttonshape_ | buttonshape_filled.xml and buttonshape_filled_disabled.xml |
Menu | menu_ | menu_maps.xml |
In case of a single activity/fragment plus a fragment with settings for the feature (e.g. Canteen), the main part is called FeatureName and settings are called FeatureNameSettings, resulting in file names like FeatureNameView.java, FeatureNameFragment.java and FeatureNameSettingsView.java, FeatureNameSettingsFragment.java.
In case of a feature with a main part and a previous fragment for input dialog (e.g. TimeTable or Navigation), use FeatureName (or the convention for several feature parts decribed further down) for all files concerning the main part and FeatureNameDialog for the files concerning the dialog.
If a feature is composed of several parts (e.g. Navigation or MyTimeTable), the name of a file should intuitively make clear which part of the feature the file is belonging to. Especially if the main part is not obvious, then don't name one part FeatureNamePartName and leave another to FeatureName!
We follow the guidelines decribed here.
We want to point out to this field naming conventions:
- Non-public, non-static field names start with m
- public static final fields (constants) are ALL_CAPS_WITH_UNDERSCORES
- all other fields are in mixed case starting with a lower case letter