95 Commits

Author SHA1 Message Date
rami-a
1ecf3e341a
Add dragons example for appbar that demonstrates issue #5412 (#5471)
This change is to help us fix a client-blocking bug by providing an example that reproduces the issue in #5412
2018-10-23 10:08:14 -04: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
Randall Li
814deb95bc [appbar] Corrected import of example imports 2018-09-26 12:19:05 -04:00
Randall Li
d16a41808e [appbar] Corrected import of example imports 2018-09-26 11:54:01 -04:00
Randall Li
093c7edbd6 [Dialog/alert] Corrected example import of dialog scheme 2018-09-26 10:57:53 -04:00
Randall Li
e913b71e9a [Dialog/alert] Corrected example import of tdialog scheme 2018-09-26 10:51:44 -04:00
Randall Li
5099d7f582 [AppBar] Corrected example import of typography scheme 2018-09-26 10:49:15 -04:00
featherless
3ea86babf1
[AppBar] Add an example demonstrating manual tab management. (#5161)
This example was provided by @babakbo in https://github.com/material-components/material-components-ios/issues/5156

The purpose of this example is to be able to test the behavior of multiple tabs that are added and removed from the view controller hierarchy as the selected tab changes. This is different from the typical tabs usage, which relies on a horizontally-paging scroll view to allow the tabs to be switched between.

In addition, this example is demonstrating the use of the canAlwaysExpandToMaximumHeight API which has been provided specifically for @babako and team.

## Screenshots

![simulator screen shot - iphone 8 plus - 2018-09-18 at 21 18 14](https://user-images.githubusercontent.com/45670/45707744-63da5700-bb88-11e8-86e7-55bef20408ac.png)
2018-09-19 19:14:01 +03: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
Ian Gordon
58761c75f6 Remove methods duplicated in categories 2018-08-16 14:49:39 -04:00
featherless
4e658a5aee
[FlexibleHeader] Fix a bug with WKWebView as a tracking scroll view. (#4701)
Repro case:
- Open MDCDragons.
- Open the App Bar -> WKWebView small content bug

Expected behavior: the web view does not allow the content to be scrolled up and down.
Actual behavior: the web view's scroll view's content size height appears to have extra padding, allowing the content to be scrolled.

---

This change introduces a runtime check for WKWebView. If the tracking scroll view is a scroll view of a WKWebView, we disable the content inset adjustment behavior in favor of using additionalSafeAreaInsets on iOS 11 and up. On older iOS devices, clients must instead rely on the topLayoutGuide and position their web view below the header accordingly. This is demonstrated in the two added examples.

This bug stems from the fact that UIKit's implementations of its various UIScrollView subclasses each have individual quirks. UITableView reacts differently to additionalSafeAreaInsets than WKWebView's scroll view, and a pure UIScrollView reacts differently from either of them. The most notable difference in behavior is how and when the contentOffset is adjusted in reaction to changes in the additionalSafeAreaInsets.

My original attempt at this fix included a public behavioral flag that would allow clients to opt in to using additionalSafeAreaInsets for any tracking scroll view, but the various quirks of UITableView and friends was expanding the scope of the fix too much. I would like to move the Flexible Header towards relying solely on additionalSafeAreaInsets in the future, but for now it is out of scope of this particular bug fix. As such, I've introduced a more focused behavioral flag that only enables itself if the tracking scroll view is a WKWebView's scroll view.

Closes https://github.com/material-components/material-components-ios/issues/4377
2018-08-15 09:24:43 -04:00
Wenyu Zhang
980443d994
[Catalog] set cell selection style to none in several examples (#3870) (#4776)
set cell selection style to none in following examples:
Activity Indicator Demo
App Bar Demo
AppBarSectionHeaderExample
AppBarImageryExample

closes #3870
2018-08-13 16:15:42 -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
featherless
76a5c1e688
[AppBar] Add an inferTopSafeAreaInsetFromViewController behavior. (#4648)
This behavior enables the similarly-named behavior added to the Flexible Header in bb245597d8895a78c346c76f7d0986d7a993ad12. In addition to allowing the flexible header's min/max height to use the contextual safe area insets, the App Bar will use the flexible header view's top safe area guide to position its header view (rather than using MDCDeviceSafeAreaInsets(), which we want to remove).

This change enables the new behavior in the App Bar examples and in the MDCCatalog node list view controller.

Closes https://github.com/material-components/material-components-ios/issues/4104
2018-07-30 10:42:07 -04:00
featherless
a5594f3780
[FlexibleHeader] Add support for observing the tracking scroll view. (#4647)
This new opt-in behavior allows a client to more easily integrate the Flexible Header (and relatedly, the App Bar) when they do not require shifting behavior (which is most of the time).

The new behavior can be enabled by setting `observesTrackingScrollViewScrollEvents` to true on the flexible header view instance.

When this property is enabled, the flexible header will no longer allow tracking scroll view events to be manually forwarded, and it will also enforce the shift behavior being set to a disabled state. The intent of this enforcement is to encourage unambiguous usage of the flexible header (you're either allowing it to observe events, or you're forwarding events, but not both).

I've rolled this new behavior out to all of the App Bar examples to demonstrate how much code it removes. I expect this to be a large win for client teams that are integrating with the App Bar.

The underlying implementation of this new behavior relies on KVO of the scroll view's contentOffset property. We manage registration of KVO events through the fhv_startObservingContentOffset and fhv_stopObservingContentOffset APIs.

Prior to iOS 11, the KVO implementation of observers required that you deregister any observers from an object before it is deallocated. As such, if a client wishes to use this behavior and they also support iOS 10.* or below, they must also explicitly nil out the tracking scroll view before it is deallocated. This is required because we keep a weak reference to the tracking scroll view (for a variety of important reasons, namely: avoiding retain cycles and ensuring we don't keep the tracking scroll view alive longer than its owning controller). Because of the weak reference, we can't rely on our own dealloc method being invoked before the tracking scroll view is deallocated. As such, only the client who provided us with a tracking scroll view is capable of making an informed decision as to when to nil out the tracking scroll view. In essence, this behavior comes with a KVO contract (a cost) while providing a much easier integration experience (the benefit).

If a client supports iOS 11 and up, they can simply enable this behavior with no additional code.

Closes https://github.com/material-components/material-components-ios/issues/347
2018-07-26 23:36:42 -04:00
Ali Rabbani
4438b441b2 Mainline the YES behaviour for useFlexibleTopBottomInsets, and remove the already deprecated API. (#4570)
Mainline the YES behavior for useFlexibleTopBottomInsets, and remove the already deprecated API.

Closes https://github.com/material-components/material-components-ios/issues/3924
2018-07-16 13:29:51 -04:00
featherless
abae199d71
[Catalog] Enable AppBar's isTopLayoutGuideAdjustmentEnabled in all examples. (#4537)
This enables the new FlexibleHeader/AppBar behavior that correctly updates the content view controller's safe area insets/top layout guide to match the flexible header's height and sets the frame of the content view controller to match the bounds of the container view controller.

As part of this change, we were able to remove the Catalog logic that would manually adjust the frame of examples that did not have a scroll view. Examples are now expected to adjust their content according to the top layout guide / safe area insets, as can be seen in the ButtonsTypicalUse example.

Examples that *do* have a scroll view will also now make use of the correct top layout guide / safe area insets behavior. This behavioral change can most notably be seen in the ActivityIndicator example, which no longer has a 20 point "dead zone" above the table view.
2018-07-12 15:43:53 -04:00
featherless
9707aec0fd
[AppBar] Implement topLayoutGuideAdjustmentEnabled on the app bar container. (#4370)
This mimics the behavior of the flexible header container view controller introduced in 80fd217f766e0f5be6a3bc6bef5923f231721f9d. Notably, this allows content view controllers that are wrapped by an App Bar to make proper use of the top layout guide and additional safe area insets APIs.

Blocked by https://github.com/material-components/material-components-ios/pull/4354

Closes https://github.com/material-components/material-components-ios/issues/2540

## Screenshots

Before:

![before](https://user-images.githubusercontent.com/45670/41035558-0456d42c-695b-11e8-8071-62e174d8d90e.png)

After:

![after](https://user-images.githubusercontent.com/45670/41035560-06708b9a-695b-11e8-9231-f96ea34caea9.png)
2018-06-06 13:29:10 -04:00
Ali Rabbani
b9086c94c4 [NavigationBar] Deprecate useFlexibleTopBottomInsets (#4358)
Deprecate useFlexibleTopBottomInsets and change the default behavior to YES.
2018-06-06 09:47:53 -04:00
John Detloff
56bdce0b32
Add example of an AppBar in a presented vc (#4351)
https://github.com/material-components/material-components-ios/issues/3809

![simulator screen shot - ipad retina - 2018-06-01 at 16 37 50](https://user-images.githubusercontent.com/1418389/40862342-37fba892-65ba-11e8-9188-4a07c4824b83.png)
![simulator screen shot - ipad retina - 2018-06-01 at 16 37 52](https://user-images.githubusercontent.com/1418389/40862343-38097594-65ba-11e8-8184-a546eb7441a7.png)
![simulator screen shot - ipad retina - 2018-06-01 at 16 37 54](https://user-images.githubusercontent.com/1418389/40862344-3817d616-65ba-11e8-8ab5-5305c96f5a85.png)
![simulator screen shot - iphone x - 2018-06-01 at 16 38 05](https://user-images.githubusercontent.com/1418389/40862345-383a9a16-65ba-11e8-8497-020c050c9645.png)
![simulator screen shot - iphone x - 2018-06-01 at 16 38 08](https://user-images.githubusercontent.com/1418389/40862346-3845a942-65ba-11e8-86a1-4f647e523a8d.png)
2018-06-05 11:27:12 -04:00
featherless
0e792aacf6
[AppBar] Add a wrapped table view controller example. (#4336)
Closes https://github.com/material-components/material-components-ios/issues/4293

### Screenshot

![simulator screen shot - iphone se - 2018-05-31 at 10 05 43](https://user-images.githubusercontent.com/45670/40786890-33c631a8-64ba-11e8-8105-1769b546b5fb.png)
2018-06-01 16:56:11 -04:00
John Detloff
82afdff90d Create an example of MDCAppBarContainerViewController usage (#4197) 2018-05-22 17:51:50 -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
c2b286d559
[AppBar] Make the interface builder and modal presentation examples be dragons. (#3659) 2018-05-02 17:27:02 -04:00
Mohammad Cazi
f7869ea61b
[AppBar] Added a AppBarTypicalCollectionViewExample. (#3491)
* Added a AppBarTypicalCollectionViewExample.

* applying scheme in view did load, adding scheming properties to the example so it works with global theming.

* light content status bar for dark nav bar.

* Added Step 1.

https://github.com/material-components/material-components-ios/pull/3491
2018-04-26 12:54:44 -04:00
featherless
41ac844364
[AppBar] Fix the app bar status bar style in the typical use demo. (#3505) 2018-04-26 12:48:57 -04:00
Mohammad Cazi
a6b31d4d54
[AppBar] Update the examples, forwarding scrollView Delegate typical use. (#3494)
* Update the example to have the call forward in typical use and got rid of examples related to forward scrollView Delegates.

* Updated the swift version to have forward calls.

https://github.com/material-components/material-components-ios/pull/3494
2018-04-26 11:17:55 -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
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
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
09c3a65e6e
[AppBar] Add umbrella headers for all extension targets. (#3458)
Also updated all imports to make use of the umbrella headers.

Pivotal story: https://www.pivotaltracker.com/story/show/157045283
2018-04-24 10:21:00 -04:00
featherless
ab8c104262
[AppBar] Add a Typography themer. (#3359)
Pivotal story: https://www.pivotaltracker.com/story/show/156769436

Before: 
![before](https://user-images.githubusercontent.com/45670/38753386-2bba1988-3f2c-11e8-9689-e18b9559816e.png)

After:
![simulator screen shot - iphone 8 plus - 2018-04-13 at 15 05 25](https://user-images.githubusercontent.com/45670/38753374-22f89e14-3f2c-11e8-8223-a125c1ec9910.png)
2018-04-13 17:23:16 -04:00
Ali Rabbani
8af9e9fc81 [ButtonBar] Allow customizing the inkColor of the buttons (#3250)
Make inkColor for buttons in MDCButtonBar customizable. Also expose an API on MDCNavigationBar to allow using the custom inkColor in AppBar.

closes #1660
2018-04-13 09:05:22 -04:00
Ali Rabbani
992d581481 [NavigationBar] Allow flexible height/insets in MDCNavigationBar (#3305)
This is a roll-forward for #2974, with fixes for the internal issues. We now have an API, and only change the behavior when the API is used. That API should be mainlined when all clients adopt the new behavior.

[titleLabel with titleView with useFlexibleTopBottomInsets=YES](https://user-images.githubusercontent.com/2232489/38525318-c7890406-3c1f-11e8-81f3-b72afee2dd71.png)
[titleLabel with titleView with useFlexibleTopBottomInsets=YES](https://user-images.githubusercontent.com/2232489/38525320-c7a32570-3c1f-11e8-9e46-e232307a5a0a.png)


[titleLabel with titleView with useFlexibleTopBottomInsets=NO (current behavior)](https://user-images.githubusercontent.com/2232489/38525261-9bf7b2f6-3c1f-11e8-9942-048c139e6163.png)
[titleLabel with titleView with useFlexibleTopBottomInsets=NO (current behavior)](https://user-images.githubusercontent.com/2232489/38525286-b150692c-3c1f-11e8-94b3-167d75393870.png)

[titleView with useFlexibleTopBottomInsets=NO (current behavior)](https://user-images.githubusercontent.com/2232489/38525208-72545e4a-3c1f-11e8-8e5e-eb9b3457c8b3.png)
[titleView with useFlexibleTopBottomInsets=YES](https://user-images.githubusercontent.com/2232489/38525209-725f4012-3c1f-11e8-838d-f6872a760931.png)

Internal testing done in cl/192612758.

closes #2793
closes #253
2018-04-13 09:02:59 -04:00
featherless
0ad1f5dfb2
[AppBar] Implement semantic color themer. (#3283)
Also updated the examples.

Pivotal story: https://www.pivotaltracker.com/story/show/156169751
2018-04-09 16:39:43 -04:00
Yarden Eitan
89be8d3119
An example showing a bug when using MDCFlexibleHeaderView inside a UITableViewController (#2744) 2017-12-19 10:45:07 -05: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
b1ec22207f
Fixed float conversion build errors (#2602)
* Fixed float conversion build errors
Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')

Found by turning on warnings via: https://github.com/material-components/material-components-ios/pull/2480

* More Fixed float conversion build errors
Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')

Found by turning on warnings via: https://github.com/material-components/material-components-ios/pull/2480
2017-12-06 15:57:04 -05:00
Andrés
f11269ad6b
[FlexibleHeader] Add hideViewWhenShifted API. (#2317) 2017-11-10 17:27:37 -05:00
Martin Petrov
f98a9d42ed @objc annoaing catalog by convention (#2305) 2017-10-30 10:24:17 -04:00
Yurii Samsoniuk
0601a77200 [AppBarExample] Load image assets using UIImage(named:in:compatibleWith:) (#2233) 2017-10-20 16:54:02 -04:00
Adrian Secord
479f7b1141 Remove trailing whitespace everywhere. (#2168) 2017-10-13 11:33:35 -04:00
Will Larche
96fb533554 [Catalog] Fixes improper use of Bundle and assets (#2118)
* [Catalog] Fixing bundle usage in some examples.

* [Examples] Correcting use of assets and bundles.

* [Examples] Formatting.
2017-10-08 15:04:48 -04:00
Will Larche
03fd5a02ce [AppBar] Example corrections. (#2108) 2017-10-06 09:42:47 -04:00
Marc-Antoine Courteau
21e0bed4a2 [AppBar] Adds example using a UITableViewController with sections. (#2051)
This example demonstrates issue
[2032](https://github.com/material-components/material-components-ios/issues/2032).

AppBarSectionHeadersExample.m is forked from AppBarTypicalUseExample.m.
2017-09-26 15:34:54 -07:00
Robert Moore
8940d77d6d [Catalog] Verify all examples provide CatalogByConvention methods (#1911)
All examples now have at least the required `+catalogBreadcrumbs` and `+catalogIsPrimaryDemo`.  All examples in the same breadcrumbs path have only one primary demo.  There should be only one `-catalogDescription` attached to the primary demo.

Closes #1897
2017-08-31 08:46:10 -04:00
Robert Moore
f33f8c2d54 [AppBar] Fixing modal example bar colors (#1785)
The "modal" AppBar examples did not have the same header colors as the
rest of the examples and looked a bit odd with the iOS status bar.
2017-08-11 15:39:16 -04:00
Justin Shephard
c694092520 [AppBar] - Accessibility Mutator (#1236)
* MDC_#702 - Start to implement accessibility configurator

* MDC_#702 - Implemented configurator method to modify accessibility colors to app bar and implemented example use

* MDC_#702 - Updated examples

* MDC_#702 - Updated naming convention

* MDC_#702 - Readability

* MDC_#702 - Updated pod spec to include new class MDCAppBarAccessibilityEnforcer, started adding tests, updated examples to new use class

* MDC_#702 - Stubbed out tests

* MDC_#702 - Re-implemented MDCAppBarAccessibilityEnforcer as object within AppBar component

* Filled in additional tests

* MDC_#702 - Updated method name

* MDC_#702 - Updated test cases

* MDC_#702 - Update added test to Swift 3.0

* [AppBar] - Update accessibility mutator class

* [AppBar] - Updated text selection in mutator method

* [AppBar] - Removed init method per comment

* [AppBar] - Updated colors in AppBar demo examples
2017-07-13 10:01:03 -04:00