152 Commits

Author SHA1 Message Date
Wenyu Zhang
59c44fb3bd [Buttons] Add centerVisibleArea to MDCButton and mark visibleAreaInsets as to be deprecated.
PiperOrigin-RevId: 320085469
2020-07-07 16:36:33 -07:00
Yarden Eitan
6bd4757079 [HitAreaInsets] Add a convenience math method to calculate the correct visibleAreaInsets given a frame and a minimum touch target.
PiperOrigin-RevId: 315655291
2020-06-10 02:29:15 -07:00
Yarden Eitan
dee8934c69 [MDCButton] When visibleAreaInsets are set, don't allow additional setting of the shapeGenerator API directly.
Also add visibleAreaInset API to the FAB typical example now that the conflict between visibleAreaInsets and shapeGenerator is resolved.

PiperOrigin-RevId: 315233817
2020-06-08 02:05:07 -07:00
Yarden Eitan
e8a1c4e7e1 [MDCButton] Add a visibleAreaInsets API.
This API allows clients to inset the visible content and allow it to be smaller than the frame.
In turn, clients can have a touch target that is bigger than the visible content.

PiperOrigin-RevId: 313556504
2020-05-28 03:17:34 -07:00
Wenyu Zhang
dfd5109f15 [FAB] Fix theme being applied to a wrong floating button in the example snapshot.
PiperOrigin-RevId: 312300844
2020-05-19 10:04:54 -07:00
Nobody
70716800b8 Internal change
PiperOrigin-RevId: 312085611
2020-05-18 16:41:12 +00: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
44ec4e204c Internal change
PiperOrigin-RevId: 307562279
2020-04-21 01:44:02 -07:00
Jeff Verkoeyen
7bd2a4e317 Internal change
PiperOrigin-RevId: 307390564
2020-04-20 07:01:37 -07:00
Bryan Oltman
5a2b2caae0 [Button] Add custom UIButtonPointerStyleProvider to MDCButton for better iPadOS pointer interaction.
Note: MDCButton does not enable pointer interactivity by default.

This also adds an example to demonstrate MDCButtons with the default UIPointerInteraction enabled. The example exposes an issue with MDCFloatButton's collapse/expand animations (b/153666859), which will be addressed in a future CL.

PiperOrigin-RevId: 305872547
2020-04-13 09:20:43 -04:00
Jeff Verkoeyen
6ac7e6c3d8 [Buttons] Add support to MDCFloatingButton for animating mode changes.
The new API allows the floating button to animate changes between normal and expanded states.

PiperOrigin-RevId: 305703859
2020-04-09 09:57:44 -07:00
Jeff Verkoeyen
4454d0be94 [Buttons] Use static storage for all local consts.
Two examples were using non-static storage for effectively static consts, causing the symbols to be available available across compilation units and resulting in linker errors when the symbols happen to collide across compilation units.

