Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Commit 87ed8db

Browse files
author
Prat T
committed
add apprentice's Android code style
1 parent 0491f48 commit 87ed8db

3 files changed

Lines changed: 8 additions & 13 deletions

File tree

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Code formatting rules for Android Studio
44

55
## Features
66
- Based on googles java code style (https://git.io/v5XuB)
7-
- [Hungarian Notation (m-Prefix)](https://github.com/grandcentrix/AndroidCodeStyle/issues/4)
87
- [No star imports](https://github.com/grandcentrix/AndroidCodeStyle/issues/5) except for testing libraries
98
- Increase the line length to 118 (default 100)
109
- `android:id` after `xmlns` declaration in XML layouts
@@ -35,7 +34,7 @@ $ ./install.sh PATH/TO/YOUT/PROJECT
3534
The IDE will slightly change the XML after the coping.
3635

3736
### Manually (the hard way)
38-
1. Copy the [`grandcentrix.xml`](styles/grandcentrix.xml) into (MacOS) ``~/Library/Preferences/AndroidStudio{VERSION}/codestyles/`` or (Linux) ``~/.AndroidStudio{VERSION}/config/codestyles/``
37+
1. Copy the [`apprenticefs.xml`](styles/apprenticefs.xml) into (MacOS) ``~/Library/Preferences/AndroidStudio{VERSION}/codestyles/`` or (Linux) ``~/.AndroidStudio{VERSION}/config/codestyles/``
3938
2. Restart AndroidStudio
4039
3. Select the codestyle scheme via `Preferences --> Editor --> Code Style`.
4140

@@ -44,7 +43,7 @@ The codestyle will be enabled/used for **all projects** that are used with Andro
4443
## Enabling project specific code styles for a project
4544
If the codestyle is added to the git repository and IntelliJ is configured accordingly each project can have it's own style.
4645

47-
1. Install the [`grandcentrix.xml`](styles/grandcentrix.xml) locally (see above)
46+
1. Install the [`apprenticefs.xml`](styles/apprenticefs.xml) locally (see above)
4847
2. Restart AndroidStudio
4948
3. In AndroidStudio, go to `Preferences --> Code style`
5049
4. Open the scheme manager by clicking on `Manage...`
@@ -62,7 +61,7 @@ Then you can create a PR to this repository.
6261

6362
The PR should always contain:
6463
* Some information what have changed.
65-
* A updated [`grandcentrix.xml`](styles/grandcentrix.xml).
64+
* A updated [`apprenticefs.xml`](styles/apprenticefs.xml).
6665

6766
## License
6867
[CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/legalcode)

install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
echo "Installing GCX AndroidStudio code style..."
99
echo ""
1010

11-
LATEST_CODE_STYLE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/styles/grandcentrix.xml"
11+
LATEST_CODE_STYLE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/styles/apprenticefs.xml"
1212
if [ "$1" != "" ]; then
1313
lastChar=${1: -1}
1414
if [[ $lastChar == '/' ]]; then
@@ -29,11 +29,11 @@ do
2929
echo "Copying..."
3030
cp -frv ${LATEST_CODE_STYLE} ${target}/codestyles/
3131
if [ "$1" != "" ]; then
32-
echo "Renaming grandcentrix.xml to Project.xml"
33-
mv ${target}/codestyles/grandcentrix.xml ${target}/codestyles/Project.xml
32+
echo "Renaming apprenticefs.xml to Project.xml"
33+
mv ${target}/codestyles/apprenticefs.xml ${target}/codestyles/Project.xml
3434
fi
3535
done
3636

3737
echo ""
3838
echo "Done."
39-
echo "Restart AndroidStudio. Go to Preferences->Editor->Code Style and apply Scheme 'grandcentrix'."
39+
echo "Restart AndroidStudio. Go to Preferences->Editor->Code Style and apply Scheme 'apprenticefs'."
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<code_scheme name="grandcentrix">
2-
<option name="FIELD_NAME_PREFIX" value="m" />
3-
<option name="STATIC_FIELD_NAME_PREFIX" value="m" />
1+
<code_scheme name="apprenticefs">
42
<option name="GENERATE_FINAL_LOCALS" value="true" />
53
<option name="GENERATE_FINAL_PARAMETERS" value="true" />
64
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
@@ -62,8 +60,6 @@
6260
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
6361
</HTMLCodeStyleSettings>
6462
<JavaCodeStyleSettings>
65-
<option name="FIELD_NAME_PREFIX" value="m" />
66-
<option name="STATIC_FIELD_NAME_PREFIX" value="m" />
6763
<option name="GENERATE_FINAL_LOCALS" value="true" />
6864
<option name="GENERATE_FINAL_PARAMETERS" value="true" />
6965
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />

0 commit comments

Comments
 (0)