Follow the official Android code style guidelines: http://source.android.com/source/code-style.html
Use 4 spaces per indentation level and no tabs.
Stick within the 120 char line limit. Use line breaks to split up code according to the style guidelines.
Code should not have any trailing whitespace to avoid creating unnecessary diff issues. Please setup your IDE to remove these as a save action.
Please setup your IDE to remove all unused imports as a save action.
Use 4 spaces per indentation level and no tabs. Each attribute should appear on its own line.
XML tags should be ordered as follows: 'xmlns' first, then id, then layout_width and layout_height then alphabetically.
Add a space between the closing slash and the final attribute. E.g. android:textSize="10dp" />
Automatic formatting rules for our coding standards are stored in an Android Studio file inside the root of this repository. Please use File > Import Settings and select "android_studio_settings.jar" to ensure you get the same rules.
Layout resource ids should use the following naming convention where possible:
<layout name>_<object type>_<object name>
E.g.
home_listview_hotels
hotel_item_imageview_star_rating
Given a layout called profile.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- Avatar icon -->
<ImageView
android:id="@+id/profile_imageview_avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Any new classes that are committed must include a class descriptor Javadoc along with:
@author name@address.com
Javadoc any public methods, variables and constants. Javadoc private methods where beneficial.
Use in-line commenting to help the next developer who might be editing your code, even if it seems obvious now. Inline comments should appear on the line above the code your are commenting.
Comment XML View elements using <!-- Comment -->
.
No commented out code must be committed unless you have a very good reason that is clearly described in a comment by the code you are ommitting.
For further details on branching strategies used at ustwo please see: https://www.ustwo.com/blog/branching-strategies-with-git/