125 Commits

Author SHA1 Message Date
pekingme
9a8272d9c1 [Shape] Updated isRoundRectCornerMorph and pathDirty logic in MaterialShapeDrawable
PiperOrigin-RevId: 829468349
2025-11-07 17:58:47 +00:00
pekingme
90a8043ad3 [Shape] Code format.
PiperOrigin-RevId: 828094095
2025-11-07 17:49:44 +00:00
pekingme
ea9d25050c [Shape] Always skip corner morph animation on bounds change in MaterialShapeDrawable.
PiperOrigin-RevId: 827536893
2025-11-07 17:48:18 +00:00
pekingme
3482899045 [Shape] Fixed MaterialShapeDrawable#isRoundRect to use state-aware shape appearance.
PiperOrigin-RevId: 822156263
2025-10-22 16:04:30 +00:00
pekingme
bbd1292567 [Shape] Optimized path calculation in MaterialShapeDrawable.
Added a check for `shouldCalculatePath()` before recalculating the fill and stroke paths during drawing. This prevents unnecessary path calculations when the shape is not visible or doesn't need path updates.

PiperOrigin-RevId: 814298357
2025-10-07 19:52:25 +00:00
rightnao
4db190003e [MaterialShapeDrawable] Introduce ShapeAppearance interface to reduce branching between ShapeAppearanceModel and StateListShapeAppearanceModel
PiperOrigin-RevId: 784395554
2025-07-21 14:32:30 +00:00
kendricku
2667e098db [Button] Added optical center feature.
ORIGINAL_AUTHOR=pekingme

PiperOrigin-RevId: 748415083
2025-04-18 00:14:04 +00:00
pubiqq
23aca03255 [Internal] Remove pre-Lollipop checks
Resolves https://github.com/material-components/material-components-android/pull/4266

GIT_ORIGIN_REV_ID=1de7808e66dd6666c893217c76c7499afe2df6a3
PiperOrigin-RevId: 669688797
2024-09-03 13:31:29 +00:00
pekingme
29ce8d32c3 [ButtonGroup] Added a new component ButtonGroup.
PiperOrigin-RevId: 666359073
2024-08-22 19:05:09 +00:00
pekingme
e1a103e2e1 [Shape] Optimized getOutline().
PiperOrigin-RevId: 655217170
2024-07-24 15:32:02 +00:00
pekingme
8e63e7fc29 [Shape] Added state list support to shape appearance and corner size.
PiperOrigin-RevId: 653356021
2024-07-22 18:26:34 +00:00
pekingme
b9a2ce93c1 Automated g4 rollback of changelist 650718631
PiperOrigin-RevId: 651858394
2024-07-22 18:23:58 +00:00
pekingme
eb56238f46 [Shape] Moved unnecessary object from the drawable state.
PiperOrigin-RevId: 651118525
2024-07-22 18:20:56 +00:00
pekingme
2799892b5e [Shape] Added state list support to shape appearance and corner size.
PiperOrigin-RevId: 650718631
2024-07-10 19:21:00 +00:00
Material Design Team
e4f00fda11 Automated g4 rollback of changelist 637051547
PiperOrigin-RevId: 637099379
2024-05-28 16:59:17 +00:00
pekingme
384d58fb98 [Button] Added responsive touch (corner morph).
PiperOrigin-RevId: 637051547
2024-05-25 02:19:11 +00:00
pekingme
e4fbb84f47 [Shape] Fixed stroke path calculation for custom interpolation start shape.
PiperOrigin-RevId: 629942322
2024-05-02 15:45:01 +00:00
kendricku
cc125d9b47 [Shape] Add interpolation between default and an arbitrary corner radius for Android Material Views.
PiperOrigin-RevId: 626446451
2024-04-23 20:20:48 +00:00
pekingme
1562d0b64f [ExposedDropdownMenu] Added attribute to set dropdown menu's container.
PiperOrigin-RevId: 528578402
2023-05-02 16:10:48 -04:00
conradchen
184be8a879 [Build] Internal change
PiperOrigin-RevId: 508758212
2023-02-10 23:33:46 +00:00
conradchen
25b3c2b15c [TextField] Fix cutout not working when backgroundTint is set
When backgroundTint is set against the AutoCompleteTextView, since the background drawable of it is a LayerDrawable, which will try to get the constant states of its child drawables and create new drawables from them.

In CutoutDrawable we didn't implement that logic - so the constant state returned will be MaterialShapeDrawableState, and therefore the new drawables created are plain MaterialShapeDrawables, instead of CutoutDrawable.

Fixes this by correctly implement drawable state for CutoutDrawable.

Resolves https://github.com/material-components/material-components-android/issues/3041

PiperOrigin-RevId: 508664043
2023-02-10 16:20:37 +00:00
pubiqq
8cd2341a79 [Internal] Set the outline to a path whenever possible
Resolves https://github.com/material-components/material-components-android/pull/2934

GIT_ORIGIN_REV_ID=2ef0a3a6d9aa130e652fccbfc3d79f1345f2b32c
PiperOrigin-RevId: 478146360
2022-10-03 19:15:11 +00:00
pubiqq
3ca41be8f0 [General] Fix typos
Resolves https://github.com/material-components/material-components-android/pull/2654

GIT_ORIGIN_REV_ID=b8f6728979875629f2c813ef90d2f671cf56b4eb
PiperOrigin-RevId: 442852630
2022-04-19 14:48:55 -04:00
Material Design Team
cfc00aa5a3 Update android core class definitions across material
PiperOrigin-RevId: 414839941
2021-12-08 14:56:25 +00:00
Andre\u0301 Wachter
5ff917dc5f [MaterialShapeDrawable] Implement getAlpha()
Resolves https://github.com/material-components/material-components-android/pull/2479

