26 Commits

Author SHA1 Message Date
Jeff Verkoeyen
96cfc7e331 Internal change
PiperOrigin-RevId: 394241967
2021-09-01 08:56:53 -07:00
Alyssa Weiss
85cdcadbec Update MDC chip examples to no longer use mdc_adjsutFontForContentSizeCategory to support Dynamic Type.
PiperOrigin-RevId: 371925667
2021-05-04 09:04:07 -07:00
Dave MacLachlan
ebac2a8eb7 As of iOS 9/macOS 10.11 (circa 2015) removing objective C objects from the NSNotificationCenter in - (void)dealloc. is no longer required (the classic example is: [[NSNotificationCenter defaultCenter] removeObserver:self] but there are several variations).
In many cases this is the only thing being done in - (void)dealloc, so we can remove the whole thing.

PiperOrigin-RevId: 307663440
2020-04-21 13:00:30 -07:00
featherless
588024d04f [Chips] Fold supplemental code into the examples. (#8587)
Also aligned the examples to consistently make use of properties instead of ivars.

ivar -> property replacement done using the following regexp:

- Find: `_(\w+)`
- Replace: `self.$1`

Cleaned up the following examples:

- ChipsActionExampleViewController
- ChipsChoiceExampleViewController
- ChipsCustomizedExampleViewController
- ChipsInputExampleViewController
- ChipsSizingExampleViewController
- ChipsShapingExampleViewController

Polish as part of https://github.com/material-components/material-components-ios/issues/8459
2019-10-15 22:02:52 -04:00
featherless
4f7e1e00c3
[Chips] Remove all lazy initialization of models from examples. (#8576)
The lazy initialization adds unnecessary complexity to the examples.

Polish for https://github.com/material-components/material-components-ios/issues/8459
2019-10-11 17:51:44 -04:00
featherless
acdbc6f1d6 [Chips] Remove sizing chips from all remaining examples. (#8575)
In doing so, adds Dynamic Type support to ChipsCustomizedExampleViewController (a dragons example).

This is polish of https://github.com/material-components/material-components-ios/issues/8459
2019-10-11 16:40:20 -04:00
featherless
dbfaa92f9b
[Chips] Add Dynamic Type support to the remaining chip collection examples. (#8567)
This is part of https://github.com/material-components/material-components-ios/issues/8459
2019-10-11 08:53:14 -04:00
featherless
332123d241 [Chips] Remove unnecessary explicit layout code. (#8564)
Initializing with the container bounds & using autoresizing width + height when possible is preferred to explicit layout.

Cleanup as part of https://github.com/material-components/material-components-ios/issues/8459
2019-10-10 16:58:20 -04:00
Andrew Overton
0626ccff89
[Chips] Update chips examples to use container schemes (#6477)
This PR adds a container scheme property to the chips examples that didn't have them.
It also uses the theming extension to theme chips that weren't already being themed with it.

Closes #6439.
2019-01-30 11:36:45 -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
Cody Weaver
12b841aff6
[Chips] Add example to BUILD file (#6273)
Closes #6218
2019-01-11 15:03:14 -05:00
rami-a
c604f9fd35
[Chips] Update chips examples to use theming extension (#6096)
### Context
As the team pivots to using theming within extensions we continue this work with Chips.

### The problem
We currently do not utilize the theming extension for chips examples

### The fix
* This change updates all the chips examples to use the new chips theming extension.
* Additionally, this updates the shape example to use the new chips theming extension.

### Bug
Closes #6083
2018-12-21 13:13:45 -05:00
Robert Moore
372d6b24f9
No longer using -init for Color Scheme. (#5734)
{MDC iOS} No longer using `-init` for Color Scheme.

Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults.

Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
2018-11-12 12:54:47 -05:00
rami-a
ae6d459a34
[Chips] Respect safe area for Chips examples (#5377)
Several examples under Chips were not respecting the safe area and therefore obscruing content on iPhone X in landscape. This change fixes that for:
* ChipsActionExampleViewController
* ChipsChoiceExampleViewController
* ChipsFilterExampleViewController

Closes #3705 
Closes #3706 
Closes #3707 


Before:
![simulator screen shot - iphone x - 2018-10-09 at 15 52 46](https://user-images.githubusercontent.com/2364772/46696484-378e8500-cbe0-11e8-9eb0-fedb5f3a0da9.png)

After:
![simulator screen shot - iphone x - 2018-10-09 at 15 55 43](https://user-images.githubusercontent.com/2364772/46696489-3bbaa280-cbe0-11e8-8cfe-e79118205c67.png)
2018-10-10 10:02:17 -04:00
Yarden Eitan
31e4007ec0
[Chips] Integration of the chip themer into the examples (#5113)
This is a follow up PR for #5111  and #5112 and relies on both.

This integrates the created shape themer for chips into the examples that currently use color/typography themers.

This closes #5048
2018-09-13 18:40:43 -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
Robert Moore
63970a2b1f
[Chips] Fix Choice demo (#4473)
Chips Choice demo was allowing the disabled Chip to cause deselection. It
would also eventually style all but 1 chip as "disabled" whenever the style
changed.  As part of the clean-up, I switched from iVars to properties.

## Before
![chip-choice-before](https://user-images.githubusercontent.com/1753199/42232760-67e87ef6-7ebd-11e8-8011-ba61ec1ce546.gif)

## After
![chip-choice-after](https://user-images.githubusercontent.com/1753199/42232763-6d172a76-7ebd-11e8-806b-df94d7b78c0b.gif)
2018-07-09 15:03:15 -04:00
John Detloff
0c0ce4248e
Initialize default color and typography schemes in examples (#4200)
Ensure a default colorScheme and typographyScheme is initialized for examples.
2018-05-21 12:44:43 -04:00
featherless
3cd06801bb [Chips] Replace "stroked" with "outlined" in the examples. (#3647) 2018-05-02 16:30:49 -04:00
John Detloff
c185bc956f
Create a ChipThemer for material and outlined schemes (#3563)
Before:
![simulator screen shot - iphone x - 2018-04-27 at 13 43 06](https://user-images.githubusercontent.com/1418389/39376826-0283c50a-4a21-11e8-921f-1d18ac2e8c38.png)

After:
![simulator screen shot - iphone x - 2018-04-27 at 13 42 03](https://user-images.githubusercontent.com/1418389/39376832-050ea088-4a21-11e8-8c93-29ba62114249.png)
2018-04-30 16:26:56 -04:00
Yarden Eitan
7f7bc36202
[Catalog] Expose colorScheme + typographyScheme properties for all examples to use app wide theming (#3478)
Made colorScheme and typographyScheme properties in the class interfaces for all our examples.
Moved theming away from example inits and into viewDidLoad
Small update for slider example to allow it to grab the theming properly.
Related Pivotal: https://www.pivotaltracker.com/story/show/156616695
2018-04-25 15:15:17 -04:00
featherless
819d321eed
[Chips] Add umbrella headers for all extension targets. (#3464)
Also updated all imports to make use of the umbrella headers.

Pivotal story: https://www.pivotaltracker.com/story/show/157045283
2018-04-24 16:18:19 -04:00
Mohammad Cazi
beac5b37de
[Chips] color themer update. (#3448)
* Updated Chips Color Themer.
Updated Examples to have stroked and non stroked style with ability to switch.
Chip animation for resizing is broken, so for now I turned it off for our example.

* Fixing Filter Chip example to work properly when switched between stroked and filled style. (MDCChipsCollectionViewCell always animatied has issues so for now animation is off - added example to dragon for our testing.).

* fixing typos and indentions

* taking out themer changes to a separate PR, https://github.com/material-components/material-components-ios/pull/3452

* implicit conversion loses floating-point precision fix.

https://github.com/material-components/material-components-ios/pull/3448
2018-04-24 12:10:08 -04:00
Mohammad Cazi
dd0c0123c6
[Chips] Adding Examples/Documentation for all chips types. (#3393)
* Added example for Action Chips Type.
Cleaned up/Documented the examples for Filter and Choice chips type.
Added More documentation to MDCChipCollectionViewCell.

* typo.

PR: https://github.com/material-components/material-components-ios/pull/3393
2018-04-18 16:50:10 -04:00
Mohammad Cazi
8336003a11
[Chips] color themer implementation. (#3372)
* Chips: Color Themer is added. Podspec and Build file updated.
Proper Color Mapping, testing and example update is left to do.

* Adding a helper to merge two colors with different opacities.

* define nonnull for interface.

* [Chips] Color Themer Implementation.
Color themer fully implemented.
Tests are added.
Examples are added.

* tests for color merge functionality.

* Name change "merge" -> "blend"
full support for blending with any opacity.
More tests added.
Better Documentation.

* updating API name.

* ColorBlend:
Change the type to CGFloat from Double,
Updated Documentation and tests.

* All different type of chips have the same mapping for color themer. So the break down between different types is not needed. Just stroked and regular type.

* separate the method implementation out since now there are only two varients.
2018-04-17 09:57:51 -04:00
Sam Morrison
7c8131b672 [Chips] Chip component (#2389)
* [Chips] Chip component

* Update description

* Readme fixes

* NSMutableArray -> NSArray

* Use MDCSlider

* Chips examples CBC

* MDCChipCollectionViewCell.m

* Sanitize example

* Left align single-item rows

* Copy

* Check mark

* Use static inline instead of #define

* initWithFrame:CGRectZero

* encoding decoding

* GGRectGetMinX

* If no title color has been set for a given state...

* Use new icons

* rm init override

* alwaysAnimateCellResize -> alwaysAnimateResize

* MDCChipCollectionViewCell initWithCoder

* Fix MDCChipView encoding

* Fix indent

* Fix sizing images

* Use UIEdgeInsetsInsetRect

* Layout around hidden accessory view

* TODO Pull background color from MDCPalette

* Add The chip uses this property to determine intrinsicContentSize and sizeThatFits.

* Use static functions instead of UIColor extension

* sizeToFit -> setNeedsLayout
2017-11-15 08:29:10 -05:00