Skip to content

Commit

Permalink
[M3][Chip] Add missing attributes to M3 chip styles
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 409239837
  • Loading branch information
drchen committed Nov 16, 2021
1 parent 6517aa6 commit cc18f3f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021 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
https://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.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:viewportHeight="24.0"
android:height="24dp"
android:viewportWidth="24.0"
android:width="24dp"
tools:ignore="NewApi">
<path
android:fillColor="#000000"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>
Expand Up @@ -26,5 +26,6 @@
<dimen name="m3_chip_disabled_translation_z">-1dp</dimen>
<dimen name="m3_chip_corner_size">8dp</dimen>
<dimen name="m3_chip_elevated_elevation">1dp</dimen>
<dimen name="m3_chip_icon_size">18dp</dimen>

</resources>
24 changes: 16 additions & 8 deletions lib/java/com/google/android/material/chip/res/values/styles.xml
Expand Up @@ -149,20 +149,23 @@
<!-- M3 Chips -->

<style name="Base.Widget.Material3.Chip" parent="Base.Widget.MaterialComponents.Chip">
<item name="enforceTextAppearance">false</item>
<item name="android:textAppearance">?attr/textAppearanceLabelLarge</item>
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.Material3.Chip</item>
<item name="android:textColor">@color/m3_chip_text_color</item>
<item name="chipIconTint">@color/m3_chip_text_color</item>
<item name="closeIconTint">@color/m3_chip_text_color</item>
<item name="chipStrokeColor">@color/m3_chip_stroke_color</item>
<item name="chipSurfaceColor">?attr/colorSurface</item>
<item name="chipBackgroundColor">@color/m3_chip_background_color</item>
<item name="chipStrokeWidth">1dp</item>
<item name="rippleColor">@color/m3_chip_ripple_color</item>
<item name="checkedIcon">@drawable/ic_m3_chip_checked_circle</item>
<item name="closeIcon">@drawable/ic_m3_chip_close</item>
<item name="chipIconSize">@dimen/m3_chip_icon_size</item>
<item name="android:stateListAnimator" tools:ignore="NewApi">
@animator/m3_chip_state_list_anim
</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.Material3.Chip</item>
</style>

<!-- Style for Input Chip: for user-entered information.
Expand Down Expand Up @@ -209,7 +212,7 @@
<!-- Style for input chips with system icons. For input chips with avatar
style icons, use Widget.Material3.Chip.Input, instead. -->
<style name="Widget.Material3.Chip.Input.Icon" parent="Widget.Material3.Chip.Input">
<item name="chipIconSize">18dp</item>
<item name="chipIconSize">@dimen/m3_chip_icon_size</item>
<item name="iconStartPadding">4dp</item>
</style>

Expand Down Expand Up @@ -244,8 +247,6 @@
<item name="checkedIconVisible">false</item>
<item name="closeIconVisible">false</item>

<item name="enforceTextAppearance">false</item>

<item name="chipMinHeight">32dp</item>

<item name="chipStartPadding">8dp</item>
Expand Down Expand Up @@ -291,9 +292,7 @@
<item name="checkedIconVisible">false</item>
<item name="closeIconVisible">false</item>

<item name="enforceTextAppearance">false</item>
<item name="android:textColor">@color/m3_chip_assist_text_color</item>
<item name="chipIconTint">@color/m3_assist_chip_icon_tint_color</item>

<item name="chipMinHeight">32dp</item>

Expand All @@ -305,6 +304,8 @@
<item name="closeIconStartPadding">0dp</item>
<item name="closeIconEndPadding">0dp</item>
<item name="chipEndPadding">8dp</item>

<item name="materialThemeOverlay">@style/ThemeOverlay.Material3.Chip.Assist</item>
</style>

<!-- Style for Assist Chip to be used against a background that needs
Expand All @@ -325,9 +326,7 @@
<item name="chipIconVisible">false</item>
<item name="closeIconVisible">false</item>

<item name="chipIconSize">18dp</item>
<item name="checkedIcon">@drawable/ic_m3_chip_check</item>
<item name="enforceTextAppearance">false</item>

<item name="chipMinHeight">32dp</item>

Expand Down Expand Up @@ -367,4 +366,13 @@
<item name="cornerSize">8dp</item>
</style>

<style name="ThemeOverlay.Material3.Chip" parent="">
<!-- To tint vector drawables used as leading icons -->
<item name="colorControlNormal">@color/m3_chip_text_color</item>
</style>

<style name="ThemeOverlay.Material3.Chip.Assist" parent="">
<!-- To tint vector drawables used as leading icons -->
<item name="colorControlNormal">@color/m3_assist_chip_icon_tint_color</item>
</style>
</resources>

0 comments on commit cc18f3f

Please sign in to comment.