1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

Update kprefs

This commit is contained in:
Allan Wang 2017-06-16 23:50:45 -07:00
parent 0784fddafc
commit 125cd16f84
2 changed files with 23 additions and 46 deletions

View File

@ -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?) {

View File

@ -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