183 Commits

Author SHA1 Message Date
Cody Weaver
dd79e5c6b1
[Dialogs] Refactor test to use setup and teardown (#5482)
### Context
In working on #5296 I noticed a lot of the test had repeated code that can be pulled into a `setup` function. Additionally some of the test were missing _Given_, _When_, and _Then_ statements so those were added. This change hopefully makes this code more readable to future maintainers. I also noticed some of the test had extra work in the _Given_ that wasn't necessary so I removed that.
### The problem
Repeated steps in the _Given_ section of the test
### The fix
Implement the `setup` and `teardown` functions as well as add missing _Given_, _When_, and _Then_ comments.

### Related bugs
This isn't related to any bugs this is just something that I saw that could be improved.
2018-10-23 09:16:21 -04:00
Galia Kaufman
d55d7ab9f2
[Dialogs] Theming action buttons in DialogThemer (#5416)
Adding semantic emphasis to Dialog actions which allows conditional theming of buttons. The MDCDailogScheme now has a button scheme which can be used to theme buttons according to their action's assigned emphasis.
Issue: b/117608629
Design Review document (go/gmdc-ios-dialogs-design-doc).
2018-10-22 12:31:03 -04:00
Cody Weaver
f18085def5
[Dialogs] Fix elevation to use MDCShadowElevation
### Context
In working on #5296 and #5301 I used `CGFloat` instead of `MDCShadowElevation`. We have the `MDCShadowElevation` data type strictly for this exact use case and I missed that. This goes back and fixes those changes to match all other components. This shouldn't cause any changes in behavior but screenshots are added to make sure. Clients should be unaffected by this change even if they were using a custom elevation. 
```objc
dialog.elevation = 2;
```
Will work the same as before.

### The problem
MDCAlertController (and all related classes) used `CGFloat` instead of `MDCShadowElevation`.

### The fix
Replace `MDCShadowElevation` with `CGFloat`.

| Before | After |
| - | - |
|![simulator screen shot - iphone xs max - 2018-10-19 at 08 43 51](https://user-images.githubusercontent.com/7131294/47219484-e8cdb180-d37c-11e8-8a5f-1df485420582.png)|![simulator screen shot - iphone xs max - 2018-10-19 at 08 39 31](https://user-images.githubusercontent.com/7131294/47219488-ecf9cf00-d37c-11e8-8f52-a309752b5cdb.png)|
2018-10-19 10:05:56 -04:00
Galia Kaufman
c793fcf753
[Dialogs] Upgrade buttons class to MDCButton (b/117543195) (#5401)
Switching MDCAlertController buttons from MDCFlatButton, which is being deprecated, to MDCButton.
Issue: b/117543195
TAP test: CL/217698229
Also see: #4739
2018-10-18 16:05:51 -04:00
Robert Moore
d994fe7531
[Dialogs] Enable misspelled test. (#5399)
One of the tests was misspelled and not executing.
2018-10-12 09:28:35 -04: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
Galia Kaufman
0beee09b20
[Dialogs] add scrimColor to MDCAlertController (#5362)
Adding scrimColor property to MDCAlertController, which controls the background color when the alert is presented by a MDCDialogPresentationController. 
Issues: b/116845327, b/117173678.
2018-10-10 10:44:04 -04:00
Cody Weaver
95fbb31946
[Dialogs] Update README for new themer
Context
We recently added an API for a DialogThemer but we are yet to update the README.

The problem
We are missing docs for the new API

The fix
Update the readme to have the new themer API

Related issues
b/116306933
2018-10-03 15:13:15 -04:00
Cody Weaver
abd24015d8
Update to match spec (#5309)
### Context
I believe the scrim color didn't match what the value should be, possibly design changed this value and we didn't get that updated. I noticed this when trying to theme the scrim color with the color themer.
### The problem
The scrim color doesn't match internal document
### The fix
Update the value to desired default scrim color
### Screenshot
| Before | After | 
| - | - |
|![simulator screen shot - iphone xr - 2018-10-03 at 11 39 58](https://user-images.githubusercontent.com/7131294/46421895-2d144d00-c701-11e8-8bc7-a2b97b04dc3b.png)|![simulator screen shot - iphone xr - 2018-10-03 at 11 40 18](https://user-images.githubusercontent.com/7131294/46421904-31406a80-c701-11e8-905e-a385d6bebb85.png)|
I can't see a difference in the screenshots I think it's because the values are so close.
2018-10-03 15:12:38 -04:00
Cody Weaver
20b759081d
[Dialogs] Update the themer and scheme to have elevation (#5301)
### Context
We recently added an `elevation` property to MDCAlertController.
### The problem
The alertScheme didn't set the elevation if an MDCAlertController was themed.
### The fix
This applies the elevation a client sets to their scheme to the AlertController, if no elevation is set then it defaults to the MDCShadowElevationDialog value which is 24dp.
### Related PR
This is the PR that added the elevation property.
#5296 
### Related bug
b/117168419
2018-10-03 12:10:16 -04:00
Cody Weaver
cba82b4d06
[Dialogs] Add shadow elevation (#5296)
### Context
Clients may need to set custom elevation levels for their custom dialogs
### The problem
Currently we don't expose any of the necessary properties to do this.
### The fix
Expose those properties so clients can have a custom elevation for their Dialog.

### Additionally
Test and Examples have been added.


### Screenshots
| Default | Custom |
| - | - |
|![simulator screen shot - iphone x - 2018-10-02 at 15 40 25](https://user-images.githubusercontent.com/7131294/46372705-e7e91000-c659-11e8-875c-132ba70c4b9f.png)|![simulator screen shot - iphone x - 2018-10-02 at 15 40 21](https://user-images.githubusercontent.com/7131294/46372715-ecadc400-c659-11e8-81a7-2f253ebf38e8.png)|
2018-10-02 16:07:49 -04:00
Galia Kaufman
1137a62d92
[Dialogs] Customizing scrim color in presentation controller (#5283)
Adding the API to customize the color of MDCAlertController's background scrim, and to apply the color during theming. Also includes tests & an example.
Issue: #5279
Issue: b/116845327
2018-10-02 04:53:32 -04:00
Galia Kaufman
d065e4536f
[Dialogs] Customize tint color of alert title icon (#5159)
Updating AlertController API to customize the tintColor of the alert's titleIcon. Includes tests and examples.
issue: #5174
issue: Update MDC API to customize MDCAlertController title🐛
2018-09-28 06:31:31 -04:00
Galia Kaufman
dc184ba549
[Dialogs] Customize alert title icon (#5167)
Adding a title icon property to MDCAlertController.

The title icon is an image that is shown above the dialog title, and is automatically aligned with the title, supporting all NSTextAlignment alignment options (center, natural, left, right, etc).

Includes tests and examples using the new property.

Issue: #5174
Issue: Update MDC API to customize MDCAlertController title🐛
2018-09-27 14:32:57 -04:00
Randall Li
2d2c0c8d4d [Dialog/alert] Corrected example import of dialog from scheme 2018-09-26 12:04:44 -04:00
Randall Li
7ac4397a2a [Dialog/alert] Corrected example import of dialog from scheme 2018-09-26 11:03:42 -04:00
Randall Li
093c7edbd6 [Dialog/alert] Corrected example import of dialog scheme 2018-09-26 10:57:53 -04:00
Randall Li
21f5a44b7d [Dialog/alert] Corrected import of typography scheme 2018-09-26 10:41:53 -04:00
Randall Li
0734061d51 [Dialog/alert] Added import of typography scheme 2018-09-26 10:39:52 -04:00
Randall Li
455fd70155 [Dialog/alert] Added import of collections 2018-09-26 10:34:34 -04:00
Randall Li
036998f60c [Dialog/alert] Added import of dialog color scheme 2018-09-26 10:27:47 -04:00
Randall Li
b3c791e8f2 [Dialog/alert] Added import of color scheme 2018-09-26 10:25:40 -04:00
Randall Li
6e0eeb7d69 [Dialog/Alert] Using umbrella header of themer 2018-09-26 09:52:15 -04:00
Galia Kaufman
80145df58e
[Dialogs] Customize alert title alignment (#5164)
Set title alignment of MDCAlertController with NSTextAlignment options.
Issue: #5174
Issue: Update MDC API to customize MDCAlertController title🐛
2018-09-24 16:12:28 -04:00
Galia Kaufman
5b34c0eb3a
[Dialogs] Add/update examples for dialog themer (#5158)
Adding and updating existing examples that use the new dialog themer (#5102).
Issue: b/113257098.
2018-09-20 17:21:20 -04:00
Galia Kaufman
faea5d127b
[Dialogs] Add a dialog themer
A new Alert Themer which is used to apply an Alert Scheme to an Alert Controller.
2018-09-18 10:46:16 -04:00
Galia Kaufman
fcd70cad6e
[Dialogs] Expose corner radius property (#4988)
Exposing a corner radius property on MDCAlertController.

Setting the Alert's corner radius updates its view's corner radius, as well as propagate the radius to the presentation controller so it can correctly render the tracking/shadow layer.

Issue: #4964
Issue: b/113257098
2018-09-12 08:03:27 -04:00
SaidinWoT
f97d5ff971 Add Header trait to title in AlertControllerView (#5032)
The title label in MDCAlertControllerView should identify itself as a header for accessibility purposes. This adds the necessary trait to the label.
2018-09-11 10:42:44 -04:00
Cody Weaver
1e51e97249
Revert "[Dialogs] Remove use of MDCFlatButton for MDCButton and MDCTextButtonThemer (#4739)" (#5040)
Revert "[Dialogs] Remove use of MDCFlatButton for MDCButton and MDCTextButtonThemer (#4739)"

This reverts commit 84d5dfbb83d0118ff26921318df8cc549d919809.

This commit resulted in undesired behavior for a client, this change reverts to the old desired behavior.
2018-09-07 12:46:13 -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
Jeff Verkoeyen
9854044c96 Revert "[automated] Standardize our open source license stanza to what Xcode generates. (#4982)"
This reverts commit b45bc2fdd4dfe12fc76751a45c9cf7b0d6c1261f.
2018-08-31 12:01:24 -04:00
featherless
b45bc2fdd4
[automated] Standardize our open source license stanza to what Xcode generates. (#4982)
Removes the need to copy-paste stanzas from other files anymore as we'll rely on https://github.com/material-components/material-components-ios/pull/4478 to generate the correct stanza for us instead.

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

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

### 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 11:49:00 -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
Robert Moore
823776e6ba
[Dialogs] Add accessibilityIdentifier to Actions. (#4917)
To improve support for UI testing, `accessibilityIdentifier` values
should be attached to the action buttons of MDCAlertController views.
Instead of exposing the views and the buttons, an
`accessibilityIdentifier` property can be assigned to the MDCAlertAction
directly using the UIAccessibilityIdentification protocol.

Closes #4916
2018-08-28 16:45:41 -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
Robert Moore
cce878a837
[Dialogs] Adding 'buttonInkColor' (#4847)
[Dialogs] Adding 'buttonInkColor' 

Allows changing the ink color effect of the action buttons.

Internal change: cl/209173946
2018-08-21 14:23:03 -04:00
Robert Moore
175942d9e0
[Catalog] Fix Swift example imports (#4780)
Many of our Swift examples are either missing imports or are importing all of
MaterialComponents. Both of these will cause failures during internal builds.
2018-08-14 13:26:37 -04:00
featherless
e14b90e829
[schemes/Color] Formally mark all to-be-deprecated APIs as "ToBeDeprecated". (#4738)
This change further formalizes our pattern of annotating APIs that will be or are deprecated using class categories. Moving an API into such a category has the benefit of being picked up by the API diff toolchain and elevated into our release notes as a result.
2018-08-09 16:39:56 -04:00
Cody Weaver
84d5dfbb83
[Dialogs] Remove use of MDCFlatButton for MDCButton and MDCTextButtonThemer (#4739)
Remove all instances of MDCFlatButton within [Dialogs] component
Replace with MDCTextButtonThemer and MDCButton

MDCFlatButton is the old API and MDCTextButtonThemer/MDCButton are the modern APIs.


Closes #3914
2018-08-09 11:15:08 -04:00
Cody Weaver
255dae403b
[Dialogs] Fix button hit areas to match accessibility (#4684)
Update buttons within Dialog to have a minimum 48x48 touch area. 

Also, update example to make sure in an case where there is a large number of buttons, make sure that their is enough room in the scroll view. 

Closes #3664
2018-08-03 13:40:53 -04:00
ianegordon
a55e190c3c
Revert "[Dialogs] Update buttons touch area to be 48x48 minimum (#4624)" (#4675)
This reverts commit 2c8539c3be9bb39dd8198341fb71c860cbc61e93.
2018-07-31 16:05:38 -04:00
Cody Weaver
2c8539c3be
[Dialogs] Update buttons touch area to be 48x48 minimum (#4624)
Update the buttons within dialogs to respect 48x48 minimum touch area. 

Closes #3664
2018-07-29 18:59:33 -04:00
ianegordon
d2d1cc064f
[Dialogs] Best example description (#4643) 2018-07-27 12:04:59 -04:00
ianegordon
20445a5d85
[Dialogs] Update A11y docs (#4509) 2018-07-11 17:49:33 -04:00
Andrew Overton
d6f771d3c6
make accessibilityPerformEscape honor MDCDialogPresentationController.dismissOnBackgroundTap (#4508) 2018-07-11 16:57:25 -04:00
ianegordon
cacd2e2fdd
[Dialogs] AlertController button layout issue (#4291)
Code was not handling the case where action buttons hadn't called sizeToFit: resulting in unexpected horizontal or vertical button layouts.
2018-05-29 18:27:29 -04:00
featherless
e1e6d249a4
[Docs] Add badges to all components. (#4278)
As part of our readme generator, components can now opt in to displaying badges in their readme.

The badges are generated from https://shields.io/ and are focused on an individual component. We're currently generating the following badges:

- Open bug count.
2018-05-25 11:12:48 -04:00
ianegordon
02d19e08ad
[Dialogs] Add customizable cornerRadius to enable proper shadowing (#4233)
* Initial Import

* Pull cornerRadius from the presented view

* FB

* Naming
2018-05-24 10:49:49 -04:00
Mohammad Cazi
39030e7b20
[Dialogs] Setting Properties on Alert controller will not force the view to load. (#4238)
* Setting Properties on Alert controller will not force the view to load.

* Changed to the old approach on how to handle custom view and setting its properties.

* alertview check for alert title was missing.

* Unit tests Added.

https://github.com/material-components/material-components-ios/pull/4238
2018-05-23 15:05:32 -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