mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
reuse color state list definitions
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
b34765ccf4
commit
209c1a90ba
@ -288,55 +288,18 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme) {
|
|||||||
fun colorTextInputLayout(textInputLayout: TextInputLayout) {
|
fun colorTextInputLayout(textInputLayout: TextInputLayout) {
|
||||||
withElementColor(textInputLayout) { color ->
|
withElementColor(textInputLayout) { color ->
|
||||||
val errorColor = Color.GRAY
|
val errorColor = Color.GRAY
|
||||||
textInputLayout.setBoxStrokeColorStateList(
|
|
||||||
ColorStateList(
|
val errorColorStateList = ColorStateList(
|
||||||
arrayOf(
|
arrayOf(
|
||||||
intArrayOf(-android.R.attr.state_focused),
|
intArrayOf(-android.R.attr.state_focused),
|
||||||
intArrayOf(android.R.attr.state_focused)
|
intArrayOf(android.R.attr.state_focused)
|
||||||
),
|
),
|
||||||
intArrayOf(
|
intArrayOf(
|
||||||
Color.GRAY,
|
errorColor,
|
||||||
color
|
errorColor
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
val coloredColorStateList = ColorStateList(
|
||||||
textInputLayout.setErrorIconTintList(
|
|
||||||
ColorStateList(
|
|
||||||
arrayOf(
|
|
||||||
intArrayOf(-android.R.attr.state_focused),
|
|
||||||
intArrayOf(android.R.attr.state_focused)
|
|
||||||
),
|
|
||||||
intArrayOf(
|
|
||||||
errorColor,
|
|
||||||
errorColor
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
textInputLayout.setErrorTextColor(
|
|
||||||
ColorStateList(
|
|
||||||
arrayOf(
|
|
||||||
intArrayOf(-android.R.attr.state_focused),
|
|
||||||
intArrayOf(android.R.attr.state_focused)
|
|
||||||
),
|
|
||||||
intArrayOf(
|
|
||||||
errorColor,
|
|
||||||
errorColor
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
textInputLayout.boxStrokeErrorColor =
|
|
||||||
ColorStateList(
|
|
||||||
arrayOf(
|
|
||||||
intArrayOf(-android.R.attr.state_focused),
|
|
||||||
intArrayOf(android.R.attr.state_focused)
|
|
||||||
),
|
|
||||||
intArrayOf(
|
|
||||||
errorColor,
|
|
||||||
errorColor
|
|
||||||
)
|
|
||||||
)
|
|
||||||
textInputLayout.defaultHintTextColor =
|
|
||||||
ColorStateList(
|
|
||||||
arrayOf(
|
arrayOf(
|
||||||
intArrayOf(-android.R.attr.state_focused),
|
intArrayOf(-android.R.attr.state_focused),
|
||||||
intArrayOf(android.R.attr.state_focused)
|
intArrayOf(android.R.attr.state_focused)
|
||||||
@ -346,6 +309,12 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme) {
|
|||||||
color
|
color
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
textInputLayout.setBoxStrokeColorStateList(coloredColorStateList)
|
||||||
|
textInputLayout.setErrorIconTintList(errorColorStateList)
|
||||||
|
textInputLayout.setErrorTextColor(errorColorStateList)
|
||||||
|
textInputLayout.boxStrokeErrorColor = errorColorStateList
|
||||||
|
textInputLayout.defaultHintTextColor = coloredColorStateList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user