50 Commits

Author SHA1 Message Date
afohrman
db4c951c0c Add annotations to hide protected MaterialShapeDrawable#drawShape() method.
MaterialShapeDrawable#drawShape() is protected, so it shouldn't be visible outside of the library group. This commit also adds documentation, since this method is protected.

PiperOrigin-RevId: 227696166
2019-01-10 16:01:24 -05:00
cketcham
dc72aaeed4 Migrate Gradle build and sources to androidx
PiperOrigin-RevId: 225551505
2018-12-21 11:07:45 -05:00
marianomartin
cf69538c9c Refactor path logic out of MSD
PiperOrigin-RevId: 224182175
2018-12-06 12:05:06 -05:00
marianomartin
61f426afca Remove (get/set)PaintFlags from MSD
PiperOrigin-RevId: 224162294
2018-12-06 12:04:30 -05:00
cketcham
7a2c2823ee Only recalculate the path if it has changed
PiperOrigin-RevId: 223826749
2018-12-06 11:47:06 -05:00
marianomartin
d75fb6513c Fix constant state in MSD
PiperOrigin-RevId: 223802087
2018-12-06 11:46:29 -05:00
Material Design Team
f152b75e1a Automated g4 rollback of changelist 223558824
PiperOrigin-RevId: 223564801
2018-12-06 11:43:02 -05:00
marianomartin
c75482b473 Fix constant state in MSD
PiperOrigin-RevId: 223558824
2018-12-06 11:42:42 -05:00
marianomartin
bf024ebed9 Remove stroke shader from MSD
PiperOrigin-RevId: 223397575
2018-12-06 11:38:24 -05:00
marianomartin
3bf777db8a Implement Mutate in MaterialShapeDrawable
PiperOrigin-RevId: 223059565
2018-12-06 11:31:50 -05:00
cketcham
95cf55f04b Remove option to use paint shadow
PiperOrigin-RevId: 223017988
2018-12-06 11:25:01 -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
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
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
afohrman
ed37888efe Remove MaterialShapeDrawable hairline inset from fill bounds.
PiperOrigin-RevId: 219303758
2018-11-01 16:09:21 -07:00
connieshi
d9d9b6e1ef Change scope of #getFillBounds to protected so children can override it.
PiperOrigin-RevId: 219227988
2018-11-01 16:08:38 -07:00
connieshi
0f764e9a15 Change scope of #getBoundsAsRectF and #drawShape to be protected so the children of MSD could call them.
PiperOrigin-RevId: 219189920
2018-11-01 16:08:10 -07:00
afohrman
38ef896da2 Adjust corners of MaterialShapeDrawable's stroke to draw the stroke perfectly over the fill.
To draw the stroke with the correct corner radius, MaterialShapeDrawable now calculates what the corner radius should be and adjusts the stroke accordingly.

Before this change, the corner radius was calculated such that the stroke didn't fully reach the edges of the shape. This change tweaks the corner radius calculation so that the stroke's path matches the fill's path and is overlaid directly on top of the fill's shape.

PiperOrigin-RevId: 219139586
2018-11-01 16:04:35 -07:00
cketcham
3bc7afd292 Disable native shadows when compat shadows are always drawn.
PiperOrigin-RevId: 219134990
2018-11-01 16:04:08 -07:00
afohrman
52eb143e99 Optimize stroke inset bounds method.
Use RectF#inset() instead of manually insetting the stroke by half of the stroke width.

PiperOrigin-RevId: 218887035
2018-10-28 21:47:13 -04:00
cketcham
560c982284 Enable shadows for BottomAppBar
PiperOrigin-RevId: 218868156
2018-10-28 21:44:27 -04:00
cketcham
ab1992a2ba Fix shadow rendering and add shadow rotation angle for MaterialShapeDrawable
PiperOrigin-RevId: 218576270
2018-10-28 19:13:20 -04:00
marianomartin
e192fbe3e0 Use round rect when possible in MSD
PiperOrigin-RevId: 218559377
2018-10-28 19:12:46 -04:00
afohrman
ccf98970c2 Add methods to get and set stroke and fill paint colors.
Also refactor some of the stroke methods, since stroke was using the tint rather than the color to color the stroke.

