538 Commits

Author SHA1 Message Date
isabellekim
46e18968d7 Add shape theme to MaterialCardView.
When content can be clipped to the shape (round rect, Lollipop+), the content will be clipped to the interior of the stroke.

When preventCornerOverlap is true, if the content cannot be clipped, extra padding is added such that the entirety of the content is inside the stroke. Any contentPadding is additional to this padding. In order to keep centered content centered, the same amount of padding is added in each direction when preventCornerOverlap is true.

PiperOrigin-RevId: 222456398
2018-12-06 11:20:48 -05:00
melaniegoetz
bd2a4484c3 Update tablayout javadocs to refer to the method correctly
PiperOrigin-RevId: 222443665
2018-12-06 11:20:25 -05:00
cketcham
ddda11bd2d Fix slide animation for BottomAppBar
PiperOrigin-RevId: 222437688
2018-12-06 11:19:28 -05:00
afohrman
c6b554555b Use deep copies for CornerTreatment and EdgeTreatment convenience methods in
ShapeAppearanceModel.

Prior to this change, ShapeAppearanceModel#setAllCorners() and
ShapeAppearanceModel#setAllEdges() set all four corners or edges to the same
CornerTreatment or EdgeTreatment. This change creates deep copies for each
corner/edge treatment to avoid bugs caused by silently reusing the mutable
object.

PiperOrigin-RevId: 222413898
2018-12-06 11:19:04 -05:00
afohrman
98d4b148d1 Create deep copies of CornerTreatments and EdgeTreatments in ShapeAppearanceModel's copy constructor.
Implement Cloneable and override Object#clone() to create deep copies of the corner and edge treatments. The Cloneable method is generally discouraged, but this solution appears to be the most effective solution for our use case because:

- CornerTreatment and EdgeTreatment don't contain mutable fields, so using the native Object#clone() should be fine. This allows us to avoid intervening in the clone() method, which is one of the main reasons to avoid using Obect#clone().
- Since we have to maintain binary compatibility with our 1.0.0 stable release, we have very little wiggle room with which to ensure that we have effective copy() methods in each subclass of CornerTreatment and EdgeTreatment.

PiperOrigin-RevId: 222311453
2018-12-06 11:17:48 -05:00
melaniegoetz
f94800f7b0 Add TabLayout labelVisibility getter method
PiperOrigin-RevId: 222301891
2018-12-06 11:17:22 -05:00
connieshi
9b1f8478e5 Remove chipTouchTargetDelegate attribute.
PiperOrigin-RevId: 222298640
2018-12-06 11:16:48 -05:00
afohrman
a10070b6b3 Unify the creation of default CornerTreatments and EdgeTreatments.
Change the default CornerTreatment created in MaterialShapeUtils from CornerTreatment() to RoundedCornerTreatment(0). This matches the default previously created from ShapeAppearanceModel constructors.

This change unifies the defaults created in ShapeAppearanceModel's constructors with the default created by MaterialShapeUtils, by converging the two default corner and edge treatment creation methods into one method in MaterialShapeUtils. That method is then called from MaterialShapeUtils#createCornerTreatment#createCornerTreatment() and ShapeAppearanceModel's constructors.

This change also renames getDefaultCornerTreatment() to createDefaultCornerTreatment() to convey that the method instantiates an object.

PiperOrigin-RevId: 222269551
2018-12-06 11:15:10 -05:00
ldjesper
89b728d53d Translation string for dialog icon
PiperOrigin-RevId: 222240993
2018-12-06 11:14:29 -05:00
dniz
a185866318 Add support for materialThemeOverlay to Snackbar styles
PiperOrigin-RevId: 222090189
2018-12-06 11:12:31 -05:00
dniz
8073c98d60 Update MDC DayNight themes to use regular and -night qualifiers and remove
-night colors

PiperOrigin-RevId: 222079148
2018-11-26 07:57:12 -05:00
dniz
4dc914d737 Add Snackbar backgroundColorOverlayAlpha attribute
PiperOrigin-RevId: 222075167
2018-11-26 07:56:47 -05:00
marianomartin
415e6ea003 Add a cut corners top edge treatment in the BAB demo
PiperOrigin-RevId: 222071849
2018-11-26 07:55:59 -05:00
Brian Attwell
483d34a0f4 Don't rebind/relayout/reinflate any views after clicking a menu item
If none of the check state has changed, let's not update the menu. Background for this diff is at #61. While larger improvements may make sense, this diff is designed to mitigate the most serious issue in a way that doesn't create risk.

