From 6075191bc5a0b9e83d9b8bb3aec990cd7f2906da Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sat, 30 Jul 2022 00:12:24 +0200 Subject: [PATCH] TextInputLayout now supports Material 3 Signed-off-by: Andy Scherzinger --- .../nextcloud/talk/ui/theme/ViewThemeUtils.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt b/app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt index 0acb5a2d6..e7e1dab5b 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt @@ -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 ) )