aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-16 23:50:45 -0700
committerAllan Wang <me@allanwang.ca>2017-06-16 23:50:45 -0700
commit125cd16f844a27722c947de8be04c4a885c8b6d4 (patch)
treea262ebb03087ca730b90ca6dd5b249d2866f1e50 /app/src
parent0784fddafcee4759f25b7c27e1668d0996ab35e7 (diff)
downloadfrost-125cd16f844a27722c947de8be04c4a885c8b6d4.tar.gz
frost-125cd16f844a27722c947de8be04c4a885c8b6d4.tar.bz2
frost-125cd16f844a27722c947de8be04c4a885c8b6d4.zip
Update kprefs
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt67
1 files changed, 22 insertions, 45 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
index 3c6a75e0..0a9732b4 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
@@ -15,7 +15,7 @@ class SettingsActivity : KPrefActivity() {
textColor = { Prefs.textColor }
accentColor = { Prefs.textColor }
header(R.string.settings)
- text<Int>(title = R.string.theme, itemBuilder = {
+ text<Int>(R.string.theme, { Prefs.theme }, { Prefs.theme = it }) {
onClick = {
_, _, item ->
this@SettingsActivity.materialDialogThemed {
@@ -35,65 +35,42 @@ class SettingsActivity : KPrefActivity() {
}
true
}
- getter = { Prefs.theme }
- setter = { Prefs.theme = it }
- }, textGetter = { this@SettingsActivity.string(Theme(it).textRes) })
- colorPicker(title = R.string.text_color, itemBuilder = {
- getter = { Prefs.customTextColor }
- setter = { Prefs.customTextColor = it; reload() }
+ textGetter = { this@SettingsActivity.string(Theme(it).textRes) }
+ }
+
+ colorPicker(R.string.text_color, { Prefs.customTextColor }, { Prefs.customTextColor = it; reload() }) {
enabler = { Prefs.isCustomTheme }
- onDisabledClick = { itemView, _, _ ->
- itemView.snackbar(R.string.requires_custom_theme)
- true
- }
- }, colorBuilder = {
+ onDisabledClick = { itemView, _, _ -> itemView.snackbar(R.string.requires_custom_theme); true }
allowCustomAlpha = false
allowCustom = true
- })
+ }
- colorPicker(title = R.string.background_color, itemBuilder = {
- getter = { Prefs.customBackgroundColor }
- setter = { Prefs.customBackgroundColor = it; bgCanvas.ripple(it, duration = 500L) }
+ colorPicker(R.string.background_color, { Prefs.customBackgroundColor },
+ { Prefs.customBackgroundColor = it; bgCanvas.ripple(it, duration = 500L) }) {
enabler = { Prefs.isCustomTheme }
- onDisabledClick = { itemView, _, _ ->
- itemView.snackbar(R.string.requires_custom_theme)
- true
- }
- }, colorBuilder = {
+ onDisabledClick = { itemView, _, _ -> itemView.snackbar(R.string.requires_custom_theme); true }
allowCustomAlpha = true
allowCustom = true
- })
+ }
- colorPicker(title = R.string.header_color, itemBuilder = {
- getter = { Prefs.customHeaderColor }
- setter = {
- Prefs.customHeaderColor = it
- val darkerColor = it.darken()
- this@SettingsActivity.navigationBarColor = darkerColor
- toolbarCanvas.ripple(darkerColor, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L)
- }
+ colorPicker(R.string.header_color, { Prefs.customHeaderColor }, {
+ Prefs.customHeaderColor = it
+ val darkerColor = it.darken()
+ this@SettingsActivity.navigationBarColor = darkerColor
+ toolbarCanvas.ripple(darkerColor, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L)
+ }) {
enabler = { Prefs.isCustomTheme }
- onDisabledClick = { itemView, _, _ ->
- itemView.snackbar(R.string.requires_custom_theme)
- true
- }
- }, colorBuilder = {
+ onDisabledClick = { itemView, _, _ -> itemView.snackbar(R.string.requires_custom_theme); true }
allowCustomAlpha = true
allowCustom = true
- })
+ }
- colorPicker(title = R.string.icon_color, itemBuilder = {
- getter = { Prefs.customIconColor }
- setter = { Prefs.customIconColor = it; toolbar.setTitleTextColor(it) }
+ colorPicker(R.string.icon_color, { Prefs.customIconColor }, { Prefs.customIconColor = it; toolbar.setTitleTextColor(it) }) {
enabler = { Prefs.isCustomTheme }
- onDisabledClick = { itemView, _, _ ->
- itemView.snackbar(R.string.requires_custom_theme)
- true
- }
- }, colorBuilder = {
+ onDisabledClick = { itemView, _, _ -> itemView.snackbar(R.string.requires_custom_theme); true }
allowCustomAlpha = false
allowCustom = true
- })
+ }
}
override fun onCreate(savedInstanceState: Bundle?) {