From b7a493facf1152bc1de872e39cbc299640127bf4 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 11 Jun 2017 10:40:17 -0700 Subject: Testing data changes --- .../main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 15 ++++++--------- sample/src/main/res/values/strings.xml | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'sample/src') 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 @@ Checkbox 1 Checkbox 2 Checkbox 3 - I am disabled + I am dependent on checkbox 2 Text Color Accent Color Background Color -- cgit v1.2.3