TextInputLayout now supports Material 3

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-07-30 00:12:24 +02:00
parent 0c4513678d
commit 6075191bc5
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B

View File

@ -350,8 +350,7 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
}
fun colorEditText(editText: EditText) {
withElementColor(editText) { color ->
editText.setTextColor(color)
withScheme(editText) { scheme ->
// TODO check API-level compatibility
// editText.background.setColorFilter(color, PorterDuff.Mode.SRC_ATOP)
editText.backgroundTintList = ColorStateList(
@ -360,16 +359,18 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
intArrayOf(android.R.attr.state_focused)
),
intArrayOf(
Color.GRAY,
color
scheme.outline,
scheme.primary
)
)
editText.setHintTextColor(scheme.onSurfaceVariant)
editText.setTextColor(scheme.onSurface)
}
}
fun colorTextInputLayout(textInputLayout: TextInputLayout) {
withElementColor(textInputLayout) { color ->
val errorColor = Color.GRAY
withScheme(textInputLayout) { scheme ->
val errorColor = scheme.onSurfaceVariant
val errorColorStateList = ColorStateList(
arrayOf(
@ -387,8 +388,8 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
intArrayOf(android.R.attr.state_focused)
),
intArrayOf(
Color.GRAY,
color
scheme.outline,
scheme.primary
)
)