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

Commit f2784e7

Browse files
author
fractaltheory
committed
Merge remote-tracking branch 'origin/master' into eslint
2 parents 2e0f8bb + 16ea780 commit f2784e7

5 files changed

Lines changed: 275 additions & 0 deletions

File tree

css/Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
* [When to use their existing selectors](class-naming-conventions#when-to-use-their-existing-selectors)
3939
* [How to use their existing selectors in our components](class-naming-conventions#how-to-use-their-existing-selectors-in-our-components)
4040
* [Block Comment Documentation Guide](comments/Readme.md)
41+
* [Hybrid Projects Best Practices](hybrid-projects/Readme.md)
4142

4243
Continue on to [the Introduction →](introduction#introduction)

css/comments/Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,3 +418,5 @@ An example of both the doc block and dependencies can be seen here:
418418
@return $value + $modifier;
419419
}
420420
```
421+
422+
Continue on to [Hybrid App Projects →](../hybrid-projects#hybrid-app-projects)

css/hybrid-projects/Readme.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Hybrid App Projects
2+
3+
## Structuring App Styles For a Legacy Mobify Site
4+
5+
CSS written specifically for webviews contained in a Native application should follow all normally prescribed [best practices](https://github.com/mobify/mobify-code-style/tree/master/css/css-best-practices). This page will outline how to start a new app project, avoid adhering to legacy CSS code style, and provide a minimally sized CSS file to the web.
6+
7+
A hybrid project has a stylesheet specific to the OS. So a typical app project for a legacy Mobify project would be structured as such:
8+
9+
```
10+
/styles
11+
/vellum
12+
/components
13+
/partials
14+
/templates
15+
16+
/ios
17+
/components
18+
/partials
19+
/templates
20+
21+
/android
22+
/components
23+
/partials
24+
/templates
25+
26+
stylesheet.scss
27+
ios.scss
28+
android.scss
29+
```
30+
31+
``android.css`` will include all of the web styles and override them as needed. Building on top of whats there with all the styles specific to that OS will help in keeping the system maintainable. The system used to build out an example ``android.css`` would look something like this:
32+
33+
```scss
34+
// Android Styles
35+
// ===
36+
37+
38+
// Web Base Styles
39+
// ---
40+
41+
@import stylesheet.scss
42+
43+
44+
// Components
45+
// ---
46+
47+
@import 'android/components/arrange';
48+
@import 'android/components/card';
49+
@import 'android/components/stack';
50+
51+
52+
// Templates
53+
// ---
54+
55+
@import 'android/templates/login';
56+
@import 'android/templates/store-finder';
57+
@import 'android/templates/store-details';
58+
@import 'android/templates/search-error';
59+
```
60+
61+
Stylesheets will be generated and served to the page depending on the context. If it’s an android app it gets ``android.css``, if its a website it gets ``stylesheet.css``, etc.
62+
63+
## Structuring App Styles For a New Mobify Site
64+
65+
The current intended strategy in mind for future new builds is to have a single stylesheet for all platforms. Incorporating platform-specific theming and components into our existing CSS system.
66+
67+
This could serve to decrease the complexity associated with the system we use for legacy Mobify sites and potentially make hybrid projects easier to maintain.

java/AndroidStyle.xml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<code_scheme name="AndroidStyle">
3+
<option name="JAVA_INDENT_OPTIONS">
4+
<value>
5+
<option name="INDENT_SIZE" value="4" />
6+
<option name="CONTINUATION_INDENT_SIZE" value="8" />
7+
<option name="TAB_SIZE" value="8" />
8+
<option name="USE_TAB_CHARACTER" value="false" />
9+
<option name="SMART_TABS" value="false" />
10+
<option name="LABEL_INDENT_SIZE" value="0" />
11+
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
12+
<option name="USE_RELATIVE_INDENTS" value="false" />
13+
</value>
14+
</option>
15+
<option name="FIELD_NAME_PREFIX" value="m" />
16+
<option name="STATIC_FIELD_NAME_PREFIX" value="m" />
17+
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="9999" />
18+
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="9999" />
19+
<option name="IMPORT_LAYOUT_TABLE">
20+
<value>
21+
<package name="com.google" withSubpackages="true" static="false" />
22+
<emptyLine />
23+
<package name="com" withSubpackages="true" static="false" />
24+
<emptyLine />
25+
<package name="junit" withSubpackages="true" static="false" />
26+
<emptyLine />
27+
<package name="net" withSubpackages="true" static="false" />
28+
<emptyLine />
29+
<package name="org" withSubpackages="true" static="false" />
30+
<emptyLine />
31+
<package name="android" withSubpackages="true" static="false" />
32+
<emptyLine />
33+
<package name="java" withSubpackages="true" static="false" />
34+
<emptyLine />
35+
<package name="javax" withSubpackages="true" static="false" />
36+
<emptyLine />
37+
<package name="" withSubpackages="true" static="false" />
38+
<emptyLine />
39+
<package name="" withSubpackages="true" static="true" />
40+
</value>
41+
</option>
42+
<option name="RIGHT_MARGIN" value="100" />
43+
<option name="JD_P_AT_EMPTY_LINES" value="false" />
44+
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
45+
<option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
46+
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
47+
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
48+
<option name="JD_PRESERVE_LINE_FEEDS" value="true" />
49+
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
50+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
51+
<option name="BLANK_LINES_AROUND_FIELD" value="1" />
52+
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
53+
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
54+
<option name="ALIGN_MULTILINE_FOR" value="false" />
55+
<option name="CALL_PARAMETERS_WRAP" value="1" />
56+
<option name="METHOD_PARAMETERS_WRAP" value="1" />
57+
<option name="EXTENDS_LIST_WRAP" value="1" />
58+
<option name="THROWS_LIST_WRAP" value="1" />
59+
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
60+
<option name="THROWS_KEYWORD_WRAP" value="1" />
61+
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
62+
<option name="BINARY_OPERATION_WRAP" value="1" />
63+
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
64+
<option name="TERNARY_OPERATION_WRAP" value="1" />
65+
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
66+
<option name="FOR_STATEMENT_WRAP" value="1" />
67+
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
68+
<option name="ASSIGNMENT_WRAP" value="1" />
69+
<option name="PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE" value="true" />
70+
<option name="WRAP_COMMENTS" value="true" />
71+
<option name="IF_BRACE_FORCE" value="3" />
72+
<option name="DOWHILE_BRACE_FORCE" value="3" />
73+
<option name="WHILE_BRACE_FORCE" value="3" />
74+
<option name="FOR_BRACE_FORCE" value="3" />
75+
<ADDITIONAL_INDENT_OPTIONS fileType="css">
76+
<option name="INDENT_SIZE" value="4" />
77+
<option name="CONTINUATION_INDENT_SIZE" value="8" />
78+
<option name="TAB_SIZE" value="4" />
79+
<option name="USE_TAB_CHARACTER" value="false" />
80+
<option name="SMART_TABS" value="false" />
81+
<option name="LABEL_INDENT_SIZE" value="0" />
82+
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
83+
<option name="USE_RELATIVE_INDENTS" value="false" />
84+
</ADDITIONAL_INDENT_OPTIONS>
85+
<ADDITIONAL_INDENT_OPTIONS fileType="java">
86+
<option name="INDENT_SIZE" value="4" />
87+
<option name="CONTINUATION_INDENT_SIZE" value="8" />
88+
<option name="TAB_SIZE" value="8" />
89+
<option name="USE_TAB_CHARACTER" value="false" />
90+
<option name="SMART_TABS" value="false" />
91+
<option name="LABEL_INDENT_SIZE" value="0" />
92+
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
93+
<option name="USE_RELATIVE_INDENTS" value="false" />
94+
</ADDITIONAL_INDENT_OPTIONS>
95+
<ADDITIONAL_INDENT_OPTIONS fileType="js">
96+
<option name="INDENT_SIZE" value="4" />
97+
<option name="CONTINUATION_INDENT_SIZE" value="4" />
98+
<option name="TAB_SIZE" value="4" />
99+
<option name="USE_TAB_CHARACTER" value="false" />
100+
<option name="SMART_TABS" value="false" />
101+
<option name="LABEL_INDENT_SIZE" value="0" />
102+
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
103+
<option name="USE_RELATIVE_INDENTS" value="false" />
104+
</ADDITIONAL_INDENT_OPTIONS>
105+
<ADDITIONAL_INDENT_OPTIONS fileType="jsp">
106+
<option name="INDENT_SIZE" value="4" />
107+
<option name="CONTINUATION_INDENT_SIZE" value="8" />
108+
<option name="TAB_SIZE" value="4" />
109+
<option name="USE_TAB_CHARACTER" value="false" />
110+
<option name="SMART_TABS" value="false" />
111+
<option name="LABEL_INDENT_SIZE" value="0" />
112+
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
113+
<option name="USE_RELATIVE_INDENTS" value="false" />
114+
</ADDITIONAL_INDENT_OPTIONS>
115+
<ADDITIONAL_INDENT_OPTIONS fileType="sql">
116+
<option name="INDENT_SIZE" value="2" />
117+
<option name="CONTINUATION_INDENT_SIZE" value="8" />
118+
<option name="TAB_SIZE" value="4" />
119+
<option name="USE_TAB_CHARACTER" value="false" />
120+
<option name="SMART_TABS" value="false" />
121+
<option name="LABEL_INDENT_SIZE" value="0" />
122+
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
123+
<option name="USE_RELATIVE_INDENTS" value="false" />
124+
</ADDITIONAL_INDENT_OPTIONS>
125+
<ADDITIONAL_INDENT_OPTIONS fileType="xml">
126+
<option name="INDENT_SIZE" value="4" />
127+
<option name="CONTINUATION_INDENT_SIZE" value="8" />
128+
<option name="TAB_SIZE" value="4" />
129+
<option name="USE_TAB_CHARACTER" value="false" />
130+
<option name="SMART_TABS" value="false" />
131+
<option name="LABEL_INDENT_SIZE" value="0" />
132+
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
133+
<option name="USE_RELATIVE_INDENTS" value="false" />
134+
</ADDITIONAL_INDENT_OPTIONS>
135+
<ADDITIONAL_INDENT_OPTIONS fileType="yml">
136+
<option name="INDENT_SIZE" value="2" />
137+
<option name="CONTINUATION_INDENT_SIZE" value="8" />
138+
<option name="TAB_SIZE" value="4" />
139+
<option name="USE_TAB_CHARACTER" value="false" />
140+
<option name="SMART_TABS" value="false" />
141+
<option name="LABEL_INDENT_SIZE" value="0" />
142+
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
143+
<option name="USE_RELATIVE_INDENTS" value="false" />
144+
</ADDITIONAL_INDENT_OPTIONS>
145+
<codeStyleSettings language="JavaScript">
146+
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
147+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
148+
<option name="BLANK_LINES_AROUND_FIELD" value="1" />
149+
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
150+
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
151+
<option name="ALIGN_MULTILINE_FOR" value="false" />
152+
<option name="CALL_PARAMETERS_WRAP" value="1" />
153+
<option name="METHOD_PARAMETERS_WRAP" value="1" />
154+
<option name="EXTENDS_LIST_WRAP" value="1" />
155+
<option name="THROWS_LIST_WRAP" value="1" />
156+
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
157+
<option name="THROWS_KEYWORD_WRAP" value="1" />
158+
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
159+
<option name="BINARY_OPERATION_WRAP" value="1" />
160+
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
161+
<option name="TERNARY_OPERATION_WRAP" value="1" />
162+
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
163+
<option name="FOR_STATEMENT_WRAP" value="1" />
164+
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
165+
<option name="ASSIGNMENT_WRAP" value="1" />
166+
<option name="PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE" value="true" />
167+
<option name="WRAP_COMMENTS" value="true" />
168+
<option name="IF_BRACE_FORCE" value="3" />
169+
<option name="DOWHILE_BRACE_FORCE" value="3" />
170+
<option name="WHILE_BRACE_FORCE" value="3" />
171+
<option name="FOR_BRACE_FORCE" value="3" />
172+
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
173+
</codeStyleSettings>
174+
</code_scheme>

java/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Almost all of our Java is written for android, so we're using the [android platform development](https://github.com/android/platform_development) android studio config. You can also read more about the java style guide for android contributors [here](http://source.android.com/source/code-style.html)
2+
3+
You can import the provided AndroidStyle.xml file into Android Studio by:
4+
5+
1. Copy the AndroidStyle.xml file into ~/Library/Preferences/AndroidStudio/codestyles/
6+
2. Restart Android Studio
7+
3. Open Android Studio > preferences
8+
4. Click the Code Style drop down and select Java
9+
5. Choose the AndroidStyle option under the scheme drop down at the top.
10+
6. Click apply, and OK
11+
12+
# Rules
13+
14+
## Comments
15+
16+
Use JavaDoc comments for **classes**, and every **public** method. For protected and private methods, use your own discression. Eg. if a protected method is going to be overridden a lot, write a JavaDoc comment!
17+
18+
**Remove** comments generated by Android Studio when class files are created. Typically it will append something like:
19+
20+
```
21+
/**
22+
* Created by MikeKlemarewski 2014-12-22
23+
*/
24+
```
25+
These are just noise. If you need to know who created the file, look at the Git history.
26+
27+
## Member Variables
28+
Do **not** prefix member variables with 'm'. Member variables should be declared at the top of the class if they are used often, otherwise they should be declared right before they are used.
29+
30+
## Methods
31+
Methods should be kept as shorts as possible. There is no hard limit. Methods should do one thing, and do it well. If a function starts to creep over 30 lines, this is a sign that it may have too many responsiblities and be broken up.

0 commit comments

Comments
 (0)