Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5cef801

Browse files
committed
Added resource names
1 parent b3b8de4 commit 5cef801

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

java/android/README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This document, expected to be followed by any developers at 47 Degrees, is a sub
88

99
Developers should pay special attention to these naming conventions as they differ from those in the standard Java Coding Conventions.
1010

11-
## 1.1. Resource Files
11+
## 1.1. Common Resource Files
1212

1313
The folder *values* will have different files that will store information for our project.
1414
Some of the most common files and their name are
@@ -20,15 +20,37 @@ Some of the most common files and their name are
2020
* **plurals.xml**: Plurals. Contains references to strings.xml
2121
* **arrays.xml**: Arrays. Contains references to strings.xml
2222

23-
## 1.3. Java Packages & Class Names
23+
## 1.2. Java Packages & Class Names
2424

2525
An android App should generally follow the following package structure
2626

27-
* com.company.product.android
27+
* **com.company.product.android**
2828
- **activities**: All Activities with the word Activity pre-fixed by the Activity name: *[Name]*Activity e.g. MainActivity
2929
- **adapters**: All Adapters with the word Adapter pre-fixed by the Adapter name: *[Name]*Adapter e.g. UserListAdapter
3030
- **services**: All Services including API clients and other persistence related services e.g. UserService
3131
- **components**: All reusable components utilized in Activity and Fragments e.g. UserProfileComponent
3232
- **dialogs**: All Fragment Dialogs with the word Dialog pre-fixed by the dialog name: *[Name]*Dialog e.g. DeleteAccountConfirmationDialog
3333
- **fragments**: All Fragments with the word Fragment pre-fixed by the Fragment name: *[Name]*Fragment e.g. UserMapLocationFragment
34-
- **utils**: All cross package utilities with the word Utils pre-fixed by the Utility name: *[Name]*Utils e.g. StringUtils
34+
- **utils**: All cross package utilities with the word Utils pre-fixed by the Utility name: *[Name]*Utils e.g. StringUtils
35+
36+
## 1.3. Resource Names
37+
38+
The following structure should be followed when naming images in order to find and reuse resources fast and efficiently and avoid duplication across different layouts and components.
39+
40+
GROUP TYPE NAME [STATE] [SUFFIX]
41+
42+
* **Group**: Application area or screen. If the resource is used in different parts of applications 'common' should be used instead. e.g. actionbar, menu, media, popup, footer, audio, etc.
43+
* **Type**: Resource Type. e.g. background, icon, button, textfield, list, menuitem, radiobutton, checkbox, tab, dialog, title, etc.
44+
* **Name**: Descriptive name as to what the resource is about. e.g. play, stop.
45+
* **State** (Optional): The optional state of a parent resource. e.g. A button could be in 'normal', 'pressed', 'disabled' and 'selected'. A checkbox could be 'on' or 'off'. These resources should NEVER be used directly in layout but rather as state selectors.
46+
* **Suffix** (Optional): An arbitrary suffix that helps to further identify a property of the resource. Ex: bright, dark, opaque, layer, etc.
47+
48+
Below are some examples of properly named resources.
49+
50+
* common_background_app
51+
* audio_icon_play_on
52+
* common_icon_preferences
53+
* actionbar_button_send (XML resource)
54+
- action_button_send_normal
55+
- action_button_send_pressed
56+
- action_button_send_disabled

0 commit comments

Comments
 (0)