PiperOrigin-RevId: 305337107
2020-04-07 14:11:53 -07:00
Jeff Verkoeyen
3a157e1f43 [Buttons] Standardize all examples on the same <Component><Example>Example pattern.
PiperOrigin-RevId: 305332675
2020-04-07 13:53:57 -07:00
Robert Moore
8eb7296dab
[Catalog] Fix container scheme properties. (#9192)
Making remaining examples use protocol for container schemes to match the
project's expected convention.

Found while reviewing #9188
2019-12-09 10:48:25 -05:00
Cody Weaver
613ad11043
[Buttons] Fix dynamic type example. (#8992)
This updates the buttons dynamic font example to use what we currently recommend for dynamic type support in MDCButton. This also updates the container scheme to be `@objc` so that Catalog by Conventions can inject the container scheme.

## Screenshots

#### XS 

| Before | After |
| --- | --- |
|![Simulator Screen Shot - iPhone 5 - 2019-11-18 at 14 23 58](https://user-images.githubusercontent.com/7131294/69082993-42386200-0a0f-11ea-8cb0-694a95b9ce1f.png)|![Simulator Screen Shot - iPhone 5 - 2019-11-18 at 14 17 17](https://user-images.githubusercontent.com/7131294/69083166-93e0ec80-0a0f-11ea-8c96-056f2f003ca4.png)|

#### XXXL

| Before | After |
| --- | --- |
|![Simulator Screen Shot - iPhone 5 - 2019-11-18 at 14 23 45](https://user-images.githubusercontent.com/7131294/69083547-4ca72b80-0a10-11ea-965d-c8d83e0bf2c7.png)|![Simulator Screen Shot - iPhone 5 - 2019-11-18 at 14 17 23](https://user-images.githubusercontent.com/7131294/69083536-47e27780-0a10-11ea-9bf5-064928a4f833.png)|

Closes #8855
2019-11-20 11:14:53 -05:00
Robert Moore
b12a4cba54
[Buttons] Improve accessibility of Shaped Buttons. (#8964)
Improve the Shaped Buttons example accessibility by providing better name to
the buttons and setting an accessibility label on the FAB.

|Before|After|
|---|---|
|![IMG_0105](https://user-images.githubusercontent.com/1753199/68969207-6b0feb80-07b2-11ea-96df-69475c4b3477.PNG)|![IMG_0106](https://user-images.githubusercontent.com/1753199/68969208-6d724580-07b2-11ea-8fe2-aa7c01082496.PNG)|



Closes #8853
2019-11-15 15:21:36 -05:00
Cody Weaver
98cafa6756
[Buttons] Update accessibility label for FABs (#8911)
This change updates the accessibility label for both FABs within the `Buttons (Swift and Storyboard)` example.

Closes #8854
2019-11-15 08:58:44 -08:00
Yarden Eitan
f6855caa77
[Buttons] Fix a11y issues in Buttons (Content Edge Insets) exam… (#8900)
In this PR we are fixing the non-accessible colors that were caused due to the container scheme being nil, as init isn't being called with a Storyboard, but rather initWithCode.

Secondly, now the FAB has a good a11y label, so it can be presented correctly when focused.

Before:
![Simulator Screen Shot - iPhone 7 - 2019-11-15 at 09 53 25](https://user-images.githubusercontent.com/4066863/68952401-c8de0c80-078d-11ea-8816-d1e667fbef6b.png)

After:
![Simulator Screen Shot - iPhone 7 - 2019-11-15 at 09 52 50](https://user-images.githubusercontent.com/4066863/68952352-b4017900-078d-11ea-8cf9-08c081a779d9.png)

Closes #8831
2019-11-15 11:34:17 -05:00
featherless
af29d5d737
[Buttons] Replace mdc_legacyFontScaling usage with adjustsFontForContentSizeCategoryWhenScaledFontIsUnavailable. (#8244)
Part of https://github.com/material-components/material-components-ios/issues/8243
2019-08-08 18:05:19 +00:00
Mark Aufflick
b3290cd14d Resolved inifinite loop in FloatingButtonExampleViewController. (#7675)
Removed incorrect calls setting translatesAutoresizingMaskIntoConstraints = NO

closes #7632
2019-06-25 13:36:04 -04:00
Andrew Overton
94e5a978d7
[Buttons] Graduate Buttons+Theming to ready (#7187)
This PR graduates the buttons theming extension to ready.

Closes #7158.
2019-04-19 13:57:00 -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
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
Robert Moore
dc247af636
[Buttons] Don't make Buttons example launch screen. (#7016)
The Buttons example should not be the first screen of the Dragons App.

Follow-up from #7003
2019-04-01 12:50:13 -04:00
ianegordon
3ed0f80d6f
[Buttons] New Dynamic Type curves (#7003)
Add support for the new dynamic type curves.

Note that the new curve values are identical to the old curve values, just using the new API.
2019-03-28 10:48:31 -04:00
Yarden Eitan
10abd4524d
[Shapes] Move shapes from components/private to components/ - Part 3 (last part) (#6734)
This is the third and last part of the migration of moving the Shape libraries away from the private/ folder. Continuation to PR: #6664 and #6495

Tracking bug, progress and more details can be found here: #6494

This resolves #6494

Because Shapes and ShapeLibrary have been used in production and are an integral part of the shape scheme and theming. Moreover, with to stop the confusion of clients that the library should not be imported as it is under private, we want to migrate the Shape libs to be under components/ instead of components/private.

The migration will be a 7 step migration to not break clients internally.
**We have completed steps 1 to 6, This PR concludes step 7 and the entire migration**

1. move the folders to the new directory.
2. Make the old component's BUILD and Podspec targets depend on the new component (and nothing else).
3. Delete all implementation files from the old component.
4. Replace the contents of the old component's headers with import statements to the new component's header. If the new component has headers that match the old component's, then the new component's headers will need to be named uniquely for a period of time to allow clients to migrate over.
5. Once all clients have migrated from the old component, delete the old component. This is a breaking change.
6. If you had to create temporary header names in the new component, then in a separate release add the new headers that you want the new component to use. Move the content of the old headers into the new headers and replace the old headers with an import of the new headers. Migrate clients to the desired headers.
7. Once all clients have moved off of the old headers, delete the old headers.
2019-02-28 16:54:58 -05:00
Cody Weaver
50307bb330
[Container] Fix colorScheme and typographyScheme to be nonnull. (#6699)
## Introduction
Before we move container scheme to ready we need to have both the `colorScheme` and `typographyScheme` nonnull. By making colorScheme and typographyScheme of MDCContainerScheming nonnull, clients will reduce the amount of conditional checks required in their apps and reduce a category of potential errors (accidentally passing nil to a nonnull parameter).

## The problem
Both `colorScheme` and `typographyScheme` were nullable in the container scheme making it harder for clients to use the container scheme throughout their app on non Material UIElements, i.e. UIView.backgroundColor

## The fix
Make both of these properties nonnull.

## Additional work
- [x]  I had to update the swift examples to not be optional and I additionally removed the nil checks from the ObjC examples.
2019-02-27 15:47:26 -05:00
Yarden Eitan
de5d200599
[Shapes] Move shapes from components/private to components/ (#6495)
This is the first part of the migration of moving the Shape libraries away from the private/ folder.

Tracking bug, progress and more details can be found here: #6494 

"Because Shapes and ShapeLibrary have been used in production and are an integral part of the shape scheme and theming. Moreover, with to stop the confusion of clients that the library should not be imported as it is under private, we want to migrate the Shape libs to be under components/ instead of components/private.

The migration will be a 7 step migration to not break clients internally.

1. move the folders to the new directory.
2. Make the old component's BUILD and Podspec targets depend on the new component (and nothing else).
3. Delete all implementation files from the old component.
4. Replace the contents of the old component's headers with import statements to the new component's header. If the new component has headers that match the old component's, then the new component's headers will need to be named uniquely for a period of time to allow clients to migrate over.
5. Once all clients have migrated from the old component, delete the old component. This is a breaking change.
6. If you had to create temporary header names in the new component, then in a separate release add the new headers that you want the new component to use. Move the content of the old headers into the new headers and replace the old headers with an import of the new headers. Migrate clients to the desired headers.
7. Once all clients have moved off of the old headers, delete the old headers.

Passes bazel build and pod build locally.
2019-01-28 17:51:27 -05:00
Cody Weaver
b99faa6c28
[Buttons] Update examples to use theming extensions (#6475)
## Related links
* Related bug: #6441 
* Theming extensions: [Buttons+Theming](https://github.com/material-components/material-components-ios/tree/develop/components/Buttons/src/Theming)
## Introduction
The team is pivoting to using theming extensions so our examples should reflect the current best practices when using our APIs. 
## The problem
We are using _Themers_ in some instances and some instances used a work around for the container scheme. In #6458 we added a Catalog wide container scheme.
## The fix
Remove _Themers_ for _Theming extensions_ and remove the workarounds for not having a catalog wide container scheme.
2019-01-28 09:09:46 -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
featherless
73bdc03c2b
[automated] Rename MaterialComponentsAlpha to MaterialComponentsBeta. (#6018)
This is an automated change generated by replacing all instances of MaterialComponentsAlpha with MaterialComponentsBeta. This is not a breaking change because changes to Alpha/Beta components (including renaming them) are not considered breaking.

The MaterialComponentsAlpha podspec was mistakenly named Alpha, when what we meant was more close to Beta. The distinction is that Alpha components are not expected to be used by clients, while Beta components are.
2018-12-14 10:47:31 -05:00
Randall Li
fe0099d65c Merge branch 'release-candidate' into develop 2018-12-06 16:36:03 -05:00
Randall Li
aa1a1a5778 added missing imports for Buttons_Theming 2018-12-05 15:47:43 -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
Randall Li
371f3ac9a7 Add imports for MaterialContainerScheme 2018-12-05 14:35:59 -05:00
Galia Kaufman
9e80ade173
[Buttons] Add text button themer (#5885)
Adding a text themer to material themer category for Buttons.  Issue: #5847
2018-12-04 10:19:01 -05:00
Andrew Overton
748a9128e3
[Buttons] Add button theming category method for outlined theming (#5878)
This PR adds the MDCButton theming category method for outlined buttons.

Closes #5847.
2018-11-30 11:36:27 -05:00
Cody Weaver
4f0786a2bf
[Buttons] Add themer for contained buttons with container scheme (#5849)
### Context
As the team pivots to using theming within extensions we have started off with buttons as a test run. This will be part fo the work with buttons only addressing the contained button type. This adds a new method to MDCButton - `applyContainedThemeWithScheme:(id<MDCContainerScheming>)scheme`

### The problem
We currently do not theme buttons the way the team has decided to theme them

### The fix
This themes Contained buttons with the new style we have all agreed on.

### Remaining Work
Theming for Text and Outlined buttons in this new style.
2018-11-28 18:11:11 -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
03f3351ad5
Global replace of single-precision floats with CGFloat casts. (#5718)
Replacing all non-integral, single-precision floating point literals with double-precision values explicitly cast to CGFloat.  For example, `0.1f` should become `(CGFloat)0.1`.

Regex used:
```
([0-9]*\.)([0-9]*?)([1-9]+)([0-9]*?)[fF]
```

PiperOrigin-RevId: 220683126
2018-11-12 10:50:01 -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
rami-a
bff3fcf7f1
[Buttons] [MaskedTransition] Apply safe area to floating button example and masked transition example (#5389)
This change applies the safe area to the examples for Floating Button and Masked Transition so that they appear correct on notched displays in landscape.

Closes #3702 
Closes #3714 

Floating Buttons Before:
![simulator screen shot - iphone x - 2018-10-10 at 12 53 13](https://user-images.githubusercontent.com/2364772/46752602-a4128e00-cc8b-11e8-8d58-32255db304af.png)

Floating Buttons After:
![simulator screen shot - iphone x - 2018-10-10 at 12 52 33](https://user-images.githubusercontent.com/2364772/46752584-9a892600-cc8b-11e8-9f8f-fafbc67e2a8b.png)

Masked Transition Before:
![simulator screen shot - iphone x - 2018-10-10 at 12 53 23](https://user-images.githubusercontent.com/2364772/46752610-a8d74200-cc8b-11e8-8ed9-ba010d279d9a.png)


Masked Transition After:
![simulator screen shot - iphone x - 2018-10-10 at 12 52 28](https://user-images.githubusercontent.com/2364772/46752564-91985480-cc8b-11e8-82e6-1458de23c38a.png)

Additionally, I noticed in the Masked Transition example that the left/right fabs were swapped in their position so I fixed this. I also applied the safe area to the fullscreen transition example.
2018-10-10 16:48:34 -04:00
Yarden Eitan
4e456f88ce
[Buttons] Integrate the FAB shape themer into our examples (#5133)
This resolve issue #5049 and is a follow up to PRs #5131 and #5132 and relies on their code.
2018-09-17 11:54:07 -04:00
Yarden Eitan
08bb1d707a
[Buttons] Integration of the button shape themer into the examples (#5121)
This is a follow up PR for #5119  and #5120 and relies on both.

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

This closes #5050
2018-09-14 13:49:27 -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
Wenyu Zhang
2444107e30
[Buttons] fix the text overlapping safeArea issue on
ButtonsShapesExampleViewController (#3703)

closes #3703 

#####Screenshots before the change:    
![before1](https://user-images.githubusercontent.com/8836258/44283102-4a618a80-a22b-11e8-955e-bfcc55f387ca.png)

![before2](https://user-images.githubusercontent.com/8836258/44283032-fc4c8700-a22a-11e8-9c9a-93626bc4a063.png)

####Screenshots after the change:
![after1](https://user-images.githubusercontent.com/8836258/44283041-040c2b80-a22b-11e8-94a4-1c5365474e8a.png)
![after2](https://user-images.githubusercontent.com/8836258/44283042-040c2b80-a22b-11e8-82d7-5bbdba149a8a.png)
2018-08-20 12:36:49 -04:00