|  | 
| 1 | 1 | # MaterialSettings | 
| 2 | 2 | MaterialSettings - small library to create settings activity | 
| 3 | 3 | 
 | 
| 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 | +``` | 
| 5 | 24 | 
 | 
|  | 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 | 
| 6 | 52 |  | 
| 7 | 53 |  | 
| 8 | 54 |  | 
0 commit comments