Skip to content

Commit

Permalink
Update readme and sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
michal_szwarc committed Mar 19, 2015
1 parent 0def9af commit 7d1e2f5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,54 @@
# MaterialSettings
MaterialSettings - small library to create settings activity

Work in progress...
###Simple code:
```java
public class Settings1Activity extends MaterialSettings {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addItem(new HeaderItem(this).setTitle("Sample title 1"));
addItem(new CheckboxItem(this, "key1").setTitle("Checkbox item 1").setSubtitle("Subtitle text 1").setOnCheckedChangeListener(new CheckboxItem.OnCheckedChangeListener() {
@Override
public void onCheckedChange(CheckboxItem cbi, boolean isChecked) {
Toast.makeText(Settings1Activity.this, "CHECKED: " + isChecked, Toast.LENGTH_SHORT).show();
}
}));
}
@Override
public StorageInterface initStorageInterface() {
return new PreferencesStorageInterface(this);
}
}
```

### Style attrs
* msToolbarTheme
* msToolbarThemePopup
* msColorPrimary - primary color
* msColorPrimaryDark - color of status bar (api 21+)
* msColorAccent - accent color
* msWindowBg - default window bg color
* msColorHeader - headers text color (usually same as msColorAccent)
* msColorTextTitle - item title color
* msColorTextSubTitle - subtitle text color
* msDivider - divider drawable
* msItem - whole item color
* msTextStyle - reference to text title style (TextView)
* msSubTextStyle - reference to text sub title style (TextView)
* msHeaderStyle - reference to text title style (TextView)

### Same style
```xml
<style name="MaterialSettings.Red" parent="MaterialSettingsTheme">
<item name="msColorPrimary">@color/redPrimary</item>
<item name="msColorPrimaryDark">@color/redPrimaryDark</item>
<item name="msColorAccent">@color/redAccent</item>
<item name="msColorHeader">@color/redAccent</item>
</style>
```

# Screens
![Default](/screens/theme_default.png)
![Rec](/screens/theme_red.png)
![Dark](/screens/theme_dark.png)
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

public class Settings1Activity extends MaterialSettings implements SampleDialog.OnDialogOkClick {

private final Handler h = new Handler();

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
6 changes: 0 additions & 6 deletions sampleapp/src/main/res/values-w820dp/dimens.xml

This file was deleted.

0 comments on commit 7d1e2f5

Please sign in to comment.