174 Commits

Author SHA1 Message Date
connieshi
b1dfadb873 [Chip] Include font padding.
Resolves https://github.com/material-components/material-components-android/issues/1424

PiperOrigin-RevId: 318817230
(cherry picked from commit 8544f7acc2ece2779ed4ac8a0954d49b54ac298e)
2020-07-15 16:07:18 -04:00
connieshi
0687ca80b0 Fix javadocs errors in Chip and ChipDrawable.
PiperOrigin-RevId: 300592847
2020-03-13 11:11:29 -04:00
isabellekim
358f9a7a3d Add @deprecated to javadocs for methods and classes marked @Deprecated.
PiperOrigin-RevId: 300567533
2020-03-13 11:07:17 -04:00
Material Design Team
5213b46edd [Chip] Support setting checked icon's tint via xml attribute
PiperOrigin-RevId: 299429881
2020-03-09 10:45:57 -07:00
connieshi
ded0c3ff61 Initialize chipCornerRadius to -1 instead of 0 so it would not ignore a user who sets the corner radius to 0.
Resolves https://github.com/material-components/material-components-android/issues/1058

PiperOrigin-RevId: 297422651
2020-02-27 15:49:57 -05:00
isabellekim
5834d44a85 Update Chip close icon tint to have sufficient contrast.
PiperOrigin-RevId: 296985379
2020-02-24 18:34:21 -05:00
connieshi
def1b55632 Add explanation for why ?attr/chipSurfaceColor is not exposed publicly.
PiperOrigin-RevId: 293869990
2020-02-10 09:58:23 -05:00
isabellekim
1f9de68025 [All] Add support for materialThemeOverlay
Resolves https://github.com/material-components/material-components-android/pull/948

GIT_ORIGIN_REV_ID=5a8bb35a56c1b813df47d964de8482a26e0da66d
PiperOrigin-RevId: 293839172
2020-02-10 09:55:19 -05:00
connieshi
625a5d6da1 Add private attributes that should be public to public.xml.
PiperOrigin-RevId: 293279871
2020-02-05 17:29:07 -05:00
marianomartin
401b99e099 [Chip] Double emission on check state change when selectionRequired is used
Resolves https://github.com/material-components/material-components-android/issues/952

PiperOrigin-RevId: 291922419
2020-01-28 16:11:38 -05:00
Material Design Team
253cdc2114 Add CollectionInfos and CollectionItemInfos to ChipGroup and Chip for accessibility.
PiperOrigin-RevId: 288944549
2020-01-10 09:05:36 -08:00
Material Design Team
ba8e18ea62 Fix RTL padding issue on Chips.
PiperOrigin-RevId: 288737367
2020-01-08 12:11:28 -08:00
dniz
d72f3bc7d0 Remove log line from Chip
PiperOrigin-RevId: 286572627
2019-12-21 08:48:40 -05:00
connieshi
a3204758f9 Fix chip text mis-alignment when its width is less than the minimum recommended touch target width.
Resolves https://github.com/material-components/material-components-android/issues/800

PiperOrigin-RevId: 286421752
2019-12-19 15:46:43 -05:00
connieshi
2a9c3f3ad1 Automated g4 rollback of changelist 283714901
PiperOrigin-RevId: 283801062
2019-12-05 14:45:24 -05:00
connieshi
415628f1cd Automated g4 rollback of changelist 283621202
PiperOrigin-RevId: 283714901
2019-12-05 14:37:46 -05:00
connieshi
e3be6b0e85 Support setting textAllCaps in textAppearance xml, switch from calling setSingleLine to setLines(1) so the transformation methods don't replace each other.
android:textAllCaps="true" in the layout xml is being ignored because:

1) A known issue where Chip only reads from its textappearance. However, even after creating a custom textappearance that sets textAllCaps to true, I'm observing an odd behavior:
if I comment out the setSingleLine method call in the constructor, then the text becomes all caps. If I comment setSingleLine back in and call setAllCaps, then the text becomes capitalized and single line.

I think it's related to two different transformation methods being applied. The one inside setsingleline clobbers the one set by setAllCaps.

TextView's constructor applies the singleLine transformation before applying text appearance attributes
https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/widget/TextView.java#L1570-L1609

https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/widget/TextView.java#L10232

2) The library implementation of TextAppearance reads from "textAllCaps" instead of "android:textAllCaps".
11c57abbd6/lib/java/com/google/android/material/resources/TextAppearance.java (L96)
However, if you call Chip#setTextAppearance(@StyleRes int id) which passes it the super method, then "android:textAllCaps" needs to be set because "textAllCaps" is ignored
::sigh::

PiperOrigin-RevId: 283621202
2019-12-05 14:33:18 -05:00
connieshi
d25fa92021 Support tinted chip icons.
Resolves https://github.com/material-components/material-components-android/issues/767

PiperOrigin-RevId: 283387208
2019-12-03 17:00:18 -05:00
Material Design Team
bb72e50930 Automated g4 rollback of changelist 281530369
PiperOrigin-RevId: 281569140
2019-11-22 21:24:02 +00:00
Material Design Team
32362bed3d Automated g4 rollback of changelist 281519201
PiperOrigin-RevId: 281530369
2019-11-22 21:23:01 +00:00
connieshi
39e62ec220 Remove attrs check inside Chip#initMinTarget because the current context's theme may have custom values.
PiperOrigin-RevId: 281519201
2019-11-20 14:40:33 -05:00
marianomartin
573efa4b2f Add selection required option to ChipGroup
Resolves https://github.com/material-components/material-components-android/issues/651