GIT_ORIGIN_REV_ID=20d18f9732871b06aa9f95af0bd02f23b3e7995a
PiperOrigin-RevId: 412092198
2021-11-29 17:31:06 +00:00
conradchen
79ae9b1351 [TextInputLayout] Create label cutout only on borders
When a collapsed label is showing, we cutout part of the border of an outlined text input box according to the exact stroke width. However when using rounded corners, there can be slight offsets from where the border is really drawn. Also, if the corner size is large, the part of border we need to cutout might not just be a straight line but contains part of the corner.

However, with the existing cutout logic, we cannot just cutout the whole label area, which will cause the area inside the border also gets cutout, if it has color. This CL changes the cutout drawing logic to only apply the cutout on stroke drawing to fix the issue.

This CL also fixes the bug that when the label is too long, we didn't take the ellipsized text length into account. Creates a variable to store the calculated collapsed text width to fix the issue.

Resolves https://github.com/material-components/material-components-android/issues/2145

PiperOrigin-RevId: 402316057
2021-10-12 11:26:21 -04:00
dsn5ft
ec591e5420 [MaterialShapeDrawable] Open access to getResolvedTintColor() method
PiperOrigin-RevId: 396585644
2021-09-16 11:37:52 -07:00
dsn5ft
3008d782e7 [AppBarLayout] Added listener for when lift on scroll background elevation and color change
PiperOrigin-RevId: 386243658
2021-07-28 14:26:55 -04:00
conradchen
b8c9f4949d [MaterialShapeDrawable] Move static paint initialization to static block
PiperOrigin-RevId: 374650659
2021-05-19 10:59:31 -07:00
connieshi
6951bd5179 [Chip] Support elevation overlay.
Resolves https://github.com/material-components/material-components-android/issues/1749

PiperOrigin-RevId: 336930100
2020-10-15 13:21:17 -07:00
marianomartin
c59c04639c [MaterialShapeDrawable] Convert ShapeAppearancePathProvider to a singleton.
Also allocate less path objects.

PiperOrigin-RevId: 325287653
2020-08-06 21:10:36 -04:00
marianomartin
555356b03f Internal cleanup
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
marianomartin
b5533eae6b Swallow exception setting convex path in MaterialShapeDrawable for pre releases of Q
PiperOrigin-RevId: 306874530
2020-04-17 15:17:21 -04:00
marianomartin
841fae9258 Fix javadocs issues in Shape package
PiperOrigin-RevId: 300547341
2020-03-13 10:57:59 -04:00
marianomartin
8e8d20c94f Fix interpolation for MSD round rects
PiperOrigin-RevId: 296281750
2020-02-20 16:35:56 -05:00
cketcham
b5c3fecacc Add warning to ShapePath when an operation is being used in a situation where a compatibility shadow would normally be drawn
PiperOrigin-RevId: 295847026
2020-02-19 10:52:22 -05:00
Material Design Team
5a396edbb6 Always use padding in drawable state so that it can survive newDrawable()
Previously padding was set to both drawableState.padding and this.padding, but only retrieved from this.padding, which results in lost padding after newDrawable() and makes drawableState.padding useless.

PiperOrigin-RevId: 293878104
2020-02-10 09:59:00 -05:00
cketcham
6e340c49d4 Fix BottomAppBarTopEdgeTreatment bug caused by large negative vertical offset
While some small negative values for vertical offset do work, this use case is currently not supported. Most negative values result in the cutout being drawn incorrectly. This also adds a new exception to help clarify the crash in the future.

Resolves https://github.com/material-components/material-components-android/issues/906

PiperOrigin-RevId: 292148159
2020-01-29 16:15:04 -05:00
marianomartin
bb1e9e47a4 Enable non convex shadows on Q
PiperOrigin-RevId: 281750600
2019-11-22 21:24:52 +00:00
cketcham
8ed1484690 Update MaterialShapeDrawable to handle overlapping edge and corners
PiperOrigin-RevId: 281498365
2019-11-20 14:39:06 -05:00
marianomartin
7eb1af5f8e Support disabling bitmap drawing in MaterialShapeDrawable
Creating an additional bitmap affects performance and there are instances where it's not necessary.

Add the option to disable that.

PiperOrigin-RevId: 280434620
2019-11-15 15:09:41 -05:00
dniz
ab54c23e9b Fix MaterialShapeDrawable stroke corner bug
PiperOrigin-RevId: 272977992
2019-10-04 20:09:24 -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
ldjesper
5afdf00f80 Remove deprecated method not present in stable MaterialShapeDrawable#getStrokeTint
PiperOrigin-RevId: 272741709
2019-10-03 19:40:24 -04:00
marianomartin
4f8bc435c4 Fix binary compatibility issues with MaterialShapeDrawable
These methods existed in 1.0.0 so they can't be removed.

PiperOrigin-RevId: 272665301
2019-10-03 11:44:57 -04:00
afohrman
5592c1b74e Optimize MaterialShapeDrawable's RectF usages.
PiperOrigin-RevId: 271588528
2019-09-27 14:06:30 -04:00
cketcham
5c384c3804 Add space to the bitmap for drawing shadows to prevent clipping
PiperOrigin-RevId: 268449384
2019-09-12 14:04:45 -04:00