32 Commits

Author SHA1 Message Date
Nobody
266bcd2e07 There are two separate systems trying to manage touch events on the MDCButton. First, the button itself uses its standard UIControl event infrastructure to trigger ink ripples. Second, an external MDCInkTouchController attaches its own gesture recognizers to do the same thing. This creates a conflict where both systems respond to the same touch, causing two ink animations to be created and displayed simultaneously, which results in incorrect visual feedback.
PiperOrigin-RevId: 770704081
2025-06-12 10:10:12 -07:00
Nobody
d304ac1651 There are two separate systems trying to manage touch events on the MDCButton. First, the button itself uses its standard UIControl event infrastructure to trigger ink ripples. Second, an external MDCInkTouchController attaches its own gesture recognizers to do the same thing. This creates a conflict where both systems respond to the same touch, causing two ink animations to be created and displayed simultaneously, which results...
PiperOrigin-RevId: 769464891
2025-06-09 23:15:18 -07:00
Nobody
b2d48fceca There are two separate systems trying to manage touch events on the MDCButton. First, the button itself uses its standard UIControl event infrastructure to trigger ink ripples. Second, an external MDCInkTouchController attaches its own gesture recognizers to do the same thing. This creates a conflict where both systems respond to the same touch, causing two ink animations to be created and displayed simultaneously, which results in incorrect visual feedback.
PiperOrigin-RevId: 769406060
2025-06-09 20:04:56 -07:00
Nobody
dc3dd5d5a0 Add explicit imports for CoreGraphics in files which use it.
PiperOrigin-RevId: 642291735
2024-06-11 09:16:51 -07:00
Nobody
36ac243939 Fixed up imports for Ink
PiperOrigin-RevId: 482294231
2022-10-19 13:51:22 -07:00
Jeff Verkoeyen
39c20e15f8 Optimizing imports
PiperOrigin-RevId: 356967514
2021-02-11 07:17:45 -08:00
Andrew Overton
5862e5b7b6
Conditionally maskToBounds on MDCInkView layer (a MDCLegacyInkLayer) when usesLegacyInkRipple is set to NO (#9818)
This change makes it so that the `masksToBounds` property on an MDCButton's MDCInkView's MDCLegacyInkLayer is set according to whether `inkStyle` is `.unbounded` or not, regardless of whether `usesLegacyInkRipple` is set on the MDCButton.

An MDCInkView's layer is always an MDCLegacyInkLayer, even when `usesLegacyInkRipple` is set to NO. In this scenario it acts as the MDCInkView's layer, even if it's not acting as the thing that triggers the ink/ripple animation.

There was a very similar bug to this recently that https://github.com/material-components/material-components-ios/pull/9254 was intended to address. That PR addressed it in the Catalog, as you can see in the before and after gifs in the PR description, but a different client was still experiencing the issue. I built the second client's app to test this PR and it seems to fix it for them.

I wonder if we should try to get rid of MDCLegacyInkLayer, or if we should bypass that and just get rid of MDCInkView entirely, now that we have MDCRippleView.

Closes #9762.
2020-03-02 01:21:50 -05:00
Bryan Oltman
f168dd2806
[Material][Availability] Migrates Ink to MDCAvailability. (#9741)
[Material][Availability] Migrates Ink to MDCAvailability.
2020-02-14 12:52:23 -05:00
Yarden Eitan
60e467f654
[Ink] Update ink color to be null resettable. (#9253)
This allows the API to handle assigning inkColor to nil, which is common practice among properties on UI classes that expose color (see UIKit - i.e. UIView.tintColor, UILabel.textColor, etc)

b/144862050
2019-12-20 15:38:07 -05:00
Robert Moore
77c5ebbe7e
[Ink] Use Starlark macros. (#8172)
Use more Starlark macros in the BUILD file. This makes it easier for releasing
each week. Also removed the `includes` requirement by making testing imports
relative.

Part of #8150
2019-08-02 10:05:18 -04: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
b19962a747
[Ink] Add traitCollectionDidChange block (#8064)
Adds a traitCollectionDidChangeBlock to MDCInkView, called when its trait collection changes.

Closes #8048
2019-07-23 22:19:14 -07:00
Yarden Eitan
6eb335a0f9
[Ink] Dynamic color support (#7974)
Adding dynamic color support to the Ink component.

Ink comprises of multiple MDCInkLayer sublayer instances, and they all should update their colors when the style of the system turns to Dark.

Closes #7871
2019-07-22 10:14:31 -04:00
Michael Schneider
c00921720b [Ink] Add animation delegate callbacks for MDCLegacyInkLayer (#7339)
Add animation delegate callbacks for MDCLegacyInkLayer

We would like to observer the start and stop animations of an MDCInkTouchController by setting the animationDelegate of the MDCInkTouchController's MDCInkView. If [MDCInkView usesLegacyInkRipple] == YES the MDCLegacyInkLayer does not call any animation callbacks right now.
2019-05-09 16:18:01 +03:00
Robert Moore
aad941178a
[Ink] Add basic snapshot tests. (#6920)
Add snapshot tests for new Ink using bounded and unbounded styles.

Closes #6814
2019-03-18 08:06:33 -04:00
Robert Moore
800188a649
{clang-format} Format the components. (#6347)
This is a follow-up to https://github.com/material-components/material-components-ios/pull/6027

```
find components \( -name "*.h" -or -name "*.m" \) | xargs clang-format -i
```
2019-01-23 11:08:43 -05:00
Robert Moore
4c6aedc708
[Ink] Reduce flakiness of layer timing test. (#6338)
The scaled animation tests were very sensitive to test environment
delays. By reducing the speed of the layer, the tests can be less
sensitive to test-related delays but would still calculate the scaled
effect accurately.
2019-01-15 21:45:21 -05:00
featherless
d9c801e773
[all]! Remove remaining property coding. (#5792)
Our components should not implement or support property coding unless explicitly required. We generally removed support for this type of behavior early in 2018.

Many components were still implementing coding support.

Property coding has been removed from every component.

This change also removes `NS_DESIGNATED_INITIALIZER` from all initWithCoder APIs.
2018-11-20 09:06:46 -05:00
Robert Moore
03f3351ad5
Global replace of single-precision floats with CGFloat casts. (#5718)
Replacing all non-integral, single-precision floating point literals with double-precision values explicitly cast to CGFloat.  For example, `0.1f` should become `(CGFloat)0.1`.

Regex used:
```
([0-9]*\.)([0-9]*?)([1-9]+)([0-9]*?)[fF]
```

PiperOrigin-RevId: 220683126
2018-11-12 10:50:01 -05:00
featherless
2181084272
[automated] Standardize our open source license stanza to what Xcode generates. (#4985)
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.

This was an automated change generated by running a find-and-replace regular expression:

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at

 http://www\.apache\.org/licenses/LICENSE-2\.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at

http://www\.apache\.org/licenses/LICENSE-2\.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at
 http://www\.apache\.org/licenses/LICENSE-2\.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
2018-08-31 12:13:07 -04:00
featherless
fc1e82cd17
[Ink] Remove encoding/decoding behavior for custom properties (#4555)
Closes https://github.com/material-components/material-components-ios/issues/3940
2018-07-25 09:12:46 -04:00
Randall Li
b1c3a030eb
[Ink] Increase range of accuracy in test to +/-.1. (#3392)
https://github.com/material-components/material-components-ios/issues/3173
https://www.pivotaltracker.com/story/show/156804989
2018-04-18 16:26:52 -04:00
Yarden Eitan
b5e2935b53
[Ink] Fix flaky test (#3290)
* flaky ink test

* fix ink test

* update
2018-04-09 17:25:09 +03:00
Robert Moore
a25ee2d848
[Ink] New bounded ink should ignore maxRippleRadius property (#2956)
* [Ink] New bounded ink should ignore maxRippleRadius property

For the new Ink, when the view uses `.bounded` for `inkStyle`, it should
ignore the `maxRippleRadius` property. No changes should be made to legacy Ink
since we're migrating away from it and we don't want to make unnecessary
changes to existing clients.

Closes #329
2018-02-27 15:39:12 -05:00
Robert Moore
61445a677a [Ink] Fix ink animation timing in time-scaled layers (#2884)
When a CALayer has a speed other than 1.0 (or other manipulations to its local
time coordinate space), animations need to convert beginTime values into this
time space.  For a beginOffset of zero, the layer automatically sets the
beginTime to the current active time of the layer. For non-zero values
(delayed animations), the conversion has to be performed by the caller.

This article has a pretty good explanation:
https://coveller.com/2016/05/core_animation_timing/

Closes internal issue b/72403469
2018-01-31 16:11:45 -05:00
Robert Moore
85647affe8
[Ink] Add NSCoding support to MDCInkView/Layer (#2777)
Both MDCInkLayer (and MDCLegacyInkLayer) and MDCInkView should support
NSCoding methods since their superclasses conform to an NSCoding (or
NSSecureCoding) protocol.

Closes #2772
2018-01-02 20:25:46 -05:00
Junius Gunaratne
a27d49408a
[Ink] Retrofit new ink layer with updated animation into existing ink API (#2488)
* Add updated ink flag

* Add completion block delegate methods

* Rename existing ink to legacy ink

* Update example with legacy ink as second ink view

* Update comment formatting

* Update formatting

* Update ink unit tests

* Update ink unit tests

* Import UIKit for UIColor support

* Add dependency to Material Math

* Add Material Math dependency

* Use CABasicAnimations where possible

* Add support for maxRippleRadius

* Minor refactoring for timing functions

* Remove unused mark

* Add ink description to comments

* Minor formatting fix

* Nullability updates and clarification comments

* Remove email in comments.

* Add nullability

* Add nullability

* Use year when file was created

* Add float

* Update constant names

* Update formatting

* Update year for legal reasons

* Clarify comment about use of usesCustomInkCenter

* Update cancelAllAnimationsAnimated to stop all active ink ripples

* Remove use of ink layers array and access sublayers directly

* Check layer class in cancelAllAnimationsAnimated

* Use bounds rather than frame in layoutSubviews

* Setting radii in setNeedsLayout
2017-11-28 09:59:25 -05:00
featherless
cc7033f857
[Ink] Add BUILD file. (#2330)
* [Ink] Add BUILD file.

* Fix test imports.

* Fix tests.
2017-11-02 14:44:08 -04:00
Robert Moore
9e417817cb [Ink] Reset ink without animation calls delegate (#1654)
Resetting the ink without animation will now call the `animationDelegate`
property to ensure that MDCInkLayer can clean-up its internal state and
remove the ripple objects from its internal arrays.

Closes #1653
2017-07-18 09:53:12 -04:00
Robert Moore
72657d5f8d [Ink] Ink reset passes animation value to ripples (#1652)
When the MDCInkLayer resets ink, it will now pass the `animated` parameter to the ripple sublayers. This fixes a bug where resetting the ink without animation would cause animations to be executed.

Closes #1651
2017-07-17 22:10:14 -04:00
Jeff Verkoeyen
d0092f692a Testing by convention.
Summary:
Similar to Catalog by convention, Testing by convention allows us to generate a fully-working unit test suite using CocoaPods wildcards.

The testing convention is to place unit test source files in a `tests/unit` folder within each component.

A complete "component by convention" now looks like so:

    component/
      examples/
        SomeExample.m
      src/
        ...
      tests/
        unit/
          SomeTest.m

This convention makes it trivially easy to run all tests in our project & generate coverage information. Here are our coverage results:

{F439}

Resolves https://github.com/google/material-components-ios/issues/106.

Reviewers: cjcox, ajsecord, #mdc_ios_owners

Reviewed By: ajsecord, #mdc_ios_owners

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D158
2016-03-01 12:35:19 -05:00
Adrian Secord
92eb3e8fed Adds Ink.
Summary: Adds Ink component. Unit tests and user documentation still to come.

Test Plan: Unit tests, example code.

Reviewers: featherless, #material_components_ios_owners, randallli

Reviewed By: featherless, #material_components_ios_owners, randallli

Projects: #material_components_ios_owners

Differential Revision: http://codereview.cc/D11
2015-12-07 16:41:10 -05:00