56 Commits

Author SHA1 Message Date
Jeff Verkoeyen
fbf2f90376 [BottomSheet] Delete the ShapeThemer library.
Also removed examples that made use of the ShapeThemer and removed all of the ShapeScheme examples.

PiperOrigin-RevId: 404270856
2021-10-19 08:45:05 -07: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
Wenyu Zhang
dfe9dcb58e [BottomSheet] Add ignoreKeyboardHeight to allow configuring bottomSheet's behavior when keyboard is present.
PiperOrigin-RevId: 369988303
2021-04-22 17:54:22 -07:00
Jeff Verkoeyen
9f9b452b3a Optimizing imports
PiperOrigin-RevId: 356850973
2021-02-10 16:15:17 -08:00
Nobody
87c8968e66 Updating BottomSheet examples organization
PiperOrigin-RevId: 315266913
2020-06-08 07:03:09 -07:00
Bryan Oltman
464f202058 [BottomSheet] Add bottomSheetDismissalAnimationCompleted method to MDCBottomSheetPresentationController.
This function is invoked by MDCBottomSheetPresentationControllers when the bottom sheet dismissal animation has completed. This will be followed by a change to add a similar function to MDCActionSheetControllerDelegate, which will close the associated issue.

PiperOrigin-RevId: 314948223
2020-06-05 10:10:26 -07:00
Bryan Oltman
b169119b9f Internal change
PiperOrigin-RevId: 314926035
2020-06-05 07:47:15 -07:00
Bryan Oltman
4e461e2c13 [Catalog] Add BottomSheetPresentationControllerDelegateExample to demonstrate usage of MDCBottomSheetPresentationControllerDelegate.
PiperOrigin-RevId: 314784259
2020-06-04 12:47:00 -07:00
Bryan Oltman
ee0b388c5c [Catalog] Rename BottomSheetPresentationExample to BottomSheetModalPresentationExample to better represent its purpose.
PiperOrigin-RevId: 314778352
2020-06-04 12:18:05 -07:00
Randall Li
da90ed6640 [MDCBottomSheet] Better logging output in example.
PiperOrigin-RevId: 308843160
2020-04-28 10:01:41 -07:00
Randall Li
fa0e96173d [MDCBottomSheet] TableViewExample: Fixed swift format and added class description to example.
PiperOrigin-RevId: 308734272
2020-04-27 17:47:58 -07:00
Randall Li
ceff0080c1 [MDCBottomSheet] recreate bug in catalog.
Landscape presented tableviews resist scrolling up with longer content.

PiperOrigin-RevId: 308726855
2020-04-27 16:58:20 -07:00
Randall Li
0100cfe414 [MDC-iOS/BottomSheet] Fix dismissOnDraggingDownSheet behavior
The bottom sheet incorrectly allowed the sheet to be drag dismissed when `dismissOnDraggingDownSheet` was set to NO.

This change permits the gesture to dismiss to begin but prevents it from actually closing the sheet.

https://github.com/material-components/material-components-ios/issues/9723

Closes https://github.com/material-components/material-components-ios/pull/9885

PiperOrigin-RevId: 307802500
2020-04-22 06:21:26 -07:00
Cody Weaver
fdf87c5995 [MDC/ColorScheme] Remove usage of init within MDC.
We recommend using `initWithDefaults` and we should follow the recommendation. This change removes all usage of `init` within MDC components in order to let us remove that initializer from the public surface.