PiperOrigin-RevId: 281274404
2019-11-19 10:31:43 -08:00
connieshi
2eb666a7d8 Update chip's public.xml to include attributes for chipIconTint and closeIconTint
PiperOrigin-RevId: 281119011
2019-11-19 10:25:52 -08:00
connieshi
b58d3481c3 Restore padding after #setRippleColor update a chip's background.
PiperOrigin-RevId: 278660797
2019-11-06 10:18:27 -05:00
Mattia Pagini
a05b3a5c79 [ChipGroup] Added a method to get the selected ids
Resolves https://github.com/material-components/material-components-android/pull/667

GIT_ORIGIN_REV_ID=185fec8087c2a9c7186a2565330c797dd994dfb8
PiperOrigin-RevId: 274013304
2019-10-10 15:54:45 -04:00
ldjesper
294f12498d Rename setCornerRadius to setAllCornerSizes
PiperOrigin-RevId: 272959729
2019-10-04 20:08:43 -04:00
cketcham
a130a0c3e0 Add support for percentages to ShapeAppearanceModel
PiperOrigin-RevId: 272946740
2019-10-04 16:33:47 -04:00
cketcham
0547d2a06b Uncouple CornerSize from CornerTreatment
This allows for more easily updating the CornerSize independently from the CornerTreatment and makes it possible to create different types of CornerSizes such as percentage based corners. However, this means corner sizes can be different depending on the bounds of the shape, so the bounds need to be provided. MaterialShapeDrawable has bounds and the ShapeAppearanceModel, so there are new convenience methods there which return the current corner size for the current bounds of the drawable.

PiperOrigin-RevId: 272908508
2019-10-04 15:23:16 -04:00
ldjesper
17ff72c69a Remove deprecated getPathForSize not in any stable release
PiperOrigin-RevId: 272877489
2019-10-04 11:28:25 -04:00
connieshi
c1c55475f3 Suppress ClickableViewAccessibility lint error in Chip#onTouchEvent.
PiperOrigin-RevId: 271128148
2019-09-26 17:55:16 -04:00
afohrman
f6a67eb9f6 Fix issues with javadocs.
PiperOrigin-RevId: 269825611
2019-09-18 14:24:31 -04:00
connieshi
461e7f9be8 Remove obsolete todo.
PiperOrigin-RevId: 268932308
2019-09-18 14:07:33 -04:00
connieshi
a6106e12b2 When a chip's close icon is purely decorative (i.e. no onCloseIconClickLisetener is set), avoid setting custom accessibility delegate.
PiperOrigin-RevId: 268904579
2019-09-18 14:03:37 -04:00
marianomartin
215a839598 Internal cleanup
PiperOrigin-RevId: 267504117
2019-09-12 13:48:16 -04:00
cketcham
7bb525ff59 Update usages of ShapeAppearanceModel to use Builder pattern
PiperOrigin-RevId: 266144471
2019-08-29 15:39:51 -04:00
marianomartin
0d4515cb46 Internal cleanup
PiperOrigin-RevId: 265971745
2019-08-29 14:59:20 -04:00
Material Design Team
79953b02e3 if we don't set anything, talkback will announce it as checkbox because this class extends AppCompatCheckBox. This fix set the class name to be generic android view so nothing is announced if view is not checkable or clickable
PiperOrigin-RevId: 265746456
2019-08-29 12:19:52 -04:00
cketcham
3021dc0ac8 Add @NonNull and @Nullable annotations
PiperOrigin-RevId: 264856214
2019-08-26 11:41:00 -04:00
connieshi
238fad4560 Update Chip's AccessibilityDelegate to avoid setting classname /type description when chip is not clickable or checkable.
PiperOrigin-RevId: 264676607
2019-08-26 11:12:38 -04:00
connieshi
a6f066c0bf Chip is an unsupported item type according to Accessibility Scanner.
Set the class name on chip's AccessibilityNodeInfo as either android.widget.Button or android.widget.CompoundButton depending on whether chip is checkable.

PiperOrigin-RevId: 263424377
2019-08-16 16:12:47 -04:00
connieshi
7633a60328 Automated g4 rollback of changelist 260710940
PiperOrigin-RevId: 260920613
2019-08-02 15:35:40 -04:00
Material Design Team
a6c469374b Automated g4 rollback of changelist 260577585
PiperOrigin-RevId: 260710940
2019-08-02 15:07:08 -04:00
connieshi
d60fb3fc22 Workaround chip compositing bug that dropped stated_pressed and state_focused.
PiperOrigin-RevId: 260577585
2019-07-29 17:50:23 -04:00
isabellekim
858fa6a1d5 Update Chip's close icon Drawable to respect both the chip state (includes state_focused when focusing on the chip) and close icon state (includes state_focused when focusing on the close icon).
PiperOrigin-RevId: 260507798
2019-07-29 16:45:41 -04:00
dniz
cc73c2a630 Update TODOs
PiperOrigin-RevId: 259535844
2019-07-23 11:21:39 -04:00
dniz
0512f776c5 Remove sub-package AndroidManifest.xml files from lib directory
PiperOrigin-RevId: 258390736
2019-07-16 13:18:32 -04:00
marianomartin
0a5d66ffc0 Internal cleanup
PiperOrigin-RevId: 257802841
2019-07-15 19:07:26 -04:00
connieshi
6589e54a47 Publicly expose a hidden setter (ChipGroup#setSingleLine) inherited from a restricted parent class (FlowLayout).
PiperOrigin-RevId: 257046797
2019-07-09 12:59:59 -04:00
marianomartin
a648bac7b2 Merge DrawableUtils classes
PiperOrigin-RevId: 257022779
2019-07-09 12:56:12 -04:00
marianomartin
164bf0fabd Internal cleanup
PiperOrigin-RevId: 255609320
2019-07-03 14:02:53 -04:00