mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
extend text input layout theming
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
907386e9b7
commit
28aae00641
@ -119,7 +119,8 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme) {
|
||||
val colorStateList = ColorStateList(
|
||||
arrayOf(
|
||||
intArrayOf(android.R.attr.state_enabled),
|
||||
intArrayOf(-android.R.attr.state_enabled)),
|
||||
intArrayOf(-android.R.attr.state_enabled)
|
||||
),
|
||||
intArrayOf(color, disabledColor)
|
||||
)
|
||||
button.setTextColor(colorStateList)
|
||||
@ -212,8 +213,55 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme) {
|
||||
|
||||
fun colorTextInputLayout(textInputLayout: TextInputLayout) {
|
||||
withElementColor(textInputLayout) { color ->
|
||||
textInputLayout.hintTextColor = ColorStateList.valueOf(color)
|
||||
// TODO calculate error color based on primary color, dark/light aware
|
||||
val errorColor = Color.GRAY
|
||||
textInputLayout.boxStrokeColor = color
|
||||
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(
|
||||
intArrayOf(-android.R.attr.state_focused),
|
||||
intArrayOf(android.R.attr.state_focused)
|
||||
),
|
||||
intArrayOf(
|
||||
Color.GRAY,
|
||||
color
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user