diff options
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt | 67 | ||||
-rw-r--r-- | gradle.properties | 2 |
2 files changed, 23 insertions, 46 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?) { diff --git a/gradle.properties b/gradle.properties index 627a4d06..94ab195c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,7 @@ VERSION_CODE=1 VERSION_NAME=0.1 ANDROID_SUPPORT_LIBS=26.0.0-alpha1 -KAU=d9de334c67 +KAU=9ae298d669 MATERIAL_DRAWER=5.9.2 MATERIAL_DRAWER_KT=1.0.2 IICON_GOOGLE=3.0.1.0 |