84 Commits

Author SHA1 Message Date
connieshi
f35acd8660 Rolling back again because of bad interactions with espresso ViewMatchers.
PiperOrigin-RevId: 198709590
2018-05-31 16:31:26 -04:00
connieshi
200fdcb6a2 Rolling forward changes to override Chip#getText() and Chip#setText(CharSequence, BufferType) now that a bug in ChipDrawable#getText has been fixed and internal tests are passing again.
PiperOrigin-RevId: 198616302
2018-05-30 17:46:46 -04:00
gauthams
670787be83 Update button to use textappearance theme attributes, and enforce textappearance check
PiperOrigin-RevId: 198609334
2018-05-30 17:45:15 -04:00
cketcham
a7ad02eb7b Add hideOnScroll attr to the BottomAppBar javadoc
PiperOrigin-RevId: 198596762
2018-05-30 17:44:54 -04:00
cketcham
bc9224e122 Add missing accessor methods for BottomAppBar
PiperOrigin-RevId: 198593477
2018-05-30 17:44:24 -04:00
Aleksander Ermakov
84663583b7 Set indicator bottom padding to always be 0.
There was extra padding at the bottom of the indicator view (i.e. the helper or error TextView underneath the text field. This commit removes that extra padding.

PiperOrigin-RevId: 198578652
2018-05-30 17:43:55 -04:00
connieshi
bb8f8388e7 Prevent users from setting the background attribute because Chip manages its own background drawable.
Allow setBackground to be called by Chip itself internally to set the background to be chipDrawable or ripple.

PiperOrigin-RevId: 198572908
2018-05-30 17:43:30 -04:00
marianomartin
663fd7abff add res-public files
PiperOrigin-RevId: 198567215
2018-05-30 17:42:48 -04:00
cketcham
eb56a61a3b Fix BottomAppBar top edge to prevent pointy corners
PiperOrigin-RevId: 198550727
2018-05-30 17:42:24 -04:00
Material Design Team
390a7acbf8 Causes TextInputLayout to expose its AccessibilityNodeInfo as contentInvalid if its character counter has overflowed
PiperOrigin-RevId: 198481505
2018-05-30 17:41:46 -04:00
connieshi
77f4a89f73 Automated g4 rollback of changelist 198434516
PiperOrigin-RevId: 198449773
2018-05-30 17:41:19 -04:00
connieshi
5acdd69431 Prevent users from setting the background attribute because Chip manages its own background drawable.
PiperOrigin-RevId: 198434516
2018-05-30 17:40:14 -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
afohrman
bdb25ff7e3 Use android:padding attributes instead of boxPadding attributes for text field dimensions.
Move to use native android:padding attrs instead of custom boxPadding attributes for text fields. This is accomplished by creating box styles for TextInputEditText, and setting android:padding attributes in those.

The TextInputLayout box styles set the appropriate TextInputEditText style on its child by wrapping the TextInputEditText style in theme overlays. This is kind of neat, since it allows for the user not to have to set a style on both the TextInputLayout and TextInputEditText - the user does not even have to know about the TextInputEditText styles with this pattern. It should also help clear up some confusion over where to set the hint and other areas of haziness between TextInputLayout and TextInputEditText.

The default editTextStyle is set to the filled box style, to match the default TextInputLayout style.

This change removes the box padding attributes, and it also removes the dimension resources in favor of setting them in the style to improve readability.

This commit also changes TextInputEditText constructors to both use a theme attribute in the 3-arg constructor and call through to the TextInputEditText overloaded constructors rather than call the super's constructor from each. This allows the theme attribute set in the theme overlays to take effect.

PiperOrigin-RevId: 198051251
2018-05-30 17:35:13 -04:00
connieshi
9492832207 Rolling back changes to override Chip#setText and Chip#getText because it broke some tests.
PiperOrigin-RevId: 197975319
2018-05-30 17:34:46 -04:00
connieshi
e3303db70c Override Chip#getText() to return the internal chip text value via chipDrawable#getChipText.
Override Chip#setText(CharSequence, BufferType) to set the value on the internal chip text and prevent text from being set on Chip's super class because ChipDrawable will handle text rendering.
     - This method is called by all overridden versions of TextView#setText except android.widget.TextView#setText(char[], int, int)}, which cannot be overridden. This is not ideal but an incremental change towards supporting all flavors of android.widget.TextView#setText methods.

Deprecate Chip#setChipTextResource(int) and Chip#setText(CharSequence)

PiperOrigin-RevId: 197960701
2018-05-30 17:34:04 -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
cketcham
c172562488 Update BottomAppBar fab margin to represent the distance between the cutout and the fab rather than twice the distance
PiperOrigin-RevId: 197939692
2018-05-30 17:32:51 -04:00
connieshi
52d2a1de2e Add a ChipGroup.LayoutParams static class that extends from FlexBoxLayout.LayoutParams. Provide the appropriate pass-through constructors for this new class. Override generateLayoutParams/checkLayoutParams/generateDefaultLayoutParams in ChipGroup to check for and return instances of the new ChipGroup.LayoutParams class.
PiperOrigin-RevId: 197933724
2018-05-30 17:32:24 -04:00
dniz
b4529d2a88 Remove unused MathUtils methods and add documentation. Also replace
MathUtils#constrain with Support Library MathUtils#clamp

PiperOrigin-RevId: 197905324
2018-05-30 17:31:27 -04:00
gauthams
cfe88cad74 Fix a long-standing selection bug in TabLayout, where an OnTabSelectedListener onTabUnselected() method would interpret the now-unselected tab as still being selected, resulting in broken behavior where an unselected tab was still being displayed as selected.
PiperOrigin-RevId: 197806355
2018-05-30 17:30:18 -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
dniz
d592999d59 Infer initial lifted state for AppBarLayout lift on scroll. This preserves the app bar's elevation across screen rotations and saving/restoring of instance state.
PiperOrigin-RevId: 197754058
2018-05-30 17:19:08 -04:00
dniz
5885d2954d Fix spacing in AppBarLayout attr comment
PiperOrigin-RevId: 197630608
2018-05-30 17:18:48 -04:00
dniz
49b6f396ba Update AppBarLayout to support lift on scroll behavior
PiperOrigin-RevId: 197607028
2018-05-30 17:17:09 -04:00
Material Design Team
3e20d0720f Hide TextInputLayout from accessibility services and instead mirror its attributes on its EditText.
PiperOrigin-RevId: 197509011
2018-05-22 13:59:17 -04:00
connieshi
a898d12289 Prevent users from setting chip text to appear on multiple lines.
PiperOrigin-RevId: 197134896
2018-05-22 13:57:36 -04:00
dniz
81c4ece8f7 Remove colorPrimaryLight, colorSecondaryLight, and colorSecondaryDark
PiperOrigin-RevId: 197093793
2018-05-22 13:56:47 -04:00
connieshi
7fa43fc8cb Add null check before validating attribute set to avoid NPE.
PiperOrigin-RevId: 197050012
2018-05-17 19:46:17 -04:00
afohrman
1cad4007dc Roll forward box background fix.
PiperOrigin-RevId: 197041463
2018-05-17 19:45:46 -04:00
connieshi
eb89b76787 Prevent user from setting start/end compound drawable on Chips. They should be set via app:chipIcon and app:closeIcon instead.
PiperOrigin-RevId: 197037053
2018-05-17 19:45:00 -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
afohrman
4700966a38 Roll back box background changes.
PiperOrigin-RevId: 196762626
2018-05-16 11:49:37 -04:00
afohrman
e566a535ac Ensure box background is drawn behind other text field elements.
This commit:
- Moves the draw calls in TextInputLayout#draw to happen in a better order: now, the background is drawn first, then TextInputLayout and its children, then the hint. This prevents the box from drawing on top of other text field elements.
- Updates box background setters and getters to modify boxBackgroundColor instead of defaultBoxBackgroundColor.
- Adds a demo for filled box background color changes to the text field demo.

PiperOrigin-RevId: 196748102
2018-05-16 11:48:54 -04:00
marianomartin
7aff9d2e8b Snackbar, not animating only when talkback is turned on
PiperOrigin-RevId: 196714687
2018-05-16 11:45:09 -04:00
marianomartin
40c667c24d Annotate setIconSize with @Dimension
PiperOrigin-RevId: 196705264
2018-05-16 11:44:37 -04:00
marianomartin
9d1d6e7bae Add setIconSize to material button
Adding functionality to be able to scale the icon

PiperOrigin-RevId: 196698054
2018-05-16 11:44:12 -04:00
afohrman
ba1d772575 Annotate NavigationView padding setters and getters.
Annotate with @Dimension, which by default implies a pixel dimension.

PiperOrigin-RevId: 196549450
2018-05-16 11:43:46 -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
da42189a47 Added Outlined buttons to style and to MDC Catalog Buttons example.
PiperOrigin-RevId: 195479574
2018-05-07 13:37:36 -04:00
Material Design Team
79bf9d0e8e Support Chip text with TalkBack on older API levels
PiperOrigin-RevId: 195430570
2018-05-04 13:58:18 -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
dcarlsson
da9a170696 Fix typo in AppBarLayout documentation.
PiperOrigin-RevId: 195305707
2018-05-03 17:02:55 -04:00
Material Design Team
e37dc2a82e Create @SnackbarDuration for Snackbar class.
Snackbar had methods with params annotated with @BaseTransientBottomBar.Duration which uses BaseTransientBottomBar.LENGTH_SHORT, ... constants, which means Android lint will complain if you try to call Snackbar#make with Snackbar.LENGTH_SHORT and tell you to instead use BaseTransientBottomBar.LENGTH_SHORT which is silly. This works around this issue.

PiperOrigin-RevId: 195269921
2018-05-03 14:36:31 -04:00
Material Design Team
9d5f06978b [a11y] Ensure CollapsingToolbarLayout surfaces its custom-rendered title to accessibility services.
PiperOrigin-RevId: 195269779
2018-05-03 14:35:57 -04:00
Material Design Team
0b2eb829de Automated g4 rollback of changelist 195137298
PiperOrigin-RevId: 195163452
2018-05-03 12:53:25 -04:00
dniz
e4c8535352 Remove backlayer and materialswitch
PiperOrigin-RevId: 195148145
2018-05-02 17:07:28 -04:00
Material Design Team
fa28108018 [a11y] When the collapsing title is not null or empty, set the content description as the collapsing title.
PiperOrigin-RevId: 195137298
2018-05-02 17:05:57 -04:00
dniz
f3a218cdbc Remove tonal variations of primary and secondary colors
PiperOrigin-RevId: 195102546
2018-05-02 14:12:49 -04:00
Material Design Team
84a00dd6e7 Restore child accessibility focus when the BackLayoutLayout is expanded.
PiperOrigin-RevId: 194968521
2018-05-01 17:12:12 -04:00