Simplify TextField drawable resources

https://github.com/material-components/material-components-android/issues/611

PiperOrigin-RevId: 273544807
This commit is contained in:
ldjesper 2019-10-08 13:02:57 -04:00 committed by ymarian
parent 24ab59af6c
commit 7dc56dfcdd
17 changed files with 33 additions and 50 deletions

View File

@ -3591,7 +3591,7 @@ public class TextInputLayout extends LinearLayout {
colorStateList.getColorForState(this.getDrawableState(), colorStateList.getDefaultColor());
icon = DrawableCompat.wrap(icon).mutate();
DrawableCompat.setTint(icon, color);
DrawableCompat.setTintList(icon, ColorStateList.valueOf(color));
iconView.setImageDrawable(icon);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/visible"
android:drawable="@drawable/design_ic_visibility"
android:state_checked="true"/>
<item
android:id="@+id/masked"
android:drawable="@drawable/design_ic_visibility_off"/>
<transition
android:drawable="@drawable/avd_show_password"
android:fromId="@id/masked"
android:toId="@id/visible"/>
<transition
android:drawable="@drawable/avd_hide_password"
android:fromId="@id/visible"
android:toId="@id/masked"/>
</animated-selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -17,7 +17,9 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
xmlns:aapt="http://schemas.android.com/aapt"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi">
<aapt:attr name="android:drawable">

View File

@ -17,7 +17,9 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
xmlns:aapt="http://schemas.android.com/aapt"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi">
<aapt:attr name="android:drawable">

View File

@ -16,6 +16,8 @@
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"

View File

@ -16,6 +16,8 @@
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"

View File

@ -15,13 +15,28 @@
~ limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="NewApi">
<item
android:drawable="@drawable/design_ic_visibility"
android:state_checked="true"/>
<item
android:id="@+id/visible"
android:drawable="@drawable/design_ic_visibility"
android:state_checked="true"/>
<item
android:drawable="@drawable/design_ic_visibility_off"/>
<item
android:id="@+id/masked"
android:drawable="@drawable/design_ic_visibility_off"/>
<transition
android:drawable="@drawable/avd_show_password"
android:fromId="@id/masked"
android:toId="@id/visible"/>
<transition
android:drawable="@drawable/avd_hide_password"
android:fromId="@id/visible"
android:toId="@id/masked"/>
</animated-selector>
</selector>