Test: used these modified classes inside the Android Uber app and ran a profiler. The problematic 50ms delay caused by this bug was fixed. You can see the before/after traces in https://issuetracker.google.com/issues/73723207.

Resolves https://github.com/material-components/material-components-android/issues/61
Resolves https://github.com/material-components/material-components-android/pull/62

GIT_ORIGIN_REV_ID=f8f8488689be67b8974d29e1c623e1dbe18cfdae
PiperOrigin-RevId: 221799350
2018-11-16 12:23:34 -05:00
connieshi
4eb0f121a9 Add build.gradle dependency on shapes to the floating action button module.
PiperOrigin-RevId: 221796687
2018-11-16 12:22:57 -05:00
afohrman
16c6daa9ea Update counter content description every time the counter is updated.
Also clarify the counter description when the limit is not exceeded. Instead of "3/10" it now reads "Characters entered 3 of 10."

Before this change, the counter would read out incorrect character lengths when focused on -- since the live region was set to ACCESSIBILITY_LIVE_REGION_POLITE, it wouldn't be incorrectly read out to the user unless they explored by touch, but if the user were to tap the counter view, it would read out an incorrect character length. This commit fixes that by updating the counter description at the appropriate point when the character count is updated.

PiperOrigin-RevId: 221671905
2018-11-16 12:20:03 -05:00
connieshi
9fd32f61c3 Log warning instead of UnsupportedOperationException when chip#setBackground and related methods are called.
PiperOrigin-RevId: 221665841
2018-11-16 12:18:15 -05:00
cketcham
88c804ea91 Fix shadow for BottomAppBar so it looks more natural
PiperOrigin-RevId: 221534701
2018-11-16 11:58:31 -05:00
marianomartin
123b9f3e70 Material button icon gravity doesn't respond to text changes.
PiperOrigin-RevId: 221480745
2018-11-16 11:56:23 -05:00
isabellekim
cea8fab635 Update card corner radius to 4dp to match spec.
PiperOrigin-RevId: 221346774
2018-11-16 11:49:05 -05:00
isabellekim
7e3cd20408 Stop setting minimum height and width on MaterialCardView's contentLayout. Since it's added with MATCH_PARENT, it will adjust according to MaterialCardView's minimum height and width, which will match CardView's behavior.
PiperOrigin-RevId: 221323749
2018-11-16 11:48:15 -05:00
connieshi
3cc29997ec Removed unused touch target helper classes.
PiperOrigin-RevId: 221318504
2018-11-16 11:37:01 -05:00
isabellekim
de6c9a071d Support materialThemeOverlay for SwitchMaterial.
PiperOrigin-RevId: 221317700
2018-11-16 11:35:00 -05:00
isabellekim
7084feab9f Support materialThemeOverlay for RadioButton.
PiperOrigin-RevId: 221315243
2018-11-16 11:33:55 -05:00
isabellekim
ef2c32cf15 Support materialThemeOverlay for checkboxes.
PiperOrigin-RevId: 221313392
2018-11-16 11:30:34 -05:00
connieshi
2e053c64d6 Fix typo.
PiperOrigin-RevId: 221259543
2018-11-16 11:29:32 -05:00
connieshi
c13949593f Add getter/setter for custom chip attribute "ensureMinTouchTargetSize".
PiperOrigin-RevId: 221145735
2018-11-16 11:28:10 -05:00
dniz
0bef80a76b Update colors for DayNight themes
PiperOrigin-RevId: 221137528
2018-11-16 11:26:51 -05:00
cketcham
ab61f4c50a Restrict access to setting the vertical offset for the shadow.
I think we may want to remove these methods in the future and just handle this automatically.

