94 Commits

Author SHA1 Message Date
Nobody
24a0ffbd03 Annotate various Delegate protocols as NS_SWIFT_UI_ACTOR
PiperOrigin-RevId: 708413470
2024-12-20 13:33:55 -08:00
Nobody
8bb590a78d Add explicit imports for CoreGraphics in files which use it.
PiperOrigin-RevId: 642400931
2024-06-11 14:52:59 -07:00
Nobody
481f11fd35 Internal change
PiperOrigin-RevId: 559840945
2023-08-24 12:53:08 -07:00
Randall Li
1c4e1f8708 [MDCInk] Change deprecation warning to point at guidance and added "🕘 Schedule time to migrate" message.
PiperOrigin-RevId: 491902432
2022-11-30 06:49:44 -08:00
Nobody
a18d1afbc0 Fixed up imports for Ripple
PiperOrigin-RevId: 478024434
2022-09-30 10:26:28 -07:00
Jeff Verkoeyen
b2bbd50350 Mark all To Be Deprecated APIs as Deprecated.
PiperOrigin-RevId: 460478209
2022-07-12 09:13:52 -07:00
Cody Weaver
62e4f2529e [Ripple] Annotate symbols as to be deprecated
PiperOrigin-RevId: 457767173
2022-06-28 10:39:05 -07:00
Jeff Verkoeyen
f6f19c41f8 Remove all pre-iOS 12 logic.
PiperOrigin-RevId: 401224908
2021-10-06 06:17:26 -07:00
Jeff Verkoeyen
21d89d88ec Remove all pre-iOS 12 logic.
PiperOrigin-RevId: 401009899
2021-10-05 09:54:43 -07:00
Jeff Verkoeyen
c34de39e30 Internal change.
PiperOrigin-RevId: 397316843
2021-09-17 07:45:01 -07:00
Randall Li
502bc5d910 Ran a Swift formatter
PiperOrigin-RevId: 395947664
2021-09-10 09:48:14 -07:00
Jeff Verkoeyen
ec44b12ee9 Internal change
PiperOrigin-RevId: 394725753
2021-09-03 11:44:01 -07:00
Jeff Verkoeyen
b3fa42005b Optimizing imports
PiperOrigin-RevId: 356966407
2021-02-11 07:12:37 -08:00
Yarden Eitan
73fb0330a6 [Ripple] Declare parameter type NSArray in the Ripple implementation.
PiperOrigin-RevId: 353951161
2021-01-26 14:32:12 -08:00
Jeff Verkoeyen
eb82984224 Internal change
PiperOrigin-RevId: 331764642
2020-09-15 07:31:56 -07:00
Jeff Verkoeyen
d7ff705337 Drop support for iOS 9.
PiperOrigin-RevId: 326015653
2020-08-11 07:21:40 -07:00
Andrew Overton
07c46757cc Replace material.io API doc links with links to the relevant header f…
This PR replaces API links containing "/api-docs/" with links to suitable header files in GitHub because the site previously linked to is being taken down and replaced with something that won't handle API docs.

Closes https://github.com/material-components/material-components-ios/pull/10045

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/10045 from andrewoverton:replace-mio-api-docs-with-github-links 0d6e56cc11d0c147366a4f6cde829d8b51567ecc
PiperOrigin-RevId: 323424362
2020-07-27 13:09:23 -07:00
Yarden Eitan
a68702e3a4 [Ripple] Add delegate method to RippleTouchController existing in InkTouchController.
This delegate method allows clients to have one ripple touch controller control multiple ripple views. Also gives them more flexibility on the creation and reusing of ripple views.

PiperOrigin-RevId: 317614179
2020-06-22 02:18:07 -07:00
Yarden Eitan
5462d27375 [Ripple] Add a convenience API for finding the ripple view in the view's subviews.
If a ripple view is not found, a new instance of a ripple view is created.

