40 Commits

Author SHA1 Message Date
Randall Li
502bc5d910 Ran a Swift formatter
PiperOrigin-RevId: 395947664
2021-09-10 09:48:14 -07:00
Jeff Verkoeyen
1c14fb5e7b Internal change.
PiperOrigin-RevId: 363294413
2021-03-16 16:23:36 -07:00
Jeff Verkoeyen
29803522c6 Optimizing imports
PiperOrigin-RevId: 357185525
2021-02-12 07:27:05 -08:00
Bryan Oltman
da4b8f7c7f Fix mdc_elevationDidChangeBlock block parameter types for Xcode 12
PiperOrigin-RevId: 331843566
2020-09-15 13:39:15 -07:00
Bryan Oltman
f44e5d679d
[Cards] Delete Themer classes (#9197)
Deletes the deprecated Card shape and color themers. These files were removed from .podspec and BUILD files in https://github.com/material-components/material-components-ios/pull/9141

Fixes #9098
Fixes #9097
Fixes #9096
Fixes #9095
2019-12-09 12:41:31 -05:00
Bryan Oltman
4e41462438
[Cards] Migrate MDCCardsColorThemer to theming extensions (#9141)
Migrating Cards Themer code to theming extensions as part of the deprecation and deletion of `MDCCardsColorThemer`.

Part of #9098, #9097, #9096, and #9095
2019-12-06 10:24:00 -05:00
Yarden Eitan
130289a6d4
[Cards] CardCell Supports MaterialElevation. (#8079)
Adds conformance to MDCElevatable and MDCElevationOverriding for card cell.

Part of #8022
2019-07-24 17:18:25 -04:00
Yarden Eitan
f2b12a10ed
[Cards] MDCCard conforms to MDCElevation and MDCElevationOverride (#8054)
Adds support for the MDCElevation and MDCElevationOverride protocols.
2019-07-24 16:13:32 -04:00
Cody Weaver
bda9d92cac
[Cards] Add traitCollectionDidChange block to MDCCardCollectionCell (#8007)
Adds a traitCollectionDidChangeBlock to MDCCardCollectionCell, called when its trait collection changes.
2019-07-23 11:29:05 -07:00
Cody Weaver
acd2827f2b
[Cards] Add traitCollectionDidChange block to MDCCard (#8006)
Adds a traitCollectionDidChangeBlock to MDCCard, called when its trait collection changes.

Related to #7953
2019-07-23 09:44:44 -07:00
Wenyu Zhang
9aa1d72bc7
[Cards] Move Cards theming extension to ready. (#7178)
closes https://github.com/material-components/material-components-ios/issues/7165
2019-04-19 11:36:20 -04:00
Yarden Eitan
5bed3961e6
[ContainerScheme] Graduate ContainerScheme to ready. (#7170)
This PR graduates ContainerScheme to ready.

This includes updating the podspecs, podfile, all the import statements related to ContainerScheme, updating .kokoro rewrite rules, and finally the readme to not have ContainerScheme regarded to as being in beta.

Ran locally kokoro with -b bazel successfully.

Resolves #6732
2019-04-18 09:25:02 -04:00
Andrew Overton
b38372192f
Update to Swift 4.2 (#7166)
This PR updates the Swift version to 4.2.

Partially resolves #6874.
2019-04-17 16:59:02 -04:00
Robert Moore
46ff9c3173
{kokoro} Fix develop (#6575)
Fixes the `develop` branch by:
* Pinning kokoro to CocoaPods 1.5.3
* Restoring missing imports causing bazel builds to fail.

Closes #6574
Related to #6356
2019-02-08 12:24:55 -05:00
Ian Gordon
e61e89a592 Fix podspec validation issues 2019-02-07 16:31:09 -05:00
Yarden Eitan
eb98acd604
[Cards] Fix elevation values for Highlighted and Selected for Cards in themer. (#6485)
Our current highlighted and selected elevation values for cards and card cells should be 1 point rather than 4.

closes: b/123236251 and b/123434660
2019-01-28 13:38:32 -05: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
Andrew Overton
056e4701f0
Make pod install work on Cocoapods 1.6.0.beta.2 (#5966)
# Original PR description:

On Cocoapods version 1.6.0 beta 2 we get an error on pod install because certain test targets don't have any sources to compile. This PR adds some skeleton unit test source files to get that working. Is everyone okay with these (for now) basically empty files?

Closes #5825

# FInal PR description:

The original aim of this PR was to get the project working with the Cocoapods 1.6 beta.

I initially didn't know where to begin getting it to work, so I used `pod lib lint` to get answers. `pod lib lint` had issues with the following things:

1. test_specs not having any sources to compile. This was due to our pattern of putting unit test test_specs inside of parent test_specs that didn't have anything else.

To address this I did two things. First, I moved away from the nested test_spec pattern. Now, instead of "Subspec/tests/unit_tests" it's "Subspec/UnitTests". This is more in line with the style Cocoapods uses [here](http://blog.cocoapods.org/CocoaPods-1.6.0-beta/). Secondly, I added some dummy files for things like UIMetrics and MaterialMath.

2. Importing headers across modules without using framework style imports.

I added framework style imports. This required some additional rewrite rules in the kokoro script.

3. Dependencies across subspecs being implicit.

I made them explicit by adding dependency statements to the podspecs where needed. 

`pod lib lint` didn't take issue with this, but I also saw that `MaterialComponents` was depending on `MaterialComponentsBeta` in various places. For example, all the theming extensions were in beta, but the tests for them weren't. I moved the tests to test_specs within the beta extensions. This required some directory structure changes. These changes then required some BUILD file changes. Making BUILD file changes made me realize that some swift unit tests weren't being accounted for by bazel. I took care of this too.

This PR also fixes some swift debugging stuff--"po" statements that weren't working before now do. I didn't rigorously verify this, but I also think this PR will lead to faster clean build times? It kinda seemed like it was while I was working on it.
2019-01-11 10:08:05 -05:00
rami-a
e25d7c88ca
[Cards] Fix shadow elevation values for outlined cards (#6050)
### Context
After adding snapshot tests for Cards, we noticed that the outlined variant had elevation when it was not supposed to.

### The problem
Cards shadow elevation values were not correct

### The fix
Update the values, update the unit tests, and update the snapshot goldens.

### Related bugs
Closes #6045
2018-12-19 14:11:15 -05:00
rami-a
58db37d09d
[Cards] Cards theming extension + snapshots: Re-revert with fix (#6049)
This is a re-revert of #6048 that includes a missing import statement that was causing bazel to fail.

This re-reverts #6033 and #6041 

Closes #6030 
Closes #5493 

The missing import is in `EditReorderCollectionViewController.swift` for `MaterialContainerScheme`
2018-12-18 16:24:54 -05:00
Robert Moore
63a0435070
[Cards] Revert cards theming exstension (#6048)
Cherry-picks the Theming extension revert from the `release-candidate` branch and reverts the Snapshot testing changes that used the Theming extensions.

Reopens #6030 
Reopens #5493
2018-12-18 15:25:01 -05:00
rami-a
fdaf872c60
[Cards] Add theming extension for Cards component (#6033)
### Context
As the team pivots to using theming within extensions we continue this work with Cards.

### The problem
We currently do not theme cards using a theming extension

### The fix
* Add theming extension for MDCCard and MDCCardCollectionCell
* Write unit tests for new extension
* Update existing examples to utilize the extension

### Bug
Closes #6030 

### Screenshots
Everything should be exactly the same visually.

| Before | After |
| - | - |
|![simulator screen shot - iphone 7 - 2018-12-17 at 13 59 52](https://user-images.githubusercontent.com/2364772/50110092-65f39680-0207-11e9-9a32-02161f7b2df4.png)|![simulator screen shot - iphone 7 - 2018-12-17 at 14 01 51](https://user-images.githubusercontent.com/2364772/50110130-7dcb1a80-0207-11e9-83d9-53bc98ad374b.png)|
2018-12-18 09:38:37 -05:00
Robert Moore
74a27253e8
Global replace of integral single-precision literals with integer literals. (#5709)
Global replace of integral single-precision literals with integer literals.

Regular expression used:
```perl
/[^\w]([0-9]+)\.[0]*[fF]/$1/
```
2018-11-08 14:02:04 -05:00
Robert Moore
675235ed05
{Tests} Deallocate test objects at the end of tests. (#5397)
Deallocating many of the properties created for each unit test. Since all
XCTestCase instances survive until the end of the test suite, any properties
created for a test will be preserved as well. This frees up around 3.7 MB
(~6%) of memory from the entire test suite, as measured on my desktop.

|Before|After|
|----|----|
|![test-objcs-before](https://user-images.githubusercontent.com/1753199/46813473-c3b9bd00-cd44-11e8-990c-28dff4ab5ad2.png)|![test-objcs-after](https://user-images.githubusercontent.com/1753199/46813481-c7e5da80-cd44-11e8-90e4-2e6d532ebbfb.png)|

See also: https://qualitycoding.org/xctestcase-teardown/

Closes #5395
2018-10-12 08:33:58 -04:00
Yarden Eitan
bfc674a631
[Shape]! Terminology updates to the Shape Scheme (#5247)
**<><>This is a breaking change<><>**

There are slight terminology updates to the current Shape Scheme. 

First, we are staying with the Cut notion for cut corners rather than Angled. This is on par with our current naming of the CutCornerTreatment.

Secondly, we are moving from the term S/M/L Surface to S/M/L Component for the scheme categories.
2018-09-26 13:01:08 -04:00
Yarden Eitan
c741ba4904
[Shape]! Provide more granularity for corner setting for the theming (#5116)
This PR allows our users to set specific corners in the shape scheme and have it applied correctly to the components.

Some components may allow only some of their corners to be set (i.e., BottomSheet)
2018-09-13 15:24:29 -04:00
Yarden Eitan
75ddb21ed0
[Shapes] merge MDCShapeCorner and MDCCornerTreatment into one (#5090)
This will allow us to set percentage support for a corner treatment as a follow up PR. Reason being is that the MDCCornerTreatment is part of the shape of the component itself, and hence has control to set the value of the corner when it is right in the lifecycle and the frame has been set. If we keep the percentage value setting in the Shape Themer, then the themer could be applied too early in the lifecycle and thus take a percentage off a 0 value (frame height).

Overall this simplifies the API and causes less duplication.

The other approach would be to *also* add percentage support to MDCCornerTreatment and leave MDCShapeCorner as is, but that would just make it too cumbersome and redundant.
2018-09-11 17:01:58 -04:00
Yarden Eitan
c036e22a7d
[Cards]! Add a card shape themer (#5031)
Added a card shape themer to our cards component. This includes adding a shape themer, and adding that to the card themer logic to apply the shape themer as well. Also added unit tests.

This PR is blocked on PR #5030
2018-09-07 11:01:21 -04:00
featherless
d5c064fdff
[automated] Fix more copyright stanzas. (#4990)
Our creativity knows no bounds.

### Find

```
/\*
 *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 ([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 ([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 ([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\.
 \*/
```

### Replace

```
// 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 16:09:12 -04: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
0b26db8766
[Cards] Remove NSCoding support. (#4548)
Closes https://github.com/material-components/material-components-ios/issues/3937
2018-07-13 12:51:55 -04:00
Yarden Eitan
27a6c46fc3
[Cards] Added interactability toggle to Cards (#4404)
After a discussion with design we have concluded that a card as a whole doesn't need to be interactable as long as there are other interactable components in its content. As an example, a card that has a button can remove its interactability and allow the button to operate as the interactable entity.

This PR includes:

addition of the isInteractable boolean for MDCCard and MDCCardCollectionCell.
Update to our Card examples to show this change.
Update unit tests for Cards to test the new property.
Small fix to the card example.
This unblocks #4261
2018-06-26 16:39:40 -04:00
featherless
a132eb2106
[Cards] Add umbrella headers for all extension targets. (#3463)
Also updated all imports to make use of the umbrella headers.

Pivotal story: https://www.pivotaltracker.com/story/show/157045283
2018-04-24 16:16:06 -04:00
Yarden Eitan
bd8760b94b [Cards] Implement a semantic color scheme color themer API. (#3289)
Addition of unit tests, and updated the examples to use the new themer.

Pivotal: https://www.pivotaltracker.com/story/show/156169708

[Delivers #156169708]

![simulator screen shot - iphone 8 - 2018-04-08 at 17 44 18](https://user-images.githubusercontent.com/4066863/38468869-9acec11a-3b54-11e8-9e99-af9773ab73bd.png)
2018-04-13 08:42:59 -04:00
Yarden Eitan
bafdbf325c
[Cards] Added customization of image, image alignment, and image tint for each state. (#3030)
* added customizable alignment of selectable image for state, customizable tint color for state, and customizable selectable image for state

* added vertical alignment and fixed copy

* tint color update

* Update MDCCardCollectionCell.h
2018-03-05 18:11:05 -05:00
Yarden Eitan
de988cfe59 [Cards] updates to unit tests and minor fixes (#2898)
* updates to unit tests and small fixes

* update tests

* CGFloat explicit conversion
2018-02-05 17:07:32 -05:00
Ian Gordon
9e87b720f6 Re-enable test with FakeImage 2018-02-02 12:34:22 -05:00
Ian Gordon
862d1ca7d5 Enforce signed casting in our tests 2018-02-02 12:29:25 -05:00
Ian Gordon
8d25698ead Disable test that is blocking release 2018-02-02 12:04:58 -05:00
Yarden Eitan
58f24b4f18 [Cards] Initial Implementation (#2894)
* [Cards] New API Header files (#2886)

* header files

* rename to MDCCardCollectionCell

* update for review

* update to review

* update to review

* [Cards] Full Implementation (#2892)

* cards core implementation

* updates to API and fixes from doc

* small fixes

* podspec, examples, and tests

* small fixes

* small fix

* small fix

* update inkView API and some small nits

* refactor API and code

* refactor API and code

* remove private header

* rename to MDCCardCollectionCell

* updates to api review

* update based on reviews

* fix tests

* [Cards] Initial Docs

* updates to encoding

* small fix

* pr update

* pr update

* pr update

* pr update

* pr update

* pr update

* pr update

* ink api update

* ink api update
2018-02-01 18:45:43 -05:00