Skip to content

Commit 7d1e2f5

Browse files
author
michal_szwarc
committed
Update readme and sample app
1 parent 0def9af commit 7d1e2f5

File tree

3 files changed

+47
-9
lines changed

3 files changed

+47
-9
lines changed

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,54 @@
11
# MaterialSettings
22
MaterialSettings - small library to create settings activity
33

4-
Work in progress...
4+
###Simple code:
5+
```java
6+
public class Settings1Activity extends MaterialSettings {
7+
@Override
8+
public void onCreate(Bundle savedInstanceState) {
9+
super.onCreate(savedInstanceState);
10+
addItem(new HeaderItem(this).setTitle("Sample title 1"));
11+
addItem(new CheckboxItem(this, "key1").setTitle("Checkbox item 1").setSubtitle("Subtitle text 1").setOnCheckedChangeListener(new CheckboxItem.OnCheckedChangeListener() {
12+
@Override
13+
public void onCheckedChange(CheckboxItem cbi, boolean isChecked) {
14+
Toast.makeText(Settings1Activity.this, "CHECKED: " + isChecked, Toast.LENGTH_SHORT).show();
15+
}
16+
}));
17+
}
18+
@Override
19+
public StorageInterface initStorageInterface() {
20+
return new PreferencesStorageInterface(this);
21+
}
22+
}
23+
```
524

25+
### Style attrs
26+
* msToolbarTheme
27+
* msToolbarThemePopup
28+
* msColorPrimary - primary color
29+
* msColorPrimaryDark - color of status bar (api 21+)
30+
* msColorAccent - accent color
31+
* msWindowBg - default window bg color
32+
* msColorHeader - headers text color (usually same as msColorAccent)
33+
* msColorTextTitle - item title color
34+
* msColorTextSubTitle - subtitle text color
35+
* msDivider - divider drawable
36+
* msItem - whole item color
37+
* msTextStyle - reference to text title style (TextView)
38+
* msSubTextStyle - reference to text sub title style (TextView)
39+
* msHeaderStyle - reference to text title style (TextView)
40+
41+
### Same style
42+
```xml
43+
<style name="MaterialSettings.Red" parent="MaterialSettingsTheme">
44+
<item name="msColorPrimary">@color/redPrimary</item>
45+
<item name="msColorPrimaryDark">@color/redPrimaryDark</item>
46+
<item name="msColorAccent">@color/redAccent</item>
47+
<item name="msColorHeader">@color/redAccent</item>
48+
</style>
49+
```
50+
51+
# Screens
652
![Default](/screens/theme_default.png)
753
![Rec](/screens/theme_red.png)
854
![Dark](/screens/theme_dark.png)

sampleapp/src/main/java/com/wt/sampleapp/Settings1Activity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
public class Settings1Activity extends MaterialSettings implements SampleDialog.OnDialogOkClick {
2727

28-
private final Handler h = new Handler();
29-
3028
@Override
3129
public void onCreate(Bundle savedInstanceState) {
3230
super.onCreate(savedInstanceState);

sampleapp/src/main/res/values-w820dp/dimens.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)