PiperOrigin-RevId: 317610319
2020-06-22 01:40:27 -07:00
Yarden Eitan
3817d45231 [Ripple] Move the radius calculation into its own method.
PiperOrigin-RevId: 317056971
2020-06-18 01:41:52 -07:00
Yarden Eitan
f425b8995b [Ripple] Update alpha value of Ripple to 0.12 instead of 0.16
PiperOrigin-RevId: 316850177
2020-06-17 02:23:19 -07:00
Yarden Eitan
ef53fab9ca [Ripple] Align ripple starting size with spec guidance.
PiperOrigin-RevId: 316633026
2020-06-16 01:03:50 -07:00
Andrew Overton
0a36a3a12b [MDC-iOS] Fix broken links
This CL fixes some longstanding and some newly broken links.

PiperOrigin-RevId: 311351416
2020-05-13 10:09:44 -07:00
Wenyu Zhang
a3381717f7
Fix the bazel BUILD files and snapshot that were restored unintentionally.(#9983) 2020-04-29 11:00:00 -04:00
Randall Li
0100cfe414 [MDC-iOS/BottomSheet] Fix dismissOnDraggingDownSheet behavior
The bottom sheet incorrectly allowed the sheet to be drag dismissed when `dismissOnDraggingDownSheet` was set to NO.

This change permits the gesture to dismiss to begin but prevents it from actually closing the sheet.

https://github.com/material-components/material-components-ios/issues/9723

Closes https://github.com/material-components/material-components-ios/pull/9885

PiperOrigin-RevId: 307802500
2020-04-22 06:21:26 -07:00
Jeff Verkoeyen
8abbb099a9 Delete all bazel support.
We no longer support bazel.

This PR deletes everything related to bazel support from our repo.

Closes https://github.com/material-components/material-components-ios/pull/9968

PiperOrigin-RevId: 306227127
2020-04-13 07:13:47 -07:00
Yarden Eitan
1e969f0e46 [Ripple] Add a respondsToSelector check to resolve crashes of unrecognized selector.
Adding a respondsToSelector check for "performAsCurrentTraitCollection" as there are cases where iOS 13+ devices do not recognize that API despite it being an available API since iOS 13.

Tested this with iOS 13+ and iOS 11.2 simulators to see it is working as expected.

PiperOrigin-RevId: 306215948
2020-04-13 09:28:02 -04:00
Bryan Oltman
d0f7fe4ab3 [Ripple] Move protocol definitions into separate header files
PiperOrigin-RevId: 302059112
2020-03-20 10:57:26 -07:00
Eric Lee
608694e260 [Material][Availability] Migrates Ripple to MDCAvailability.
PiperOrigin-RevId: 301671613
2020-03-18 14:42:27 -07:00
Bryan Oltman
395ad9b395
[Catalog] Remove traitCollection overrides from examples. (#9851)
It's not clear to me why these existed – I can't see any visual difference before vs. after on an iPad in portrait orientation.

Fixes #7683
2020-03-05 17:16:59 -05:00
featherless
b7cf0de915
[bazel] Remove all unused swift_library load statements. (#9369)
Found by searching for all references to `\bswift_library` and removing load statements from files that only returned one result.

Clean up as part of https://github.com/material-components/material-components-ios/issues/5491
2020-01-02 11:01:31 -05:00
featherless
9d60c22e29
[Ripple] Add usesSuperviewShadowLayerAsMask flag. (#8822)
Follow-up to https://github.com/material-components/material-components-ios/pull/8808

Part of https://github.com/material-components/material-components-ios/issues/6913

From the docs:

tl;dr: If you are adding ripples to views with custom `layer.shadowPath` values, please disable
`usesSuperviewShadowLayerAsMask` and assign an explicit layer mask to the ripple view if needed
instead. usesSuperviewShadowLayerAsMask will eventually be disabled by default and then deleted.

MDCRippleView currently implements a convenience behavior that will inherit its parent view's
`layer.shadowPath` as the mask of the ripple view itself. This works for the general case where the
ripple view's frame equals the bounds of its super view, but behaves unexpectedly for any other
frame of the ripple view.

Due to the brittleness of this behavior, a new migration property, `usesSuperviewShadowLayerAsMask`,
has been added that will allow you to disable this behavior in favor of a more explicit
determination of the ripple's layer mask.

Example usage:

<!--<div class="material-code-render" markdown="1">-->
#### Swift
```swift
// During initialization:
rippleView.usesSuperviewShadowLayerAsMask = false
// Simple example of applying a mask to the ripple view using the ripple view's bounds:
let rippleViewMask = CAShapeLayer()
rippleViewMask.path = UIBezierPath(rect: rippleView.bounds).cgPath
rippleView.layer.mask = rippleViewMask
```
#### Objective-C
```objc
// During initialization:
rippleView.usesSuperviewShadowLayerAsMask = NO;
// Simple example of applying a mask to the ripple view using the ripple view's bounds:
CAShapeLayer *rippleViewMask = [[CAShapeLayer alloc] init];
rippleViewMask.path = [UIBezierPath bezierPathWithRect:rippleView.bounds].CGPath;
rippleView.layer.mask = rippleViewMask;
```
<!--</div>-->
2019-11-27 16:07:09 -05:00
Yarden Eitan
b18c748123 make card with ripple example a5able (#8929)
Voice Over and Switch Control users can activate the Card to show Ripple.
The card has an accessibility label and an accessibility trait to indicate that it is interactive.

Closes #8914
2019-11-15 12:11:43 -05:00
Yarden Eitan
83d465eedc
[Ripple] Ripple typical example now can be used with Voice Over (#8924)
All views in example are accessible with Voice Over and can be activated.
All views have a relevant accessibility label and the appropriate traits.

Closes #8913
2019-11-15 11:45:44 -05:00
featherless
9123dc603e
[Ripple] Add tests demonstrating unexpected layer.mask behavior. (#8808)
These tests demonstrate how a ripple view added as a subview can end up with an incorrect layer mask if the ripple view's frame does not match the bounds of the parent view and the parent view's layer has a shadowPath. All of the tests intentionally pass, with the final test demonstrating the incorrect behavior.

In a follow-up change, I will be adding a behavioral flag to turn off this unexpected behavior in favor of a more explicit approach to configuring the ripple view's layer mask.

Part of https://github.com/material-components/material-components-ios/issues/6913
2019-11-14 13:29:01 -05:00
Michael Schneider
3b4c9d170a [Ripple] Improve MDCRippleTouchController (#8631)
Changes:
- Create new initializer that allows to defer adding `MDCRippleView` to the a provided view
- Add `MDCRippleView` on first touch down if YES was passed in as deferred parameter
- Lazy getter for `rippleView`
- As `rippleView` property is not supposed to be overwritten always use `_rippleView` instance variable within touch controller
- Cache all delegate methods for faster lookup if a delegate responds to a selector

Determined improvements:
- Reduce memory overhead and safes a couple of cycles due to creation of `MDCRippleView` lazily
- Reduce overhead for adding / removing `MDCRippleView` to view hierarchies
- Reduce overhead of having the `MDCRippleView` that most of the time is hidden within view hierarchies as it will only get's added and immediately removed if needed
2019-11-04 15:26:45 -05:00
Randall Li
1eaff651f9 Reran ./scripts/generate_all_readmes (#8557)
Moved changes from https://github.com/material-components/material-components-ios/pull/7360 to the source Readme file

Also some readme files got a minor addition to add `./` in their generation comment
2019-10-11 10:44:43 -04:00
Michael Schneider
f7ac93819d [Ripple] Add callbacks for MDCRippleView and MDCRippleLayer NO is passed in for animated parameter (#8505)
Currently in certain methods within MDCRippleView and MDCRippleLayer that are taking in an animated and a callback parameter if NO is passed in for the animated parameter the callback will not be called. This can get to problems if the consumer passes in different animated arguments based on some state and expects the callback is called.
2019-09-30 12:24:24 -04:00
Yarden Eitan
a70588207d
[Ripple] Add the layer masking in layoutSublayers if there are sublayers present. (#8359)
This call is needed in cases where the ripple is added and stays, but then a re-layout occurs. This was found to be needed in internal testing, and seems to resolve those issues.
2019-08-22 15:55:23 -04:00
Yarden Eitan
00d6c02d7d
[Ripple] Performance Improvements on initialization (#8354)
To improve performance when Ripple is being initialized, I have tried to look at what things are not needed, or can be delayed to a later stage, like the ripple invocation and not init.

self.backgroundColor is initially nil, which defaults to clearColor, hence we can remove that setting.

self.layer.maskToBounds = YES is redundant because maskToBounds is dependent on the rippleStyle which is set anyway in the method updateRippleStyle that is invoked.

updateRippleStyle does not need to be called in every layout of the view/subviews, because the masking of the ripple based on the shadowPath (if exists) is only important if there is an actual ripple layer being created, otherwise it is masking the "empty case"

The initialization of the maskLayer and setting the delegate only needs to be set when the maskLayer is actually used, so it is then set up if needed only if the ripple is bounded and there is a shadowPath, and the maskLayer is going to be used.

I've run instrumentation of Counters using an iPhone 5c 8GB which uses an A6 chip.
During instrumentation on high frequency, I had gathered that updateRippleStyle takes 0.1ms, and setting backgroundColor 0.2ms every time.
2019-08-21 17:11:46 -04:00
Galia Kaufman
87cc5aa535
[Ripple] Fixing selection state in Ripple (#7609)
Fixing the selection state in Ripple, ensuring the ripple layer is added only once when a components is tapped/selected multiple times.
2019-08-16 10:52:30 -04:00
Robert Moore
48d3d591bf [Ripple] Use Starlark macros. (#8183)
Updates the BUILD file to use more Starlark macros. Also drops the `includes`
update from the private target and fixes the imports in unit tests.

Part of #8150
2019-08-02 08:48:41 -07:00
Cody Weaver
4be077a61b
[Ink, Ripple] Use static default colors (#8146)
Instead of reallocating new colors every time a default is required, using a static color can reduce memory use and allocations.

Impact: “memory watermark would be dropped in terms of KB. Memory fragmentation, cache performance, malloc contention will also be reduced slightly.”

Closes #8141
PiperOrigin-RevId: 260767570
2019-07-31 10:25:03 -07:00
Robert Moore
66435f1b68
[Color] Create umbrella header. (#8091)
All components should have a top-level umbrella header for their includes.
This allows easier refactoring of classes and files within the component.
Creating an umbrella for Color and using it outside the component.

Part of #8086
2019-07-25 15:41:26 -04:00
Cody Weaver
8f6338e0b2
[Ripple] Add traitCollectionDidChange block (#8062)
Adds a traitCollectionDidChangeBlock to MDCRippleView and its subclass, called when its trait collection changes.

Closes #8043
2019-07-23 22:18:52 -07:00
Wenyu Zhang
013f3a890e
[Ripple] Fix active ripple layer not using active ripple color. (#8059)
Follow-up of 5cdb7f95f7
2019-07-23 19:03:39 -04:00
Robert Moore
ff2d8a4e7f
[*] Drop iOS 9 guards for Swift. (#8001)
Drops some iOS 9 checks in Swift code.

Part of #2651
2019-07-23 12:23:28 -04:00
Yarden Eitan
5cdb7f95f7
[Ripple] Add dynamic color support for ripple. (#7968)
Adds dynamic color support for Ripple and tests using snapshot tests that the dark mode color is correctly applied.

Closes #7867

(this is an un-revert of dfbecc6547 now that https://github.com/material-components/material-components-ios/pull/7949 landed)
2019-07-19 07:50:52 -07:00
Yarden Eitan
8a0308f649
[Ripple] Turn activeRippleColor into a property (#7949)
Because activeRippleColor was not a property prior, it had no way to keep its storage. Therefore, when setting it in layoutSubviews, we may not be setting the current value but rather an older value. This turns it into a property with storage.

Quoting issue found by @wenyuzhang666 : 
"rippleColor was overwriting the color value of activeRippleLayer because there was no way to store the real active ripple color."
2019-07-18 19:37:41 -07:00
Wenyu Zhang
dfbecc6547 Revert "[Ripple] Add dynamic color support for ripple. (#7877)"
This reverts commit edb5f11af1a830e004fdffef536c4b6306b4eb4b.
2019-07-17 12:36:38 -04:00