Giter Site home page Giter Site logo

android-convention-cheatsheet's Introduction

Table of contents

Classes & Layouts

Component Class Name Layout Name
Activity UserProfileActivity activity_user_profile.xml
Fragment SignUpFragment fragment_sign_up.xml
Dialog ChangePasswordDialog dialog_change_password.xml
Adapter ChatAdapter ---
AdapterView item --- item_person.xml
Partial layout --- partial_stats_bar.xml

Layout resource IDs

Component Prefix Example
Button btn_ btn_signup_dialog.xml
TextView tv_ tv_user_status.xml
EditText et_ et_password.xml
ImageView iv_ iv_top_logo.xml
RelativeLayout rl_ rl_root.xml
LinearLayout ll_ ll_root.xml
ListView lv_ lv_messages.xml
RecyclerView rv_ rv_chat.xml
Checkbox chk_ chk_remember_me.xml
ProgressBar pb_ pb_upload_percent.xml
RadioButton rb_ rb_female.xml
ToggleButton tb_ tb_visibility.xml
Spinner spn_ spn_category.xml
Menu mnu_ mnu_country.xml
GalleryView gv_ gv_album.xml
WebView wv_ wv_preview.xml

Drawables

Asset Type Prefix Example
Action bar ab_ ab_stacked.9.png
Button btn_ btn_send_pressed.9.png
Dialog dialog_ dialog_top.9.png
Divider divider_ divider_horizontal.9.png
Icon ic_ ic_star.png
Menu menu_ menu_submenu_bg.9.png
Notification notification_ notification_bg.9.png
Tabs tab_ tab_pressed.9.png

Icons

Asset Type Prefix Example
Icons ic_ ic_star.png
Launcher icons ic_launcher ic_launcher_calendar.png
Menu icons and Action Bar icons ic_menu ic_menu_archive.png
Status bar icons ic_stat_notify ic_stat_notify_msg.png
Tab icons ic_tab ic_tab_recent.png
Dialog icons ic_dialog ic_dialog_info.png

Strings

Prefix Description
error_ An error message
msg_ A regular information message
title_ A title, i.e. a dialog title
action_ An action such as "Save" or "Create"

Constants

Element Field Name Prefix
SharedPreferences PREF_
Bundle BUNDLE_
Fragment Arguments ARGUMENT_
Intent Extra EXTRA_
Intent Action ACTION_

Acronyms

Good Bad
XmlHttpRequest XMLHTTPRequest
getCustomerId getCustomerID
String url String URL
long id long ID

MVP Package Structure

┌─── data
│   │   Task.java (Data Model)
│   │
│   └─── source
│       │   TasksDataSource.java
│       │   TasksRepository.java
│       │
│       ├─── local
│       │       TasksDao.java
│       │       TasksLocalDataSource.java
│       │       ToDoDatabase.java
│       │
│       └─── remote
│               TasksRemoteDataSource.java
│
├─── addedittask (Action)
│       AddEditTaskActivity.java
│       AddEditTaskContract.java
│       AddEditTaskFragment.java
│       AddEditTaskPresenter.java
│
├─── taskdetail (Action)
│       TaskDetailActivity.java
│       TaskDetailContract.java
│       TaskDetailFragment.java
│       TaskDetailPresenter.java
│
├─── tasks (Action)
│       TasksActivity.java
│       TasksContract.java
│       TasksFilterType.java
│       TasksFragment.java
│       TasksPresenter.java
│
│─── util (Utility classes used in various parts of the app, e.g. for handling file access) 
│       ActivityUtils.java
│       AppExecutors.java
│       DiskIOThreadExecutor.java
│
│   BaseActivity.java
│   BasePresenter.java
│   BaseView.java

References

Contributor(s)

android-convention-cheatsheet's People

Contributors

mastani avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.