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/kotlin/ca | |
parent | c00f9e2674f5109a64f1f50873ce08089a2fce33 (diff) | |
download | kau-b7a493facf1152bc1de872e39cbc299640127bf4.tar.gz kau-b7a493facf1152bc1de872e39cbc299640127bf4.tar.bz2 kau-b7a493facf1152bc1de872e39cbc299640127bf4.zip |
Testing data changes
Diffstat (limited to 'sample/src/main/kotlin/ca')
-rw-r--r-- | sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 15 |
1 files changed, 6 insertions, 9 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) |