51 Commits

Author SHA1 Message Date
Wenyu Zhang
b457b13005 Internal change.
PiperOrigin-RevId: 417635153
2021-12-21 09:32:05 -08: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
1abdf16760 Optimizing imports
PiperOrigin-RevId: 357185990
2021-02-12 07:36:41 -08:00
Nobody
70716800b8 Internal change
PiperOrigin-RevId: 312085611
2020-05-18 16:41:12 +00:00
Jeff Verkoeyen
bcd0c79ef4 Internal change.
PiperOrigin-RevId: 308358719
2020-04-24 17:42:29 -07:00
Jeff Verkoeyen
25471afea0 Rename "flaky" to "skip_snapshots".
PiperOrigin-RevId: 308259307
2020-04-24 08:34:12 -07:00
Jeff Verkoeyen
92254ea119 Rename all icons to an ic_<#name#> convention.
PiperOrigin-RevId: 308232277
2020-04-24 04:33:51 -07:00
Jeff Verkoeyen
c2c1cc64b3 [Catalog] Expose the catalog by convention tree via the AppDelegate and walk the tree with the UI test runner.
This allows our UI test runner to fetch the catalog by convention tree at runtime in order to generate dynamic test runners that walk the entire catalog by convention tree without requiring maintenance of an explicit list of breadcrumbs.

In this change I have replaced the explicit list of components with such a dynamic walker. In a follow-up change we will be able to dynamically walk through every node of the three and take screenshots. In a subsequent change from there we may allow certain nodes to implement "testActionStart" and "testActionStop" methods that allow the test runner to invoke certain canonical actions automatically (e.g. present a dialog).

A couple examples are flaky, so a new convention has been added to those examples of providing a "flaky" tag on the example's metadata. If this flag is YES, then the example will not be snapshotted.

