20 Commits

Author SHA1 Message Date
connieshi
0c8dd4f121 Stop unicode wrapping user input strings in Chip#setText.
Remove overridden getText method, and rely on the TextView's implementation.
This also fixes accessibility issues when Talkback granularity is set to "word" or "characters".

PiperOrigin-RevId: 207296625
2018-08-17 16:59:28 -04:00
connieshi
7449427d36 Each time a chip icon is updated, apply the current chip icon tint.
Fixes bug that only updated chip icon tint if tint is updated after an icon has been set.

PiperOrigin-RevId: 206838032
2018-08-02 18:06:05 -07:00
connieshi
662aa06b77 Add null check before access attribute set.
PiperOrigin-RevId: 203830200
2018-07-11 15:17:15 -04:00
connieshi
84c6020605 Check if a user explicitly set any of the deprecated xml attributes but not the updated counterparts:
chipIconEnabled vs. chipIconVisible
    closeIconEnabled vs. closeIconVisible
    checkedIconEnabled vs. checkedIconVisible

PiperOrigin-RevId: 203804667
2018-07-09 15:01:40 -04:00
connieshi
6020fcdbf1 Fix API issue with icon visibility.
Deprecate *iconEnabled methods to is*iconVisible and setIs*iconVisible methods.

PiperOrigin-RevId: 202658616
2018-07-02 09:50:53 -04:00
connieshi
608d2b2fd7 Add support for android:maxWidth to ChipDrawable. Restrict the intrinsic width of the ChipDrawable by the max width. Fixes bug that ignored maxWidth set in Chip.
PiperOrigin-RevId: 202048514
2018-07-02 09:40:13 -04:00
connieshi
d584f91ccc Resolve fonts asynchronously to avoid ANR.
Added flag to specify that fonts should be resolved synchronously for instrumentation tests.

PiperOrigin-RevId: 202033678
2018-07-02 09:37:14 -04:00
connieshi
3f00c13ebe Fix api issues, defer to TextView to render the chip text and ChipDrawable to render everything else.
List of text related attributes/methods supported with this approach:
    android:autoLink
    android:hint
    android:text
    android:textAllCaps
    android:textAppearance
    android:textColor

    android:textColorHint
    android:textColorLink
    android:textIsSelectable
    android:textScaleX
    android:textSize
    android:textStyle
    android:typeface
    android:fontFamily

    Not supported:
    android:textColorHighlight
    android:textColorLink

PiperOrigin-RevId: 200578044
2018-06-20 17:27:20 -04:00
connieshi
860b04767b Unwrap mutated drawable (chipIcon and closeIcon) before returning it in the getter.
PiperOrigin-RevId: 199636765
2018-06-20 17:25:37 -04:00
connieshi
412ee4c1f1 Add support for tinting the chip icon.
PiperOrigin-RevId: 199526967
2018-06-20 17:24:18 -04:00
connieshi
57aeb2b7f8 Android Studio is looking for a "Chip" declare-stylable when trying to determine what attributes are applicable for the "Chip" component. Android Studio doesn't know that "ChipDrawable" is used internally and all attributes to "ChipDrawable" applies.
This is preventing completions of attribute names for Chip and the attribute panels shows up empty for Chip.

Rename R.styleable.ChipDrawable to R.styleable.Chip and update ChipDrawable to use it.

AS 3.2 canary > 14  (currently 16) is required to see the attributes in the attribute panel.

PiperOrigin-RevId: 198909123
2018-06-04 10:49:01 -04:00
connieshi
4a7bd84360 Add null check to Chip#setText and ChipDrawable#setText. Set null text to empty string, this is done internally by TextView.
Changed Chip#getText and ChipDrawable#getText to be @NotNull

PiperOrigin-RevId: 198868472
2018-06-04 10:48:35 -04:00
connieshi
de67e0d8ea Keep reference to user provided value in ChipDrawable#setText and return it in ChipDrawable#getText.
Currently when a user specifies an instance of java.lang.String to ChipDrawable#setText, ChipDrawable#getText incorrectly returns an instance of android.text.SpannableStringBuilder.

PiperOrigin-RevId: 198393803
2018-05-30 17:37:23 -04:00
connieshi
2072f7af4d Rename ChipDrawable#getChipText to ChipDrawable#ChipDrawable#getText
Rename ChipDrawable#setChipTextResource to ChipDrawable#setTextResource
Rename ChipDrawable#setChipText to ChipDrawable#setText.

PiperOrigin-RevId: 197948000
2018-05-30 17:33:30 -04:00
connieshi
a71326896a Use the android:text attribute instead of chipText attribute to specify text label for ChipDrawable.
This is one in a series of planned changes that aim to delegate rendering a Chip's text to TextView instead of ChipDrawable.

PiperOrigin-RevId: 197780081
2018-05-30 17:19:38 -04:00
connieshi
8cd8c2ad80 Prevent callers from setting ellipsize to MARQUEE because chip text should not scroll.
If caller sets ellipsize to MARQUEE an UnsupportedOperstaionException will be thrown at runtime.
Override ellipsize getters / setters and pass the value to ChipDrawable.

PiperOrigin-RevId: 196813582
2018-05-16 11:50:05 -04:00
connieshi
56b6432e37 Add support to ellipsize chip text.
When converting float to int value for intrinsic width, round instead of cast.
Round float values When determining whether text needs to be clipped to avoid overly aggressive clipping (and ellipsizing).

Rewrote layout for the chip example in demo app due to a known GridLayout.

PiperOrigin-RevId: 195957006
2018-05-09 13:39:23 -04:00
Material Design Team
b63a63e853 Allow custom text to be set for a Chip's closeIcon's contentDescription.
PiperOrigin-RevId: 195410650
2018-05-04 12:26:52 -04:00
connieshi
0eb5c1ae75 Fix typo in ChipDrawable documentation s/getIntrinsicWidth/getIntrinsicHeight
PiperOrigin-RevId: 193965067
2018-04-30 11:56:45 -04:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00