forked from GCX-HCI/grandcentrix-AndroidCodeStyle
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·38 lines (34 loc) · 1.25 KB
/
install.sh
File metadata and controls
executable file
·38 lines (34 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Installs B&B Android Studio Code Style into your AndroidStudio codestyles folder.
# Inspired by https://github.com/grandcentrix/AndroidCodeStyle
# You can optional put a path (to your Android project) as argument.
# Then the codestyle will be only added there.
echo "Installing B&B Android Studio code style..."
echo ""
LATEST_CODE_STYLE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/styles/codestyle.xml"
if [ "$1" != "" ]; then
lastChar=${1: -1}
if [[ $lastChar == '/' ]]; then
TARGET_DIR=("$1.idea")
else
TARGET_DIR=("$1/.idea")
fi
else
TARGET_DIR=("$HOME/Library/Preferences/AndroidStudio*" "$HOME/Library/Preferences/AndroidStudioPreview*" \
"~/.AndroidStudio*/config" "~/.AndroidStudioPreview*/config")
fi
for target in $TARGET_DIR
do
# create codestyles dir and ...
mkdir -p "${target}"/codestyles
# ... copy to latest style to ${TARGET_DIR}
echo "Copying..."
cp -frv "${LATEST_CODE_STYLE}" "${target}"/codestyles/
if [ "$1" != "" ]; then
echo "Renaming codestyle.xml to Project.xml"
mv "${target}"/codestyles/codestyle.xml "${target}"/codestyles/Project.xml
fi
done
echo ""
echo "Done."
echo "Restart AndroidStudio. Go to Preferences->Editor->Code Style and apply Scheme 'BBAndroidCodeStyle'."