PiperOrigin-RevId: 306214455
2020-04-13 09:26:51 -04:00
Bryan Oltman
68a65d33d3
[BottomAppBar] Delete deprecated MDCBottomAppBarColorThemer (#9166)
MDCBottomAppBarColorThemer has no internal use and is deprecated.

Fixes #9164
Fixes #9165
2019-12-06 17:10:33 -05:00
featherless
5425884431
[examples] Annotate all catalogShouldHideNavigation invocations with @objc. (#8791)
Context:

Due to changes in the Swift runtime over the past years, methods that are considered "optional" in Objective-C need to have @objc annotations in order for Objective-C to be able to perform `respondsToSelector:` invocations.

Problem:
Many of our examples had not annotated their `catalogShouldHideNavigation` methods with the `@objc` annotation, causing the Catalog to wrap the examples in a container app bar view controller. The reason most of these examples would implement `catalogShouldHideNavigation` is because they are managing their own navigation (e.g. to demonstrate AppBar functionality), so this would often result in duplicate AppBars appearing in the example.

The fix:
All `catalogShouldHideNavigation` Swift methods have been annotated with `@objc`.

Fixes https://github.com/material-components/material-components-ios/issues/7576
Fixes https://github.com/material-components/material-components-ios/issues/7578
2019-11-12 16:54:55 -05:00
featherless
a01712388b
[BottomAppBar] Deprecate the ColorThemer. (#8438)
Part of https://github.com/material-components/material-components-ios/issues/8429

There is no internal usage of this API.
2019-09-11 09:00:36 -04:00
featherless
9c8e34138a
[Buttons] Remove all example references to MDCFloatingActionButtonThemer. (#7505)
This is pre-work for being able to annotate MDCFloatingActionButtonThemer as deprecated.

Part of https://github.com/material-components/material-components-ios/issues/5702
2019-06-17 20:59:33 -04:00
Yarden Eitan
efe61588a6
update (#7246)
We need to add @objc annotations to colorScheme and typographyScheme instances in our Swift examples, because we moved to Swift 4.2, the respondsToSelector won't find `setColorScheme:` and `setTypographyScheme:` setters otherwise.
2019-04-23 10:21:14 -04:00
Andrew Overton
c56d5d76d3
Add @objc annotations to get examples to show up in Dragons (#7168)
This is a follow up PR for #7166 adds @objc annotations to Swift catalogMetadata() methods, because the Swift 4 compiler no longer attempts to infer what methods should be visible to Objective-C. As a result of this change in the compiler, no Swift examples were showing up in Dragons after #7166. See this article: https://useyourloaf.com/blog/objc-warnings-upgrading-to-swift-4/ for additional context.
2019-04-17 21:35:43 -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
Wenyu Zhang
ea0986d30c
[BottomAppBar] hide swift example from Catalog. (#6725) 2019-02-28 15:26:10 -05:00
Peter Friese
e1008e5206 [BottomAppBar] Fix it/bottom app bar cut out (#6420)
[BottomAppBar] Fix it/bottom app bar cut out (#5958)

### Context
FABs can be circular or pill-shaped. As described in #5414, the cutout on BottomAppBar does not take into account pill-shaped FABs.

### The Problem
The UIBezierPath used in the current implementation draws a half circle where the FAB appears. For pill-shaped FABS, this doesn't work, as the cutout needs to made up of two quarter circle and a line connecting them.

### The Fix
I implemented a UIBezierPath that is made up of two quarter circles connected by a line, as well as the remainder of the rectangle that makes up the BottomAppBar's background. By doing so, I was able to provide **one** bezier path for both circular and pill-shaped cutouts, and **one** bezier path for a non-cutout version of the rectangle. This results in a smooth animation between the cutout and non-cutout state.

See https://stackoverflow.com/a/9522806 for an explanation of why the cutout and non-cutout bezier paths need to have the same general structure (e.g. number of path elements, and element types).
2019-02-04 11:16:43 -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
4be982a5c6
[BottomAppBar] Add examples to BUILD file (#6348)
This change is the part of the move to add all examples to BUILD files, this additionally adds the missing imports in the examples.
Closes #6223
2019-01-16 09:51:13 -05:00
Yarden Eitan
e30327f8a7 Revert "[BottomAppBar] Fix it/bottom app bar cut out (#5958)"
This reverts commit 068786a9c620e6e760b8f30d414067b1da203808.
2019-01-08 14:59:06 -05:00
Peter Friese
068786a9c6 [BottomAppBar] Fix it/bottom app bar cut out (#5958)
### Context
FABs can be circular or pill-shaped. As described in #5414, the cutout on BottomAppBar does not take into account pill-shaped FABs.

### The Problem
The UIBezierPath used in the current implementation draws a half circle where the FAB appears. For pill-shaped FABS, this doesn't work, as the cutout needs to made up of two quarter circle and a line connecting them.

### The Fix
I implemented a UIBezierPath that is made up of two quarter circles connected by a line, as well as the remainder of the rectangle that makes up the BottomAppBar's background. By doing so, I was able to provide **one** bezier path for both circular and pill-shaped cutouts, and **one** bezier path for a non-cutout version of the rectangle. This results in a smooth animation between the cutout and non-cutout state.

See https://stackoverflow.com/a/9522806 for an explanation of why the cutout and non-cutout bezier paths need to have the same general structure (e.g. number of path elements, and element types).
2019-01-07 17:06:13 -05:00
Wenyu Zhang
6267009748
[Buttons] Update secondary floating action button themer examples (#5922)
Update examples to use secondary floating button theming extension method instead of calling themer's class methods.

Related https://github.com/material-components/material-components-ios/issues/5844
2018-12-05 14:42:55 -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
Robert Moore
c1b1d25eec
[MDC Swift] Add guards for Swift 4.2+ (#5634)
[MDC Swift] Add guards for Swift 4.2+

On Xcode 10, using Tulsi, the unit test target cannot be built because much of the Swift code does
not have the correct syntax for Swift 4.2+. Adding pragmas to allow continued support for Xcode
9.4.2 and Xcode 10.

PiperOrigin-RevId: 220399935
2018-11-07 08:54:40 -05:00
rami-a
160f5b15c1
Fix status bar color appearing incorrect in some Catalog examples (#5363)
I did an audit of the Catalog app to track down screens with an incorrect status bar color and the ones that I found are:
* AppBar -> Presented (This example does not use the app theme so I was able to set the style directly)
* AppBar -> Wrapped
* BottomAppBar

Additionally, I found that changing the Catalog theme from black to another color (and vice-versa) resulted in the status bar being incorrect until the next page navigation. So I created a fix for this too.

Closes #3778
2018-10-08 16:12:51 -04:00
Robert Moore
378f90dc6e
[BottomAppBar]! Examples use semantic color scheme. (#5070)
The BottomAppBar now supports the "surface variant" of the Material
theming color themers. The examples should be updated to reflect the
correct styling for Material Theming.

**This is a breaking change that will break internal MDC Catalog screenshot tests.**

|Example|Before|After|
|--|--|--|
|Catalog (Objc)|![bab-objc-catalog-before](https://user-images.githubusercontent.com/1753199/45260529-566ae300-b3b8-11e8-95c8-a258bf95c3ca.png)|![bab-objc-catalog-after](https://user-images.githubusercontent.com/1753199/45260530-5b2f9700-b3b8-11e8-993d-449eb1c4c47e.png)|
|Dragons (Objc)|![bab-objc-dragon-before](https://user-images.githubusercontent.com/1753199/45260532-6256a500-b3b8-11e8-961e-106da28a3db2.png)|![bab-objc-dragon-after](https://user-images.githubusercontent.com/1753199/45260535-67b3ef80-b3b8-11e8-8f03-b2c808ec9b86.png)|
|Dragons (Swift)|![bab-swift-dragon-before](https://user-images.githubusercontent.com/1753199/45260537-6f739400-b3b8-11e8-8796-b94779018b63.png)|![bab-swift-dragon-after](https://user-images.githubusercontent.com/1753199/45260762-88327880-b3bd-11e8-9896-be55dd96d515.png)|

Part of #3928
2018-09-10 18:31:28 -04:00
Wenyu Zhang
53fe4771d0
[BottomAppBar] Use the height of bottom app bar as the contentInset of table view (#4928)
closes #3689

Before the change:
![simulator screen shot - iphone 5 - 2018-08-28 at 14 53 04](https://user-images.githubusercontent.com/8836258/44744033-15c6bc00-aad2-11e8-9705-1092b2101165.png)

After the change:
![simulator screen shot - iphone x - 2018-08-30 at 16 35 01](https://user-images.githubusercontent.com/8836258/44877736-e4392680-ac72-11e8-9ac0-60a8f0e694d3.png)
2018-09-04 11:48:11 -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
Yarden Eitan
3480c50c67
updated to newest CbC standard (#4956)
Move to the new CbC standard released in CatalogByConvention v2.5.0. See PR: material-foundation/cocoapods-catalog-by-convention#27 for more info on the change.
2018-08-29 20:45:13 -04:00
featherless
bbe4a23fe0
Remove all __IPHONE_11_0 checks now that we no longer support Xcode 8. (#4915)
We can now make use of @available throughout our codebase.

We support Xcode 9 and up, which includes the iOS 11 SDK. This means we can remove any guards for SDKs prior to iOS 11.

This was cleaned up by running a global find-and-replace with the following regular expression:

```
Find:#if defined\(__IPHONE_11_0\) && \(__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0\)\n(.+if \(@available\(iOS 11.0, \*\)\) \{(?:.|\n)*?)(?:#else(?:.|\n)*?)?\n#endif
Replace:$1
```

With some additional cleanup for stragglers that didn't match this pattern. Note that else clauses were intentionally dropped.

Closes https://github.com/material-components/material-components-ios/issues/4909
2018-08-28 09:57:30 -04:00
featherless
50e1fd091d
[Catalog] Conversion to new App Bar View Controller API (#4696)
This PR updates the catalog to use the new MDCAppBar API throughout.
2018-08-07 09:30:37 -04:00
Robert Moore
8dd6d9f3d4
[BottomAppBar] Fix example (#4616)
The example was not responding to taps to the table cells.  The AppBar needs
to be the `tableView`'s delegate, but so does the example view controller.
Forwarding the `UIScrollViewDelegate` methods to the flexible header view
controller to restore UITableView behavior.
2018-07-23 12:13:04 -04:00
John Detloff
bf21b5a2e6
Add an app bar to the bottom app bar demo (#3760)
https://www.pivotaltracker.com/story/show/157256931

![simulator screen shot - iphone 8 plus - 2018-05-09 at 18 02 53](https://user-images.githubusercontent.com/1418389/39842126-53b96150-53b3-11e8-94c6-8b1ed403cbe5.png)
2018-05-10 14:10:53 -04:00
Mohammad Cazi
116071bf96
[Catalog] Bottom App bar should theme the FAB Button. (#3740)
* Bottom App bar should theme the FAB Button,
View should not be loaded in init,
Scheme properties are added.

* lf, header name.

https://github.com/material-components/material-components-ios/pull/3740
2018-05-04 15:49:51 -04:00
Robert Moore
ef522de732
[BottomAppBar] Make FAB visibility a switch (#3734)
The BottomAppBar example should use a switch for toggling visiblity instead of
a "toggle cell".

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

**Before**
![simulator screen shot - iphone 4s - 2018-05-04 at 14 13 16](https://user-images.githubusercontent.com/1753199/39645140-527a0ea0-4fa5-11e8-9e49-49f5d3c41db2.png)

**After**
![simulator screen shot - iphone 4s - 2018-05-04 at 14 10 44](https://user-images.githubusercontent.com/1753199/39645149-5776d53c-4fa5-11e8-8b9c-a74ff3cfb226.png)

![simulator screen shot - iphone 4s - 2018-05-04 at 14 10 46](https://user-images.githubusercontent.com/1753199/39645157-5af443f2-4fa5-11e8-87c3-0b734d2ecadd.png)
2018-05-04 15:39:42 -04:00
Mohammad Cazi
a291896f07
[Typography][Color] Make sure our examples only use the new Color/Typography APIs (#3489)
* Replacing ColorThemer and FontThemer with SemanticColorThemer and TypographyThemer.

* Headline 6 is being used for FeatureHighlights not Headline2  (example update).

* Removed Feature Highlight Themer example since it's redundant, no scheme color changes in Feature Highlight Examples.

https://github.com/material-components/material-components-ios/pull/3489
2018-04-26 12:54:57 -04:00
Mohammad Cazi
5ee14ab92e
[Catalog] Component descriptions update. (#3490)
* Button Description updated.

* Updating the description of Catalog Components.

* Missing space.

* fixing couple of small issues with catalog descriptions.

https://github.com/material-components/material-components-ios/pull/3490
2018-04-25 16:06:18 -04:00
featherless
23110ef116
[Catalog] Make all swift copycat demos be dragons. (#3443)
Also removed "(Swift)" from any examples that remained as non-dragons. The catalog does not need to advertise which language a given demo is in.

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

## Screenshots

Before:
![simulator screen shot - iphone se - 2018-04-23 at 14 04 14](https://user-images.githubusercontent.com/45670/39144588-36095450-46ff-11e8-868d-bdb7e8ee5438.png)

After:
![simulator screen shot - iphone se - 2018-04-23 at 13 53 39](https://user-images.githubusercontent.com/45670/39144567-2ad7bf9a-46ff-11e8-9fd5-ef0739d427b3.png)
2018-04-24 15:52:13 -04:00
featherless
d4f727e16f
[Buttons] Add umbrella headers for all extension targets. (#3454)
Also updated all imports to make use of the umbrella headers.

Pivotal story: https://www.pivotaltracker.com/story/show/157045283
2018-04-24 11:36:56 -04:00
Yarden Eitan
29d760c7d6
Added isPresentable to catalog files, ported over ZShadow to dragons. (#2726) 2017-12-15 12:20:35 -05:00
Randall Li
c3f9fbd429 [BottomAppBar] Corrected imports in examples. (#2656)
PiperOrigin-RevId: 178291407
2017-12-08 23:46:17 -05:00
Randall Li
2f29f00d86 Fixed some compiler warnings (#2426)
* Added warnings to examples.

* fixed some warnings

* using button sender parameter.

* use button sender in example

* use button sender in example

* removed sender from methods that don’t use it.

* removed sender from methods that don’t use it.

* use button sender in example

* use button sender in example

* use button sender in example

* use button sender in example

* Fixed init of header configurator to use passed in parameter

* removed unused API

* use button sender in example

* Revert "Added warnings to examples."

This reverts commit 91f0480f86cb609c47b00f1346f82de67c31c4e9.

* fixed example: Using the view controllers navigationItem rather than creating a new one.

* removed finished checks from animation blocks in examples.

* reverted id sender checks

* revert id sender check for Flexible header UINavigationBar

* revert clug

* revert clug

* addressing nits

* removed sender check for FeatureHighlightTypicalUseView

* more nits
2017-11-22 10:51:55 -05:00
Junius Gunaratne
fbbab80570 Implement viewSafeAreaInsetsDidChange (#2466) 2017-11-17 09:13:07 -05:00
Yurii Samsoniuk
2a96682230 Replace unnecessary imports with forward declarations (#2429)
* [Themes] Remove unnecessary imports.

* [TextFields] Remove unnecessary imports.

* [Typography] Do not use an umbrella header inside of a component.

* [Snackbar] Do not use self umbrella header.

* [ActivityIndicator] Do not use self umbrella header.

* [AppBar] Use umbrella headers.

* [AppBar] Remove self import header.

* [ButtonBar] Removed self umbrella header imports.

* [Buttons] Removed self umbrella header imports.

* [Collections] Update imports.

* [Dialogs] Moved import into an m file.

* [Collections] Fixed imports.

* [FeatureHighlight] Removed self umbrealla imports.

* [HeaderStackView] Reordered imports.

* [Ink] Replaced imports with forward declarations.

* [Slider] Replaced self umbrella import use.

* [Snackbar] Removed self umbrella header import.

* [Tabs] Changed math import. Replaced self umbrella header import.

* [Icons] Removed unnecessary imports.

* [Overlay] Replaced umbrella header import.

* [ShapeLibrary] Replace Shapes imports with an umbrella header.

* [Shapes] Replaced imports with forward declarations.

* [AppBar] Replace import with a forward declaration.

* [Examples] Updated imports.

* Fixed conflicting imports

* Added space between different import categories
2017-11-16 18:25:06 -05:00
Martin Petrov
f98a9d42ed @objc annoaing catalog by convention (#2305) 2017-10-30 10:24:17 -04:00
Junius Gunaratne
9f44d52984 Update bottom app bar for iPhone X (#2234) 2017-10-23 12:04:23 -04:00
Adrian Secord
479f7b1141 Remove trailing whitespace everywhere. (#2168) 2017-10-13 11:33:35 -04:00
Junius Gunaratne
49e4ae74c6 [BottomAppBar] Add readme and Swift example (#2040)
* Add readme and swift example

* Use autoresize mask for layout

* Use autoresize mask for layout

* Add links in .md file. Apply swift code style.

* Update color example code
2017-10-03 14:59:21 -04:00
Junius Gunaratne
e68fee2c67 [BottomAppBar] Update the file creation date to the correct year (#2035)
* Fix bottom app bar animation

* Update file comments to correct year
2017-09-25 10:48:17 -04:00