PiperOrigin-RevId: 302958447
2020-03-25 13:36:51 -07:00
Bryan Oltman
d83af534c3
[TextFields] implement resignFirstResponder in MDCMultilineTextField (#9793) 2020-02-25 16:17:19 -05:00
Bryan Oltman
00a4f37a4a
[BottomSheet] Add example to reproduce issue 9773 (#9789)
A reproduction of an issue found internally. To reproduce:

1. Navigate to this example
1. Turn VoiceOver on
1. Tap the button to display the bottom sheet

Expected behavior:
The bottom sheet becomes focused

Actual behavior:
The text field behind the bottom sheet reclaims focus after the bottom sheet finishes presenting

Reproduces #9773
2020-02-24 17:48:35 -05:00
Bryan Oltman
78fe3701d0
[Catalog] Add accessibility elements to BottomSheetExamples (#8923)
* [Catalog] Add accessibility element to BottomSheetTallExample

* [Catalog] Add accessibility element to BottomSheetSimpleExample

* Add dismissOnBackgroundTap to BottomSheetPresentationExample

* clang
2019-11-15 12:10:37 -05:00
Bryan Oltman
adfe99ed30
[Catalog] Add VoiceOver support to BottomSheetShortCollectionExample (#8849) 2019-11-14 23:20:03 -05:00
Bryan Oltman
5b826f163a
[Catalog] Remove scrim accessibility logic from BottomSheetUIControlExample (#8848)
* [BottomSheet] Ignore background tap location if VoiceOver is on

* Verify that the scrim view is focused in voice over

* cleanup

* Remove VoiceOver logic from bottom sheet, update example

* cleanup
2019-11-14 17:25:50 -05:00
Linksmt
948199ab04 [BottomSheet] Disable pan gesture on UIControl (#8491)
This change prevents touches to UIControl from being recognized by the bottomsheet's swipe gesture. This way a user doesn't accidentally starts dismissing the sheet while they are trying to interact with a control on the sheet.
2019-10-10 15:08:22 -04:00
Wenyu Zhang
9bd8770ae4
[BottomSheet] replace UIWebView usage with WKWebView. (#8453)
closes https://github.com/material-components/material-components-ios/issues/8381.

This PR removed the references to deprecated UIWebView, and used WKWebView (available on iOS8+) in place to keep the original behavior. 

As WKWebView is available on Mac Catalyst, the TARGET_OS_UIKITFORMAC flag is also removed.

An Example is created for this WebView change.
Screenshot:

![webview](https://user-images.githubusercontent.com/8836258/64892736-42993300-d643-11e9-8dfa-a686506de015.gif)
2019-09-13 17:41:09 -04:00
Yarden Eitan
405fcd3b3c [BottomSheet] Additional API providing callbacks for sheet offset and current state changes. (#7275)
Additional API to the MDCBottomSheetControllerDelegate delegate, allowing clients to conform to the delegate and get callbacks for:
1. The offset of the sheet changes in respect to the top of the screen in points.
2. The state of the sheet changes to one of the possible states of type MDCSheetState.

This has been tested on examples to check for correctness of values and that the methods are called appropriately once the controller conforms to the protocol.

Additional unit tests have been written to test that the added delegate methods are rightly called when the value changes and a callback needs to be made.

Resolves: #7227
2019-04-26 01:08:38 -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
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
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
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
Yarden Eitan
2803125b2c
ran clang-format (#6027) 2019-01-11 13:23:51 -05:00
danblakemore
ee8f1991ec [BottomSheet] Add a Dragon to demonstrate issue #5778 (#5779)
* Add Bottom Sheet dragon which helps reproduce an issue with bottom sheet centering and iPad Split View.

* Updated copyright and import ordering.
2018-11-19 15:51:37 -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
Yarden Eitan
66b9afbdaf
[BottomSheet] Integrating the BottomSheet shape themer in the example (#5078)
Addition of the BottomSheet shape themer as part of the typical bottom sheet example. Resolves #5051 

![bottomsheetgif](https://user-images.githubusercontent.com/4066863/45319058-b8d4f800-b50c-11e8-9c75-6bf6d1d4cff5.gif)
2018-09-10 22:00:55 -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
Randall Li
fc3c5d4a0b Corrected an import in an example to use umbrella header. 2018-08-22 11:05:49 -04:00
danblakemore
1fea42b984 [BottomSheet] Add Safe Area Handling Example (#4870)
* Demonstrate incorrect safe area handling.
This is due to the check on MDCSheetContainerView.m:213 which prematurely prevents the layout updates since the adjusted height is also set on line 162.
2018-08-21 17:36:19 -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
24ddf9c4d6
[BottomSheet] Examples support accessible scrim (#4711)
The BottomSheet scrim (dimmed background overlay) can function as a button for
UIAccessibility features. This allows a discoverable close/dismiss function
for users. Turning this feature on by default in the catalog to showcase that
it is recommended.

Related to #4275
2018-08-06 15:10:55 -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
Yarden Eitan
61e65488af
[BottomSheet] [Shapes] Added Shapes support for BottomSheet (#4486)
Added support for shaping a bottom sheet in multiple states.
A bottom sheet can either be collapsed (partially visible but not full screen) and expanded (sheet covering the whole screen). We wanted to allow support for shaping a sheet differently for each of its states.

Therefore the bottom sheet state was exposed rather than hidden and an API was defined to allow changing the shape for each state.
2018-07-09 17:32:24 -04:00
featherless
18b23ed0e6
[BottomSheet] Add a short bottom sheet example to MDCCatalog (#4318)
This will allow us to test accessibility for bottom sheets that can't expand to full screen.

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

## Screenshot

![simulator screen shot - iphone se - 2018-05-31 at 09 20 49](https://user-images.githubusercontent.com/45670/40784555-f69bde46-64b3-11e8-8a98-1ef6fcfb1f4c.png)
2018-06-01 16:14:20 -04:00
featherless
0575212f1c
[BottomSheet] Add an app bar to the typical use example. (#4268)
Closes https://github.com/material-components/material-components-ios/issues/4236

![example](https://user-images.githubusercontent.com/45670/40505345-ebb13a00-5f61-11e8-89d7-c51d9e45150a.gif)
2018-05-24 15:38:16 -04:00
featherless
e923d2d928
[Catalog] Make many examples be dragons. (#3642)
Pivotal story: https://www.pivotaltracker.com/story/show/156939988
Pivotal story: https://www.pivotaltracker.com/story/show/156804299
Pivotal story: https://www.pivotaltracker.com/story/show/156939962
Pivotal story: https://www.pivotaltracker.com/story/show/156982119
Closes: https://github.com/material-components/material-components-ios/issues/3183
2018-05-02 08:31: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
Ian Gordon
4f940e8cb1 Revert "[BottomSheet] Convert to Material Motion. (#2400)"
This reverts commit c9ef0366c1525be0f5c384cf90703ab73dbcf3e3.
2018-02-25 13:10:33 -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
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