PiperOrigin-RevId: 220944239
2018-11-16 11:19:10 -05:00
leticiars
ea44a6fc85 Fixing MDC filled background text field for hovered and disabled states.
PiperOrigin-RevId: 220843896
2018-11-16 11:12:58 -05:00
marianomartin
2fdb73de6e Override setVisibility so it's not restricted
PiperOrigin-RevId: 220838067
2018-11-16 11:11:52 -05:00
marianomartin
47fc285f6f Support shape theming in FAB Api 19 and lower
PiperOrigin-RevId: 220806554
2018-11-16 11:10:42 -05:00
isabellekim
3bc3cc9cbf Stop modifying the DEFAULT_CORNER_TREATMENT in ShapeAppearanceModel.
PiperOrigin-RevId: 220688536
2018-11-16 11:06:53 -05:00
connieshi
60d1dfac70 Update chipDrawable to be wrapped by InsetDrawable (if needed) to ensure it meets Android's recommended minimum touch target size.
Update demo catalog app.

PiperOrigin-RevId: 220370443
2018-11-16 10:57:34 -05:00
isabellekim
26109ae837 Update MaterialCardView to use MaterialShapeDrawable, changing stroke to respect extra padding that CardView adds for shadows.
Also adds clickable Card to the catalog

PiperOrigin-RevId: 220343650
2018-11-16 10:53:15 -05:00
marianomartin
215bb6e294 Increase touch target of fab to min 48dp
PiperOrigin-RevId: 220311577
2018-11-16 10:51:48 -05:00
connieshi
c48d882994 Add javadoc to ChipDrawable's getters and setters.
PiperOrigin-RevId: 220301488
2018-11-16 10:51:06 -05:00
connieshi
a9b6225c08 Add build.gradle dependency on shapes to the Chip module.
PiperOrigin-RevId: 220168626
2018-11-16 10:40:37 -05:00
marianomartin
e94e2d35fe Support shape theming in fab
PiperOrigin-RevId: 219812144
2018-11-16 10:38:43 -05:00
connieshi
f219705bb6 Add javadoc to chip getters and setters.
PiperOrigin-RevId: 219793479
2018-11-16 10:37:15 -05:00
afohrman
ff9dded7ba Use typescale for TextInputLayout.
Update the type within TextInputLayout create color attributes for each element in order to ensure that the colors can be set outside of our typescale. The colors set in those new attributes are intended to be visual no-ops; the goal of this change is not to update the colors.

PiperOrigin-RevId: 219726813
2018-11-16 10:35:41 -05:00
isabellekim
2997b6995f Add shadow compat support for cut corners and triangle edge treatments, updating ShapePath to add extra shadow arcs when needed:
+ Updates LineShadowOperation to call drawEdgeShadow with a horizontal edge
+ ShapePath has a start & end shadow angle and will add shadow arcs to fill in gaps between shadow operations

PiperOrigin-RevId: 219686107
2018-11-01 16:22:14 -07:00
isabellekim
b07fdf2459 Remove anti-aliasing from cornerShadowPaint (to allow corner shadows to line up with edge shadows along angles)
PiperOrigin-RevId: 219575570
2018-11-01 16:20:43 -07:00
leticiars
7eac68f306 Adding surface layer support to MDC text fields.
PiperOrigin-RevId: 219499276
2018-11-01 16:19:29 -07:00
cketcham
3d8e2b408c Stop expanding the clip rect on versions of android that have native shadow support
PiperOrigin-RevId: 219478262
2018-11-01 16:17:19 -07:00
connieshi
b888d9620b Support shape theming in Chip component.
PiperOrigin-RevId: 219373344
2018-11-01 16:16:14 -07:00
isabellekim
e9a8d48f60 Fixes MaterialShadowDrawable shadow to respect bounds that don't start at (0,0)
PiperOrigin-RevId: 219367777
2018-11-01 16:15:40 -07:00
cketcham
22cd4dba4f Prevent invalidating MaterialShapeDrawable if parameters haven't changed
PiperOrigin-RevId: 219319784
2018-11-01 16:13:36 -07:00
afohrman
a25e13ca39 Update isStateful() method in MaterialShapeDrawable.
isStateful() should include the statefulness of the fill and stroke colors.

PiperOrigin-RevId: 219310584
2018-11-01 16:11:35 -07:00
marianomartin
85bec581d7 Add a constructor that takesdefault cornersize in ShapeAppearanceModel
PiperOrigin-RevId: 219308037
2018-11-01 16:11:12 -07:00