diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-11 10:40:17 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-11 10:40:17 -0700 |
commit | b7a493facf1152bc1de872e39cbc299640127bf4 (patch) | |
tree | 947992abc17e186f93dbf2b66115cdd64c9d3bd4 /sample/src/main | |
parent | c00f9e2674f5109a64f1f50873ce08089a2fce33 (diff) | |
download | kau-b7a493facf1152bc1de872e39cbc299640127bf4.tar.gz kau-b7a493facf1152bc1de872e39cbc299640127bf4.tar.bz2 kau-b7a493facf1152bc1de872e39cbc299640127bf4.zip |
Testing data changes
Diffstat (limited to 'sample/src/main')
-rw-r--r-- | sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 15 | ||||
-rw-r--r-- | sample/src/main/res/values/strings.xml | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt index db42f9b..914fff8 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -14,27 +14,24 @@ import ca.allanwang.kau.views.RippleCanvas class MainActivity : KPrefActivity() { override fun onCreateKPrefs(savedInstanceState: android.os.Bundle?): KPrefAdapterBuilder.() -> Unit = { - textColorGetter = { KPrefSample.textColor } - accentColorGetter = { KPrefSample.accentColor } + textColor = { KPrefSample.textColor } + accentColor = { KPrefSample.accentColor } header(R.string.header) checkbox(title = R.string.checkbox_1, description = R.string.desc, getter = { KPrefSample.check1 }, setter = { KPrefSample.check1 = it }) checkbox(title = R.string.checkbox_2, - getter = { KPrefSample.check2 }, setter = { KPrefSample.check2 = it }) - checkbox(title = R.string.checkbox_3, description = R.string.desc_disabled, enabled = false, + getter = { KPrefSample.check2 }, setter = { KPrefSample.check2 = it; reloadByTitle(R.string.checkbox_3) }) + checkbox(title = R.string.checkbox_3, description = R.string.desc_dependent, enabler = { KPrefSample.check2 }, getter = { KPrefSample.check3 }, setter = { KPrefSample.check3 = it }) colorPicker(title = R.string.text_color, description = R.string.color_custom, - getter = { KPrefSample.textColor }, setter = { - KPrefSample.textColor = it - adapter.notifyAdapterDataSetChanged() - }, + getter = { KPrefSample.textColor }, setter = { KPrefSample.textColor = it; reload() }, configs = { allowCustom = true }) colorPicker(title = R.string.accent_color, description = R.string.color_no_custom, getter = { KPrefSample.accentColor }, setter = { KPrefSample.accentColor = it - adapter.notifyAdapterDataSetChanged() + reload() val darkerColor = it.darken() this@MainActivity.navigationBarColor = darkerColor toolbarCanvas.ripple(darkerColor, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500) diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml index 1246baf..56addfd 100644 --- a/sample/src/main/res/values/strings.xml +++ b/sample/src/main/res/values/strings.xml @@ -6,7 +6,7 @@ <string name="checkbox_1">Checkbox 1</string> <string name="checkbox_2">Checkbox 2</string> <string name="checkbox_3">Checkbox 3</string> - <string name="desc_disabled">I am disabled</string> + <string name="desc_dependent">I am dependent on checkbox 2</string> <string name="text_color">Text Color</string> <string name="accent_color">Accent Color</string> <string name="background_color">Background Color</string> |