Fix focused text input stroke color (fixes #2703)

This commit is contained in:
arkon 2020-03-15 12:58:48 -04:00
parent 90396153f4
commit 1ebcafb25d
4 changed files with 30 additions and 3 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
The regular version uses ?attr/colorPrimary when focused, which doesn't work well with our themes.
https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/textfield/res/color/mtrl_filled_stroke_color.xml
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/colorAccent" android:state_focused="true" />
<item android:alpha="0.87" android:color="?attr/colorOnSurface" android:state_hovered="true" />
<item android:alpha="0.12" android:color="?attr/colorOnSurface" android:state_enabled="false" />
<item android:alpha="0.38" android:color="?attr/colorOnSurface" />
</selector>

View File

@ -9,7 +9,7 @@
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/nav_view_item_wrapper" android:id="@+id/nav_view_item_wrapper"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" style="@style/Theme.Widget.TextInputLayout.OutlinedBox.Dense"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"

View File

@ -24,7 +24,7 @@
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/username_label" android:id="@+id/username_label"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" style="@style/Theme.Widget.TextInputLayout.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/username"> android:hint="@string/username">
@ -37,7 +37,7 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" style="@style/Theme.Widget.TextInputLayout.OutlinedBox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/password"> android:hint="@string/password">

View File

@ -199,6 +199,22 @@
<item name="android:background">@drawable/snackbar_bg</item> <item name="android:background">@drawable/snackbar_bg</item>
</style> </style>
<!--=======================-->
<!--Widgets.TextInputLayout-->
<!--=======================-->
<style name="Theme.Widget.TextInputLayout.OutlinedBox" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="boxStrokeColor">@color/text_input_stroke</item>
<item name="hintTextColor">?attr/colorAccent</item>
</style>
<style name="Theme.Widget.TextInputLayout.OutlinedBox.Dense" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<item name="boxStrokeColor">@color/text_input_stroke</item>
<item name="hintTextColor">?attr/colorAccent</item>
</style>
<!--==============--> <!--==============-->
<!--Widgets.Button--> <!--Widgets.Button-->
<!--==============--> <!--==============-->