PiperOrigin-RevId: 218383900
2018-10-28 18:34:50 -04:00
cketcham
530100e574 Add modes to control compat shadows for MaterialShapeDrawable
PiperOrigin-RevId: 217861830
2018-10-28 18:32:26 -04:00
cketcham
2edfef1a6c Draw compatibility shadows if the shape is concave or native shadows aren't supported.
PiperOrigin-RevId: 217689320
2018-10-28 18:28:35 -04:00
gauthams
17ffd91b6c Add cornerRadius setter to MaterialShapeDrawable.
PiperOrigin-RevId: 217643698
2018-10-28 18:28:07 -04:00
gauthams
6abaa62d56 Update MaterialShapeDrawable to return dummy ConstantState.
PiperOrigin-RevId: 217412761
2018-10-28 18:24:30 -04:00
marianomartin
169ac3f142 Add ability to set shader on border paint for MSD
PiperOrigin-RevId: 216709276
2018-10-11 18:30:54 -04:00
dniz
f16d0e1a8e Add back getPathForSize() method to MaterialShapeDrawable to preserve API
PiperOrigin-RevId: 215956091
2018-10-11 18:06:02 -04:00
cketcham
3de44ca7ac Add shapes theming infrastructure.
Add shapeAppearance and shapeAppearanceOverlay attributes. These attributes combine to support shapes theming. ShapeAppearance is modeled after TextAppearance. A shapeAppearance attribute contains a style reference that is meant to be defined at the theme level. Since changing anything defined in the shapeAppearance would clobber everything else in the ShapeAppearance, the shapeAppearanceOverlay attribute is provided for clients to modify the shapeAppearance.

PiperOrigin-RevId: 215273652
2018-10-02 14:53:40 -04:00
Material Design Team
a681567504 Automated g4 rollback of changelist 215242636
PiperOrigin-RevId: 215260729
2018-10-02 14:52:47 -04:00
cketcham
432b46cc83 Add shapes theming infrastructure.
Add shapeAppearance and shapeAppearanceOverlay attributes. These attributes combine to support shapes theming. ShapeAppearance is modeled after TextAppearance. A shapeAppearance attribute contains a style reference that is meant to be defined at the theme level. Since changing anything defined in the shapeAppearance would clobber everything else in the ShapeAppearance, the shapeAppearanceOverlay attribute is provided for clients to modify the shapeAppearance.

PiperOrigin-RevId: 215242636
2018-10-02 14:21:40 -04:00
cketcham
8bd94e9276 Rename ShapePathModel to ShapeAppearanceModel.
This commit renames ShapePathModel to ShapeAppearanceModel to align with the new shapeAppearance attributes that will be added for shape theming.

PiperOrigin-RevId: 214818189
2018-09-28 16:30:13 -04:00
cketcham
c6a08a4b68 Allow for centering on EdgeTreatments
PiperOrigin-RevId: 214613004
2018-09-28 16:28:45 -04:00
cketcham
0527fe7d09 Fix MaterialShapeDrawable path so it is correctly convex on API 21 and 22
PiperOrigin-RevId: 214461440
2018-09-28 16:28:01 -04:00
ldjesper
5df0d8b760 Fix draw bounds for MaterialShapeDrawable stroke and fill
PiperOrigin-RevId: 213877586
2018-09-28 16:12:57 -04:00
ldjesper
03edbf3d5f Switch MaterialShapeDrawable to RectF
PiperOrigin-RevId: 213872653
2018-09-28 16:12:36 -04:00
ldjesper
20bbf1523b Improvements to readability and javadoc of MaterialShapeDrawable
PiperOrigin-RevId: 212875571
2018-09-14 11:04:01 -04:00
ldjesper
f79c91e53e Allow different stroke and fill colors for MaterialShapeDrawable
PiperOrigin-RevId: 212857049
2018-09-14 11:03:07 -04:00
afohrman
7fb37e86ba Make MaterialShapeDrawable anti-alias its Paint.
Anti-aliasing the Paint by default eliminates the appearance of jagged edges and corners.

Anti-aliasing is currently supported by calling setPaintFlags() on MaterialShapeDrawable, but it is not yet enabled by default.

PiperOrigin-RevId: 212709536
2018-09-14 11:00:52 -04:00
afohrman
1335815927 Fix MaterialShapeDrawable's handling of tint.
Before this change, MaterialShapeDrawable incorrectly handled ColorStateLists. Only the color defined "last" in a ColorStateList was used. This is because MaterialShapeDrawable was not properly updating and handling state changes. This change fixes the issue by updating the tint filter appropriately and overriding some methods which should have been overridden.

PiperOrigin-RevId: 210779870
2018-08-31 11:12:24 -04:00
afohrman
49dc5f4e7c Make MaterialShapeDrawable respect to InsetDrawables.
Before this change, MaterialShapeDrawable did not draw with respect to InsetDrawables. The problem was that MaterialShapeDrawable was using the Canvas to determine where to draw, rather than the bounds. This change reworks MaterialShapeDrawable to use the bounds to calculate and draw the shape's path, rather than the Canvas.

PiperOrigin-RevId: 210724227
2018-08-29 11:33:35 -04:00
marianomartin
585e2fede0 Remove constructor comments
PiperOrigin-RevId: 209762154
2018-08-28 16:34:43 -04:00
Material Design Team
ee9e754c0a Removed unnecessary complexity
PiperOrigin-RevId: 206320111
2018-08-02 18:02:23 -07:00
cketcham
40696b02b7 Fix jagged edges on cutout for BottomAppBar
PiperOrigin-RevId: 206194466
2018-08-02 17:57:09 -07:00
Material Design Team
4983b60975 Fix potential bug with shared pointF
PiperOrigin-RevId: 206128392
2018-08-02 17:55:02 -07:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00