diff --git a/CHANGELOG.md b/CHANGELOG.md index b9bf2668eee..0346ac52858 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,184 @@ +# 13.0.0 + +## API diffs + +Auto-generated by running: + + scripts/api_diff -o 0c7bda2e69db44668360b89e3403a7ad9e16c3aa -n 10e4a258fa529178d1aa6ae8962193eb18b43d20 + +### Dialogs + +- [new] [`+[MDCAlertAction actionWithTitle:handler:]`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L117) +- [new] [`+[MDCAlertController alertControllerWithTitle:message:]`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L48) +- [new] [`-[MDCAlertController addAction:]`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L69) +- [new] [`MDCActionHandler`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L103) +- [new] [`MDCAlertAction.title`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L128) +- [new] [`MDCAlertAction`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L108) +- [new] [`MDCAlertController.actions`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L76) +- [new] [`MDCAlertController.message`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L90) +- [new] [`MDCAlertController.title`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L87) +- [new] [`MDCAlertController`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/Dialogs/src/MDCAlertController.h#L35) + +### SpritedAnimationView + +- [declaration changed] [`-[MDCSpritedAnimationView startAnimatingWithCompletion:]`](https://github.com/google/material-components-ios/blob/10e4a258fa529178d1aa6ae8962193eb18b43d20/components/SpritedAnimationView/src/MDCSpritedAnimationView.h#L85). +``` +- (void)startAnimatingWithCompletion:(nullable void (^)())completion +- (void)startAnimatingWithCompletion:(nullable void (^)(BOOL))completion +``` + +## Component changes + +### ActivityIndicator + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) + +### AppBar + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + +### ButtonBar + +#### Changes + +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + +### Buttons + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + +### CollectionCells + +#### Changes + +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) +* [Various bug fixes for MDCCollectionViewCells](https://github.com/google/material-components-ios/commit/c7aa271784550c9b14c44c9f2815ea27bf5af225) (Sam Morrison) + +### CollectionLayoutAttributes + +#### Changes + +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + +### Collections + +#### Changes + +* [Fix delegate calls for moving an item](https://github.com/google/material-components-ios/commit/ed084ccbad4303321a8a87958c98e932a9050583) (randallli) +* [Fix storyboard usage of MDCCollectionViews](https://github.com/google/material-components-ios/commit/36164cd6e548ac4efed23df99848f62e003298a1) (Eric Shieh) +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + +### Dialogs + +#### Changes + +* [Add Alert Controller](https://github.com/google/material-components-ios/commit/1fe4ac3f647727aeb75749d25bc5341bf751e8f6) (Ian Gordon) +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Use migrated keyboard watcher code](https://github.com/google/material-components-ios/commit/df6016a51cc157fd0b9f62444e428a43a704d9fc) (Ian Gordon) +* [[KeyboardWatcher] Extract values from a notification](https://github.com/google/material-components-ios/commit/3bfc5f9c9058e0423d22d09ca2b9fdc69ffb0a70) (Ian Gordon) + +### FlexibleHeader + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) +* [[MDC #624] Correctly initialize the shifterStatusBar when creating a MDCFlexibleHeaderView](https://github.com/google/material-components-ios/commit/f146473416188434ae2fb6b837bd9ce71863ea70) (Sam Morrison) + +### HeaderStackView + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + +### Ink + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [MDC_#495 - Removed unused declaration of startPoint](https://github.com/google/material-components-ios/commit/f5e940c743836ff4bd589c81d9d12fae9af08c0b) (Justin Shephard) + +### NavigationBar + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + +### PageControl + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) + +### ProgressView + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + +### ShadowElevations + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) + +### ShadowLayer + +#### Changes + +* [Add additional detail clarifying the difference between CALayer.zPosition and MDCShadowLayer.elevation.](https://github.com/google/material-components-ios/commit/56a519186f344e26f92122eaf1871a4530fa3a4f) (Ian Gordon) +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) + +### Slider + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [[ThumbTrack] Slider and Switch implement `isTracking` UIControl method](https://github.com/google/material-components-ios/commit/7cfaf9b0969e19b8820d5b23dab154c4c317d647) (Max Luzuriaga) + +### Snackbar + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) + +### SpritedAnimationView + +#### Breaking changes + +* [**Breaking**: Add 'finished' bool to animation completion block](https://github.com/google/material-components-ios/commit/d8a2d93ebcd4f284f576c05c7a186d54fe2d6319) (Sam Morrison) + +#### Changes + +* [Fix SpritedAnimationViewTests](https://github.com/google/material-components-ios/commit/10e4a258fa529178d1aa6ae8962193eb18b43d20) (Sam Morrison) + +### Switch + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [[ThumbTrack] Slider and Switch implement `isTracking` UIControl method](https://github.com/google/material-components-ios/commit/7cfaf9b0969e19b8820d5b23dab154c4c317d647) (Max Luzuriaga) + +### Typography + +#### Changes + +* [Lowercase "material design" in text.](https://github.com/google/material-components-ios/commit/65a05eed3112816c7441be4f6766d12099d0b0f3) (Adrian Secord) +* [Remove ARC guards from MDC](https://github.com/google/material-components-ios/commit/10e11da725499e7bd6e07c034b875b4dcfa1e2fe) (Sam Morrison) + + # 12.2.0 ## API diffs @@ -2213,7 +2394,7 @@ Auto-generated by running: * [Pesto] Corrections for build warnings (Will Larche) * [Pesto] making string and URL propertys 'copy' (Will Larche) * [Pesto] Style update: @property ivars (larche) -* [Pesto] Update card zoom animation to be more Material Design like (Junius Gunaratne) +* [Pesto] Update card zoom animation to be more material design like (Junius Gunaratne) ###### Docs and site * [Docs] Minor touchups to FlexibleHeader readme. (Jeff Verkoeyen) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d301bf8ca9d..a25df7c2dc7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,107 +1,3 @@ -Want to contribute? Great! First, read this page (including the [small print](#the-small-print)). +Please see [contributing page](./contributing/README.md) for more information. -## Pull requests - -Pull requests can be hard to review if they try to tackle too many things -at once. Phabricator's -"[Writing Reviewable Code](https://secure.phabricator.com/book/phabflavor/article/writing_reviewable_code/)" -provides a set of guidelines that help increase the likelihood of your -pull request getting merged. - -In short (slightly modified from the original article): - -- A pull request should be as small as possible, but no smaller. -- The smallest a pull request can be is a single cohesive idea: don't - make pull requests so small that they are meaningless on their own. -- Turn large pull requests into small pull requests by dividing large - problems into smaller problems and solving the small problems one at - a time. -- Write sensible pull request descriptions. - -Our additions: - -- A pull request should affect as few components as possible. -- Pull requests must include a modification to the CHANGELOG.md summarizing the - change. - -### Conventions - -This repository follows a file layout convention that ensures consistency and -predictability across all of our components. The conventions are described in -the [GOS-conventions](https://github.com/google/GOS-conventions) repository. - -### Before you contribute - -Before we can use your code, you must sign the -[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1) -(CLA), which you can do online. The CLA is necessary mainly because you own the -copyright to your changes, even after your contribution becomes part of our -codebase, so we need your permission to use and distribute your code. We also -need to be sure of various other things—for instance that you'll tell us if you -know that your code infringes on other people's patents. You don't have to sign -the CLA until after you've submitted your code for review and a member has -approved it, but you must do it before we can put your code into our codebase. -Before you start working on a larger contribution, you should get in touch with -us first through the issue tracker with your idea so that we can help out and -possibly guide you. Coordinating up front makes it much easier to avoid -frustration later on. - -### Code reviews - -All submissions, including submissions by project members, require review. We -allow pull requests to be filed, but we perform code reviews on codereview.cc. - -### The small print - -Contributions made by corporations are covered by a different agreement than -the one above, the -[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate). - -# Component checklist - -This checklist describes the process by which Material components are built. - -## API review - -API reviews work like typical code reviews with the added constraint of only reviewing the -component's **public APIs**. - -To initiate an API review, send a pull request that only includes the public APIs you wish to -review. - -TODO(featherless): Flesh this out with some concrete examples of existing API reviews. - -## Minimize dependencies - -The work: avoid non-essential dependencies. - -The why: the team has had many discussions on this topic. Generally speaking, we use the following -considerations as a basis for minimizing dependencies: - -- dependencies increase cost of maintenance and cost of usage for a component, and -- dependency-less components are much easier to drop in and, most importantly, to remove from a - project. - -[Reach out to the team directly](contributing/#questions) for advice or questions on this matter. - -Recommendations: - -- Aim for zero non-platform dependencies. -- Reasonable exceptions can be made, but must be justified. -- Do not create "Core" or "Utility" libraries. - -## Nullability annotations - -The work: add nullability annotations to every header of your component. - -The why: nullability annotations improve Swift usage of a component's APIs. -[Learn more](https://developer.apple.com/swift/blog/?id=25) - -Recommendations: - -We **explicitly** annotate all public APIs rather than use `NS_ASSUME_NONNULL_BEGIN`. This is an -intentional deviation from Apple’s practice of using the `ASSUME` macros. - -Further reading: - -- http://nshipster.com/swift-1.2/#nullability-annotations +Github directs to this page when you create an issue. diff --git a/MaterialComponents.podspec b/MaterialComponents.podspec index 7164169167f..7531ee51c06 100644 --- a/MaterialComponents.podspec +++ b/MaterialComponents.podspec @@ -2,7 +2,7 @@ load 'scripts/generated/icons.rb' Pod::Spec.new do |s| s.name = "MaterialComponents" - s.version = "12.2.0" + s.version = "13.0.0" s.authors = { 'Apple platform engineering at Google' => 'appleplatforms@google.com' } s.summary = "A collection of stand-alone production-ready UI libraries focused on design details." s.homepage = "https://github.com/google/material-components-ios" diff --git a/MaterialComponentsCatalog.podspec b/MaterialComponentsCatalog.podspec index 6f9b8bb43b8..518271b5d7e 100644 --- a/MaterialComponentsCatalog.podspec +++ b/MaterialComponentsCatalog.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MaterialComponentsCatalog" - s.version = "12.2.0" + s.version = "13.0.0" s.authors = { 'Apple platform engineering at Google' => 'appleplatforms@google.com' } s.summary = "A collection of stand-alone production-ready UI libraries focused on design details." s.homepage = "https://github.com/google/material-components-ios" diff --git a/MaterialComponentsUnitTests.podspec b/MaterialComponentsUnitTests.podspec index 2dbd6a4b58d..91e59910ccd 100644 --- a/MaterialComponentsUnitTests.podspec +++ b/MaterialComponentsUnitTests.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MaterialComponentsUnitTests" - s.version = "12.2.0" + s.version = "13.0.0" s.authors = { 'Apple platform engineering at Google' => 'appleplatforms@google.com' } s.summary = "A collection of stand-alone production-ready UI libraries focused on design details." s.homepage = "https://github.com/google/material-components-ios" diff --git a/README.md b/README.md index 6d9d274ab80..31ac563974d 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ class MDCBuildTestViewController: UIViewController { ## Attributions Material Components iOS uses -[Material Design icons](https://github.com/google/material-design-icons), +[material design icons](https://github.com/google/material-design-icons), copyright Google Inc. and licensed under [CC BY 4.0](http://creativecommons.org/licenses/by/4.0/). diff --git a/catalog/Podfile.lock b/catalog/Podfile.lock index ab1178b25fb..55848c855a4 100644 --- a/catalog/Podfile.lock +++ b/catalog/Podfile.lock @@ -1,34 +1,34 @@ PODS: - CatalogByConvention (1.0.1) - - MaterialComponents (12.2.0): - - MaterialComponents/ActivityIndicator (= 12.2.0) - - MaterialComponents/AppBar (= 12.2.0) - - MaterialComponents/ButtonBar (= 12.2.0) - - MaterialComponents/Buttons (= 12.2.0) - - MaterialComponents/CollectionCells (= 12.2.0) - - MaterialComponents/CollectionLayoutAttributes (= 12.2.0) - - MaterialComponents/Collections (= 12.2.0) - - MaterialComponents/Dialogs (= 12.2.0) - - MaterialComponents/FlexibleHeader (= 12.2.0) - - MaterialComponents/FontDiskLoader (= 12.2.0) - - MaterialComponents/HeaderStackView (= 12.2.0) - - MaterialComponents/Ink (= 12.2.0) - - MaterialComponents/NavigationBar (= 12.2.0) - - MaterialComponents/OverlayWindow (= 12.2.0) - - MaterialComponents/PageControl (= 12.2.0) - - MaterialComponents/Palettes (= 12.2.0) - - MaterialComponents/private (= 12.2.0) - - MaterialComponents/ProgressView (= 12.2.0) - - MaterialComponents/RobotoFontLoader (= 12.2.0) - - MaterialComponents/ShadowElevations (= 12.2.0) - - MaterialComponents/ShadowLayer (= 12.2.0) - - MaterialComponents/Slider (= 12.2.0) - - MaterialComponents/Snackbar (= 12.2.0) - - MaterialComponents/SpritedAnimationView (= 12.2.0) - - MaterialComponents/Switch (= 12.2.0) - - MaterialComponents/Typography (= 12.2.0) - - MaterialComponents/ActivityIndicator (12.2.0) - - MaterialComponents/AppBar (12.2.0): + - MaterialComponents (13.0.0): + - MaterialComponents/ActivityIndicator (= 13.0.0) + - MaterialComponents/AppBar (= 13.0.0) + - MaterialComponents/ButtonBar (= 13.0.0) + - MaterialComponents/Buttons (= 13.0.0) + - MaterialComponents/CollectionCells (= 13.0.0) + - MaterialComponents/CollectionLayoutAttributes (= 13.0.0) + - MaterialComponents/Collections (= 13.0.0) + - MaterialComponents/Dialogs (= 13.0.0) + - MaterialComponents/FlexibleHeader (= 13.0.0) + - MaterialComponents/FontDiskLoader (= 13.0.0) + - MaterialComponents/HeaderStackView (= 13.0.0) + - MaterialComponents/Ink (= 13.0.0) + - MaterialComponents/NavigationBar (= 13.0.0) + - MaterialComponents/OverlayWindow (= 13.0.0) + - MaterialComponents/PageControl (= 13.0.0) + - MaterialComponents/Palettes (= 13.0.0) + - MaterialComponents/private (= 13.0.0) + - MaterialComponents/ProgressView (= 13.0.0) + - MaterialComponents/RobotoFontLoader (= 13.0.0) + - MaterialComponents/ShadowElevations (= 13.0.0) + - MaterialComponents/ShadowLayer (= 13.0.0) + - MaterialComponents/Slider (= 13.0.0) + - MaterialComponents/Snackbar (= 13.0.0) + - MaterialComponents/SpritedAnimationView (= 13.0.0) + - MaterialComponents/Switch (= 13.0.0) + - MaterialComponents/Typography (= 13.0.0) + - MaterialComponents/ActivityIndicator (13.0.0) + - MaterialComponents/AppBar (13.0.0): - MaterialComponents/FlexibleHeader - MaterialComponents/HeaderStackView - MaterialComponents/NavigationBar @@ -37,15 +37,15 @@ PODS: - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/ButtonBar (12.2.0): + - MaterialComponents/ButtonBar (13.0.0): - MaterialComponents/Buttons - MaterialComponents/private/RTL - - MaterialComponents/Buttons (12.2.0): + - MaterialComponents/Buttons (13.0.0): - MaterialComponents/Ink - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/CollectionCells (12.2.0): + - MaterialComponents/CollectionCells (13.0.0): - MaterialComponents/CollectionLayoutAttributes - MaterialComponents/Ink - MaterialComponents/private/Icons/ic_check @@ -56,91 +56,91 @@ PODS: - MaterialComponents/private/Icons/ic_reorder - MaterialComponents/private/RTL - MaterialComponents/Typography - - MaterialComponents/CollectionLayoutAttributes (12.2.0) - - MaterialComponents/Collections (12.2.0): + - MaterialComponents/CollectionLayoutAttributes (13.0.0) + - MaterialComponents/Collections (13.0.0): - MaterialComponents/CollectionCells - MaterialComponents/CollectionLayoutAttributes - MaterialComponents/Ink - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/Dialogs (12.2.0): + - MaterialComponents/Dialogs (13.0.0): - MaterialComponents/Buttons - MaterialComponents/private/KeyboardWatcher - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - - MaterialComponents/FlexibleHeader (12.2.0) - - MaterialComponents/FontDiskLoader (12.2.0) - - MaterialComponents/HeaderStackView (12.2.0) - - MaterialComponents/Ink (12.2.0) - - MaterialComponents/NavigationBar (12.2.0): + - MaterialComponents/FlexibleHeader (13.0.0) + - MaterialComponents/FontDiskLoader (13.0.0) + - MaterialComponents/HeaderStackView (13.0.0) + - MaterialComponents/Ink (13.0.0) + - MaterialComponents/NavigationBar (13.0.0): - MaterialComponents/ButtonBar - MaterialComponents/private/RTL - MaterialComponents/Typography - - MaterialComponents/OverlayWindow (12.2.0) - - MaterialComponents/PageControl (12.2.0) - - MaterialComponents/Palettes (12.2.0) - - MaterialComponents/private (12.2.0): - - MaterialComponents/private/Color (= 12.2.0) - - MaterialComponents/private/Icons (= 12.2.0) - - MaterialComponents/private/KeyboardWatcher (= 12.2.0) - - MaterialComponents/private/Overlay (= 12.2.0) - - MaterialComponents/private/RTL (= 12.2.0) - - MaterialComponents/private/ThumbTrack (= 12.2.0) - - MaterialComponents/private/Color (12.2.0) - - MaterialComponents/private/Icons (12.2.0): - - MaterialComponents/private/Icons/Base (= 12.2.0) - - MaterialComponents/private/Icons/ic_arrow_back (= 12.2.0) - - MaterialComponents/private/Icons/ic_check (= 12.2.0) - - MaterialComponents/private/Icons/ic_check_circle (= 12.2.0) - - MaterialComponents/private/Icons/ic_chevron_right (= 12.2.0) - - MaterialComponents/private/Icons/ic_info (= 12.2.0) - - MaterialComponents/private/Icons/ic_radio_button_unchecked (= 12.2.0) - - MaterialComponents/private/Icons/ic_reorder (= 12.2.0) - - MaterialComponents/private/Icons/Base (12.2.0) - - MaterialComponents/private/Icons/ic_arrow_back (12.2.0): + - MaterialComponents/OverlayWindow (13.0.0) + - MaterialComponents/PageControl (13.0.0) + - MaterialComponents/Palettes (13.0.0) + - MaterialComponents/private (13.0.0): + - MaterialComponents/private/Color (= 13.0.0) + - MaterialComponents/private/Icons (= 13.0.0) + - MaterialComponents/private/KeyboardWatcher (= 13.0.0) + - MaterialComponents/private/Overlay (= 13.0.0) + - MaterialComponents/private/RTL (= 13.0.0) + - MaterialComponents/private/ThumbTrack (= 13.0.0) + - MaterialComponents/private/Color (13.0.0) + - MaterialComponents/private/Icons (13.0.0): + - MaterialComponents/private/Icons/Base (= 13.0.0) + - MaterialComponents/private/Icons/ic_arrow_back (= 13.0.0) + - MaterialComponents/private/Icons/ic_check (= 13.0.0) + - MaterialComponents/private/Icons/ic_check_circle (= 13.0.0) + - MaterialComponents/private/Icons/ic_chevron_right (= 13.0.0) + - MaterialComponents/private/Icons/ic_info (= 13.0.0) + - MaterialComponents/private/Icons/ic_radio_button_unchecked (= 13.0.0) + - MaterialComponents/private/Icons/ic_reorder (= 13.0.0) + - MaterialComponents/private/Icons/Base (13.0.0) + - MaterialComponents/private/Icons/ic_arrow_back (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_check (12.2.0): + - MaterialComponents/private/Icons/ic_check (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_check_circle (12.2.0): + - MaterialComponents/private/Icons/ic_check_circle (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_chevron_right (12.2.0): + - MaterialComponents/private/Icons/ic_chevron_right (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_info (12.2.0): + - MaterialComponents/private/Icons/ic_info (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_radio_button_unchecked (12.2.0): + - MaterialComponents/private/Icons/ic_radio_button_unchecked (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_reorder (12.2.0): + - MaterialComponents/private/Icons/ic_reorder (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/KeyboardWatcher (12.2.0) - - MaterialComponents/private/Overlay (12.2.0) - - MaterialComponents/private/RTL (12.2.0) - - MaterialComponents/private/ThumbTrack (12.2.0): + - MaterialComponents/private/KeyboardWatcher (13.0.0) + - MaterialComponents/private/Overlay (13.0.0) + - MaterialComponents/private/RTL (13.0.0) + - MaterialComponents/private/ThumbTrack (13.0.0): - MaterialComponents/Ink - MaterialComponents/private/Color - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - - MaterialComponents/ProgressView (12.2.0): + - MaterialComponents/ProgressView (13.0.0): - MaterialComponents/private/RTL - - MaterialComponents/RobotoFontLoader (12.2.0): + - MaterialComponents/RobotoFontLoader (13.0.0): - MaterialComponents/FontDiskLoader - MaterialComponents/Typography - - MaterialComponents/ShadowElevations (12.2.0) - - MaterialComponents/ShadowLayer (12.2.0) - - MaterialComponents/Slider (12.2.0): + - MaterialComponents/ShadowElevations (13.0.0) + - MaterialComponents/ShadowLayer (13.0.0) + - MaterialComponents/Slider (13.0.0): - MaterialComponents/private/ThumbTrack - - MaterialComponents/Snackbar (12.2.0): + - MaterialComponents/Snackbar (13.0.0): - MaterialComponents/Buttons - MaterialComponents/OverlayWindow - MaterialComponents/private/KeyboardWatcher - MaterialComponents/private/Overlay - - MaterialComponents/SpritedAnimationView (12.2.0) - - MaterialComponents/Switch (12.2.0): + - MaterialComponents/SpritedAnimationView (13.0.0) + - MaterialComponents/Switch (13.0.0): - MaterialComponents/private/ThumbTrack - - MaterialComponents/Typography (12.2.0) - - MaterialComponentsCatalog (12.2.0): + - MaterialComponents/Typography (13.0.0) + - MaterialComponentsCatalog (13.0.0): - MaterialComponents - - MaterialComponentsUnitTests (12.2.0): + - MaterialComponentsUnitTests (13.0.0): - MaterialComponents DEPENDENCIES: @@ -159,9 +159,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: CatalogByConvention: 0e471a53b232b83be30141379b3ff0ad3365c3ec - MaterialComponents: dc641f565bbf36b134427bf24fea1e02016d657c - MaterialComponentsCatalog: 2b5f51302ffd2b444b5ec1f3cf6097d9377944d8 - MaterialComponentsUnitTests: '0288b5f4d98079b22c62ad04072875ebc44c7769' + MaterialComponents: d25237e4b011014b9fe91baecf4d0bd48319aaa0 + MaterialComponentsCatalog: 2591186abea9c87ad6e3c6aac76684b870c0fc94 + MaterialComponentsUnitTests: a3a6ba266630b82c9e5f85481f0aa451b496d81f PODFILE CHECKSUM: 309489cdb2727f360a2446856fc0dbe264a2bf36 diff --git a/components/ActivityIndicator/examples/supplemental/ActivityIndicatorExampleSupplemental.h b/components/ActivityIndicator/examples/supplemental/ActivityIndicatorExampleSupplemental.h index b0d2762dc28..194290f58d7 100644 --- a/components/ActivityIndicator/examples/supplemental/ActivityIndicatorExampleSupplemental.h +++ b/components/ActivityIndicator/examples/supplemental/ActivityIndicatorExampleSupplemental.h @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/ActivityIndicator/examples/supplemental/ActivityIndicatorExampleSupplemental.m b/components/ActivityIndicator/examples/supplemental/ActivityIndicatorExampleSupplemental.m index 2f7243bb43d..4b919289f51 100644 --- a/components/ActivityIndicator/examples/supplemental/ActivityIndicatorExampleSupplemental.m +++ b/components/ActivityIndicator/examples/supplemental/ActivityIndicatorExampleSupplemental.m @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/ActivityIndicator/src/MDCActivityIndicator.h b/components/ActivityIndicator/src/MDCActivityIndicator.h index 6f21c7c6f59..2f6221caaf6 100644 --- a/components/ActivityIndicator/src/MDCActivityIndicator.h +++ b/components/ActivityIndicator/src/MDCActivityIndicator.h @@ -34,12 +34,12 @@ typedef NS_ENUM(NSInteger, MDCActivityIndicatorMode) { }; /** - A Material Design activity indicator. + A material design activity indicator. The activity indicator is a circular spinner that shows progress of an operation. By default the activity indicator assumes indeterminate progress of an unspecified length of time. In contrast to a standard UIActivityIndicator, MDCActivityIndicator supports showing determinate progress and uses - custom Material Design animation for indeterminate progress. + custom material design animation for indeterminate progress. See https://www.google.com/design/spec/components/progress-activity.html */ diff --git a/components/AppBar/README.md b/components/AppBar/README.md index 27619dd6404..a17bc5baa3f 100644 --- a/components/AppBar/README.md +++ b/components/AppBar/README.md @@ -2,7 +2,7 @@ title: "App Bar" layout: detail section: components -excerpt: "The App Bar is a flexible navigation bar designed to provide a typical Material Design navigation experience." +excerpt: "The App Bar is a flexible navigation bar designed to provide a typical material design navigation experience." --- # App Bar diff --git a/components/AppBar/examples/AppBarTypicalUseExample.m b/components/AppBar/examples/AppBarTypicalUseExample.m index 460b261f9fa..f2bacbf9bd6 100644 --- a/components/AppBar/examples/AppBarTypicalUseExample.m +++ b/components/AppBar/examples/AppBarTypicalUseExample.m @@ -100,7 +100,7 @@ + (NSArray *)catalogBreadcrumbs { } + (NSString *)catalogDescription { - return @"The App Bar is a flexible navigation bar designed to provide a typical Material Design" + return @"The App Bar is a flexible navigation bar designed to provide a typical material design" " navigation experience."; } diff --git a/components/AppBar/src/MDCAppBar.m b/components/AppBar/src/MDCAppBar.m index a3e33567eef..d575517d2d3 100644 --- a/components/AppBar/src/MDCAppBar.m +++ b/components/AppBar/src/MDCAppBar.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCAppBar.h" #import "MDCAppBarContainerViewController.h" diff --git a/components/AppBar/src/MDCAppBarContainerViewController.m b/components/AppBar/src/MDCAppBarContainerViewController.m index 5e079939bfd..6f1a4f9b846 100644 --- a/components/AppBar/src/MDCAppBarContainerViewController.m +++ b/components/AppBar/src/MDCAppBarContainerViewController.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCAppBarContainerViewController.h" #import "MDCAppBar.h" diff --git a/components/ButtonBar/src/MDCButtonBar.m b/components/ButtonBar/src/MDCButtonBar.m index 4f021a4b376..af21f51530b 100644 --- a/components/ButtonBar/src/MDCButtonBar.m +++ b/components/ButtonBar/src/MDCButtonBar.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCButtonBar.h" #import "MDCButton.h" diff --git a/components/ButtonBar/src/private/MDCAppBarButtonBarBuilder.m b/components/ButtonBar/src/private/MDCAppBarButtonBarBuilder.m index f73d8d57d4c..2e4b9d2ffd9 100644 --- a/components/ButtonBar/src/private/MDCAppBarButtonBarBuilder.m +++ b/components/ButtonBar/src/private/MDCAppBarButtonBarBuilder.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCAppBarButtonBarBuilder.h" #import "MDCButtonBar+Private.h" diff --git a/components/Buttons/README.md b/components/Buttons/README.md index c898a8b07e4..6792a213cb2 100644 --- a/components/Buttons/README.md +++ b/components/Buttons/README.md @@ -2,7 +2,7 @@ title: "Buttons" layout: detail section: components -excerpt: "Buttons is a collection of Material Design buttons, including a flat button, a raised button and a floating action button." +excerpt: "Buttons is a collection of material design buttons, including a flat button, a raised button and a floating action button." --- # Buttons @@ -11,7 +11,7 @@ excerpt: "Buttons is a collection of Material Design buttons, including a flat b [![Buttons](docs/assets/buttons.png)](docs/assets/buttons.mp4) -Buttons is a collection of Material Design buttons, including a flat button, a raised button and a +Buttons is a collection of material design buttons, including a flat button, a raised button and a floating action button. diff --git a/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.h b/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.h index 1541578fe2e..c951a94bf76 100644 --- a/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.h +++ b/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.h @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.m b/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.m index b9aac446406..1cb21a18004 100644 --- a/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.m +++ b/components/Buttons/examples/supplemental/ButtonsTypicalUseSupplemental.m @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import @@ -18,7 +18,7 @@ + (NSArray *)catalogBreadcrumbs { } + (NSString *)catalogDescription { - return @"Buttons is a collection of Material Design buttons, including a flat button, a raised" + return @"Buttons is a collection of material design buttons, including a flat button, a raised" " button and a floating action button."; } diff --git a/components/Buttons/src/MDCButton.m b/components/Buttons/src/MDCButton.m index 036eb11504b..838f150c61d 100644 --- a/components/Buttons/src/MDCButton.m +++ b/components/Buttons/src/MDCButton.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCButton.h" #import "MaterialInk.h" diff --git a/components/Buttons/src/MDCFlatButton.m b/components/Buttons/src/MDCFlatButton.m index d2979aa954d..db93916d9f4 100644 --- a/components/Buttons/src/MDCFlatButton.m +++ b/components/Buttons/src/MDCFlatButton.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCFlatButton.h" #import "private/MDCButton+Subclassing.h" diff --git a/components/Buttons/src/MDCFloatingButton.m b/components/Buttons/src/MDCFloatingButton.m index c47f42c9505..36657737793 100644 --- a/components/Buttons/src/MDCFloatingButton.m +++ b/components/Buttons/src/MDCFloatingButton.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCFloatingButton.h" #import "MaterialShadowElevations.h" diff --git a/components/Buttons/src/MDCRaisedButton.m b/components/Buttons/src/MDCRaisedButton.m index 14e38686699..04cfb21ff8d 100644 --- a/components/Buttons/src/MDCRaisedButton.m +++ b/components/Buttons/src/MDCRaisedButton.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCRaisedButton.h" #import "MaterialShadowElevations.h" diff --git a/components/CollectionCells/examples/CollectionCellsLayoutExample.m b/components/CollectionCells/examples/CollectionCellsLayoutExample.m index bac9880f5cc..033838b56f5 100644 --- a/components/CollectionCells/examples/CollectionCellsLayoutExample.m +++ b/components/CollectionCells/examples/CollectionCellsLayoutExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionCellsLayoutExample.h" #import "MaterialSwitch.h" @@ -121,6 +117,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView if (indexPath.item == 0) { // Add switch as accessory view. MDCSwitch *editingSwitch = [[MDCSwitch alloc] initWithFrame:CGRectZero]; + editingSwitch.on = self.editor.isEditing; [editingSwitch addTarget:self action:@selector(didSwitch:) forControlEvents:UIControlEventValueChanged]; diff --git a/components/CollectionCells/examples/CollectionCellsTextExample.m b/components/CollectionCells/examples/CollectionCellsTextExample.m index bdf533026f7..8f1c0cef0e5 100644 --- a/components/CollectionCells/examples/CollectionCellsTextExample.m +++ b/components/CollectionCells/examples/CollectionCellsTextExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionCellsTextExample.h" #import "MaterialTypography.h" diff --git a/components/CollectionCells/src/MDCCollectionViewCell+Ink.m b/components/CollectionCells/src/MDCCollectionViewCell+Ink.m index b969d1d7349..bc19d7f7b50 100644 --- a/components/CollectionCells/src/MDCCollectionViewCell+Ink.m +++ b/components/CollectionCells/src/MDCCollectionViewCell+Ink.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionViewCell+Ink.h" #import diff --git a/components/CollectionCells/src/MDCCollectionViewCell.m b/components/CollectionCells/src/MDCCollectionViewCell.m index 6a0cccbb8bd..704d16009fa 100644 --- a/components/CollectionCells/src/MDCCollectionViewCell.m +++ b/components/CollectionCells/src/MDCCollectionViewCell.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionViewCell.h" #import "MaterialCollectionLayoutAttributes.h" @@ -54,6 +50,7 @@ @implementation MDCCollectionViewCell { MDCCollectionViewLayoutAttributes *_attr; BOOL _usesCellSeparatorHiddenOverride; BOOL _usesCellSeparatorInsetOverride; + BOOL _shouldAnimateEditingViews; CAShapeLayer *_separatorLayer; UIView *_separatorView; UIImageView *_backgroundImageView; @@ -92,7 +89,14 @@ - (void)commonMDCCollectionViewCellInit { - (void)prepareForReuse { [super prepareForReuse]; + // Accessory defaults. + _accessoryType = MDCCollectionViewCellAccessoryNone; + _accessoryInset = kAccessoryInsetDefault; + [_accessoryView removeFromSuperview]; + _accessoryView = nil; + // Reset properties. + _shouldAnimateEditingViews = NO; _usesCellSeparatorHiddenOverride = NO; _usesCellSeparatorInsetOverride = NO; _separatorView.hidden = YES; @@ -110,34 +114,44 @@ - (void)layoutSubviews { // Layout the accessory view and the content view. [self layoutForegroundSubviews]; + [self updateInterfaceForEditing]; + + void (^editingViewLayout)() = ^() { + CGFloat txReorderTransform; + CGFloat txSelectorTransform; + switch (self.mdc_effectiveUserInterfaceLayoutDirection) { + case UIUserInterfaceLayoutDirectionLeftToRight: + txReorderTransform = kEditingControlAppearanceOffset; + txSelectorTransform = -kEditingControlAppearanceOffset; + break; + case UIUserInterfaceLayoutDirectionRightToLeft: + txReorderTransform = -kEditingControlAppearanceOffset; + txSelectorTransform = kEditingControlAppearanceOffset; + break; + } + _editingReorderImageView.alpha = _attr.shouldShowReorderStateMask ? 1.0f : 0.0f; + _editingReorderImageView.transform = + _attr.shouldShowReorderStateMask ? CGAffineTransformMakeTranslation(txReorderTransform, 0) + : CGAffineTransformIdentity; + + _editingSelectorImageView.alpha = _attr.shouldShowSelectorStateMask ? 1.0f : 0.0f; + _editingSelectorImageView.transform = + _attr.shouldShowSelectorStateMask ? CGAffineTransformMakeTranslation(txSelectorTransform, 0) + : CGAffineTransformIdentity; + + _accessoryView.alpha = _attr.shouldShowSelectorStateMask ? 0.0f : 1.0f; + _accessoryInset.right = _attr.shouldShowSelectorStateMask + ? kAccessoryInsetDefault.right + kEditingControlAppearanceOffset + : kAccessoryInsetDefault.right; + }; + // Animate editing controls. - [UIView - animateWithDuration:0.3 - animations:^{ - CGFloat txReorderTransform; - CGFloat txSelectorTransform; - switch (self.mdc_effectiveUserInterfaceLayoutDirection) { - case UIUserInterfaceLayoutDirectionLeftToRight: - txReorderTransform = kEditingControlAppearanceOffset; - txSelectorTransform = -kEditingControlAppearanceOffset; - break; - case UIUserInterfaceLayoutDirectionRightToLeft: - txReorderTransform = -kEditingControlAppearanceOffset; - txSelectorTransform = kEditingControlAppearanceOffset; - break; - } - _editingReorderImageView.alpha = _attr.shouldShowReorderStateMask ? 1.0f : 0.0f; - _editingReorderImageView.transform = - _attr.shouldShowReorderStateMask - ? CGAffineTransformMakeTranslation(txReorderTransform, 0) - : CGAffineTransformIdentity; - - _editingSelectorImageView.alpha = _attr.shouldShowSelectorStateMask ? 1.0f : 0.0f; - _editingSelectorImageView.transform = - _attr.shouldShowSelectorStateMask - ? CGAffineTransformMakeTranslation(txSelectorTransform, 0) - : CGAffineTransformIdentity; - }]; + if (_shouldAnimateEditingViews) { + [UIView animateWithDuration:0.3 animations:editingViewLayout]; + _shouldAnimateEditingViews = NO; + } else { + [UIView performWithoutAnimation:editingViewLayout]; + } } - (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes { @@ -146,7 +160,9 @@ - (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttribut _attr = (MDCCollectionViewLayoutAttributes *)layoutAttributes; if (_attr.representedElementCategory == UICollectionElementCategoryCell) { - [self setEditing:_attr.editing]; + // Cells are often set to editing via layout attributes so we default to animating. + // This can be overridden by ensuring layoutSubviews is called inside a non-animation block. + [self setEditing:_attr.editing animated:YES]; } // Create image view to hold cell background image with shadowing. @@ -218,10 +234,13 @@ - (void)setAccessoryType:(MDCCollectionViewCellAccessoryType)accessoryType { } - (void)setAccessoryView:(UIView *)accessoryView { - if (!_accessoryView) { - [self addSubview:accessoryView]; + if (_accessoryView) { + [_accessoryView removeFromSuperview]; } _accessoryView = accessoryView; + if (_accessoryView) { + [self addSubview:_accessoryView]; + } } - (CGRect)accessoryFrame { @@ -293,6 +312,7 @@ - (void)setEditing:(BOOL)editing animated:(BOOL)animated { if (_editing == editing) { return; } + _shouldAnimateEditingViews = animated; _editing = editing; [self updateInterfaceForEditing]; } @@ -306,37 +326,48 @@ - (void)updateInterfaceForEditing { [CATransaction setDisableActions:YES]; // Create reorder editing controls. - if (_attr.shouldShowReorderStateMask && !_editingReorderImageView) { - UIImage *reorderImage = [UIImage imageWithContentsOfFile:[MDCIcons pathFor_ic_reorder]]; - reorderImage = [reorderImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - _editingReorderImageView = [[UIImageView alloc] initWithImage:reorderImage]; - _editingReorderImageView.tintColor = HEXCOLOR(kCellGrayColor); - _editingReorderImageView.alpha = 0.0f; - CGRect frame = (CGRect){{0, (CGRectGetHeight(self.bounds) - reorderImage.size.height) / 2}, - reorderImage.size}; - _editingReorderImageView.autoresizingMask = - MDCAutoresizingFlexibleTrailingMargin(self.mdc_effectiveUserInterfaceLayoutDirection); + if (_attr.shouldShowReorderStateMask) { + if (!_editingReorderImageView) { + UIImage *reorderImage = [UIImage imageWithContentsOfFile:[MDCIcons pathFor_ic_reorder]]; + reorderImage = [reorderImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + _editingReorderImageView = [[UIImageView alloc] initWithImage:reorderImage]; + _editingReorderImageView.tintColor = HEXCOLOR(kCellGrayColor); + _editingReorderImageView.autoresizingMask = + MDCAutoresizingFlexibleTrailingMargin(self.mdc_effectiveUserInterfaceLayoutDirection); + [self addSubview:_editingReorderImageView]; + } + CGAffineTransform transform = _editingReorderImageView.transform; + _editingReorderImageView.transform = CGAffineTransformIdentity; + CGSize size = _editingReorderImageView.image.size; + CGRect frame = (CGRect){{0, (CGRectGetHeight(self.bounds) - size.height) / 2}, size}; _editingReorderImageView.frame = MDCRectFlippedForRTL( frame, CGRectGetWidth(self.bounds), self.mdc_effectiveUserInterfaceLayoutDirection); - [self addSubview:_editingReorderImageView]; + _editingReorderImageView.transform = transform; + _editingReorderImageView.alpha = 0.0f; } // Create selector editing controls. - if (_attr.shouldShowSelectorStateMask && !_editingSelectorImageView) { - UIImage *selectorImage = - [UIImage imageWithContentsOfFile:[MDCIcons pathFor_ic_radio_button_unchecked]]; - selectorImage = [selectorImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - _editingSelectorImageView = [[UIImageView alloc] initWithImage:selectorImage]; - _editingSelectorImageView.tintColor = HEXCOLOR(kCellGrayColor); - _editingSelectorImageView.alpha = 0.0f; - CGFloat originX = CGRectGetWidth(self.bounds) - selectorImage.size.width; - CGFloat originY = (CGRectGetHeight(self.bounds) - selectorImage.size.height) / 2; - CGRect frame = (CGRect){{originX, originY}, selectorImage.size}; - _editingSelectorImageView.autoresizingMask = - MDCAutoresizingFlexibleLeadingMargin(self.mdc_effectiveUserInterfaceLayoutDirection); + if (_attr.shouldShowSelectorStateMask) { + if (!_editingSelectorImageView) { + UIImage *selectorImage = + [UIImage imageWithContentsOfFile:[MDCIcons pathFor_ic_radio_button_unchecked]]; + selectorImage = [selectorImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + _editingSelectorImageView = [[UIImageView alloc] initWithImage:selectorImage]; + _editingSelectorImageView.tintColor = HEXCOLOR(kCellGrayColor); + _editingSelectorImageView.autoresizingMask = + MDCAutoresizingFlexibleLeadingMargin(self.mdc_effectiveUserInterfaceLayoutDirection); + [self addSubview:_editingSelectorImageView]; + } + CGAffineTransform transform = _editingSelectorImageView.transform; + _editingSelectorImageView.transform = CGAffineTransformIdentity; + CGSize size = _editingSelectorImageView.image.size; + CGFloat originX = CGRectGetWidth(self.bounds) - size.width; + CGFloat originY = (CGRectGetHeight(self.bounds) - size.height) / 2; + CGRect frame = (CGRect){{originX, originY}, size}; _editingSelectorImageView.frame = MDCRectFlippedForRTL( frame, CGRectGetWidth(self.bounds), self.mdc_effectiveUserInterfaceLayoutDirection); - [self addSubview:_editingSelectorImageView]; + _editingSelectorImageView.transform = transform; + _editingSelectorImageView.alpha = 0.0f; } [CATransaction commit]; } diff --git a/components/CollectionCells/src/MDCCollectionViewTextCell.m b/components/CollectionCells/src/MDCCollectionViewTextCell.m index 6e6d6927a3d..021dc258f1e 100644 --- a/components/CollectionCells/src/MDCCollectionViewTextCell.m +++ b/components/CollectionCells/src/MDCCollectionViewTextCell.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionViewTextCell.h" #import "MaterialRTL.h" @@ -113,8 +109,9 @@ - (void)commonMDCCollectionViewTextCellInit { #pragma mark - Layout - (void)prepareForReuse { + _imageView.image = nil; + [super prepareForReuse]; - [self setNeedsLayout]; } - (void)layoutSubviews { diff --git a/components/CollectionLayoutAttributes/src/MDCCollectionViewLayoutAttributes.m b/components/CollectionLayoutAttributes/src/MDCCollectionViewLayoutAttributes.m index e684eed575e..2168be30f95 100644 --- a/components/CollectionLayoutAttributes/src/MDCCollectionViewLayoutAttributes.m +++ b/components/CollectionLayoutAttributes/src/MDCCollectionViewLayoutAttributes.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionViewLayoutAttributes.h" @implementation MDCCollectionViewLayoutAttributes diff --git a/components/Collections/README.md b/components/Collections/README.md index 97afe1e3318..87a6dec8aeb 100644 --- a/components/Collections/README.md +++ b/components/Collections/README.md @@ -59,7 +59,7 @@ pod install ## Overview The Collections component consists of a set of collection view related classes that adhere to -Material Design layout and styling. Typically you will subclass the `MDCCollectionViewController`, +material design layout and styling. Typically you will subclass the `MDCCollectionViewController`, which in turn subclasses `UICollectionViewController`. This controller provides the collection view used as its content. diff --git a/components/Collections/examples/CollectionsALaCarteExample.m b/components/Collections/examples/CollectionsALaCarteExample.m index f640a4bccdf..eb1f0665aaa 100644 --- a/components/Collections/examples/CollectionsALaCarteExample.m +++ b/components/Collections/examples/CollectionsALaCarteExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsALaCarteExample.h" #import "MaterialTypography.h" diff --git a/components/Collections/examples/CollectionsAppearanceAnimationExample.m b/components/Collections/examples/CollectionsAppearanceAnimationExample.m index 9f438945986..143b7924673 100644 --- a/components/Collections/examples/CollectionsAppearanceAnimationExample.m +++ b/components/Collections/examples/CollectionsAppearanceAnimationExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsAppearanceAnimationExample.h" #import "MaterialTypography.h" diff --git a/components/Collections/examples/CollectionsCellAccessoryExample.m b/components/Collections/examples/CollectionsCellAccessoryExample.m index 750cfcc8b42..0b59e5766d7 100644 --- a/components/Collections/examples/CollectionsCellAccessoryExample.m +++ b/components/Collections/examples/CollectionsCellAccessoryExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsCellAccessoryExample.h" #import "MaterialSwitch.h" diff --git a/components/Collections/examples/CollectionsCellColorExample.m b/components/Collections/examples/CollectionsCellColorExample.m index 6889b876e95..b361e647e94 100644 --- a/components/Collections/examples/CollectionsCellColorExample.m +++ b/components/Collections/examples/CollectionsCellColorExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsCellColorExample.h" static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; diff --git a/components/Collections/examples/CollectionsCellSeparatorExample.m b/components/Collections/examples/CollectionsCellSeparatorExample.m index 555f923e853..de9ef3279ee 100644 --- a/components/Collections/examples/CollectionsCellSeparatorExample.m +++ b/components/Collections/examples/CollectionsCellSeparatorExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsCellSeparatorExample.h" static const NSInteger kSectionCount = 10; diff --git a/components/Collections/examples/CollectionsContainerExample.m b/components/Collections/examples/CollectionsContainerExample.m index ba88e2d60c2..2d62c648edd 100644 --- a/components/Collections/examples/CollectionsContainerExample.m +++ b/components/Collections/examples/CollectionsContainerExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsContainerExample.h" #import "MaterialCollections.h" diff --git a/components/Collections/examples/CollectionsEditingExample.m b/components/Collections/examples/CollectionsEditingExample.m index 4b304ed472f..76c9df68796 100644 --- a/components/Collections/examples/CollectionsEditingExample.m +++ b/components/Collections/examples/CollectionsEditingExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsEditingExample.h" static const NSInteger kSectionCount = 10; diff --git a/components/Collections/examples/CollectionsGridExample.m b/components/Collections/examples/CollectionsGridExample.m index 8423de29f35..70a78a5ad63 100644 --- a/components/Collections/examples/CollectionsGridExample.m +++ b/components/Collections/examples/CollectionsGridExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsGridExample.h" static const NSInteger kSectionCount = 10; diff --git a/components/Collections/examples/CollectionsHeaderFooterExample.m b/components/Collections/examples/CollectionsHeaderFooterExample.m index 768f2d84534..9a2dfd32161 100644 --- a/components/Collections/examples/CollectionsHeaderFooterExample.m +++ b/components/Collections/examples/CollectionsHeaderFooterExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsHeaderFooterExample.h" #import "MaterialTypography.h" diff --git a/components/Collections/examples/CollectionsInkExample.m b/components/Collections/examples/CollectionsInkExample.m index eca8ba42a30..8cae9573660 100644 --- a/components/Collections/examples/CollectionsInkExample.m +++ b/components/Collections/examples/CollectionsInkExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsInkExample.h" static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; diff --git a/components/Collections/examples/CollectionsInlayExample.m b/components/Collections/examples/CollectionsInlayExample.m index 023aeb2ed93..1b658d575bd 100644 --- a/components/Collections/examples/CollectionsInlayExample.m +++ b/components/Collections/examples/CollectionsInlayExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsInlayExample.h" static NSString *const kReusableIdentifierItem = @"itemCellIdentifier"; diff --git a/components/Collections/examples/CollectionsSimpleDemo.m b/components/Collections/examples/CollectionsSimpleDemo.m index 94b5e734077..e50dd71788a 100644 --- a/components/Collections/examples/CollectionsSimpleDemo.m +++ b/components/Collections/examples/CollectionsSimpleDemo.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsSimpleDemo.h" #import "MaterialTypography.h" diff --git a/components/Collections/examples/CollectionsStoryboardExample.m b/components/Collections/examples/CollectionsStoryboardExample.m index 306d7af4509..fbd107aee60 100644 --- a/components/Collections/examples/CollectionsStoryboardExample.m +++ b/components/Collections/examples/CollectionsStoryboardExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsStoryboardExample.h" static const NSInteger kSectionCount = 10; diff --git a/components/Collections/examples/CollectionsSwipeToDismissRowExample.m b/components/Collections/examples/CollectionsSwipeToDismissRowExample.m index 45ca4b6547a..21466d86598 100644 --- a/components/Collections/examples/CollectionsSwipeToDismissRowExample.m +++ b/components/Collections/examples/CollectionsSwipeToDismissRowExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsSwipeToDismissRowExample.h" static const NSInteger kSectionCount = 10; diff --git a/components/Collections/examples/CollectionsSwipeToDismissSectionExample.m b/components/Collections/examples/CollectionsSwipeToDismissSectionExample.m index 75832ed51bc..6da0fe149a2 100644 --- a/components/Collections/examples/CollectionsSwipeToDismissSectionExample.m +++ b/components/Collections/examples/CollectionsSwipeToDismissSectionExample.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "CollectionsSwipeToDismissSectionExample.h" static const NSInteger kSectionCount = 10; diff --git a/components/Collections/src/MDCCollectionViewController.m b/components/Collections/src/MDCCollectionViewController.m index 94484022efa..7a75dbad452 100644 --- a/components/Collections/src/MDCCollectionViewController.m +++ b/components/Collections/src/MDCCollectionViewController.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionViewController.h" #import "MDCCollectionViewFlowLayout.h" @@ -45,37 +41,30 @@ @implementation MDCCollectionViewController { @synthesize collectionViewLayout = _collectionViewLayout; +- (instancetype)init { + return [self initWithCollectionViewLayout:self.collectionViewLayout]; +} + - (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout { self = [super initWithCollectionViewLayout:layout]; if (self) { - [self commonMDCCollectionViewControllerInit:layout]; + _collectionViewLayout = layout; } return self; } - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - self = [super initWithCollectionViewLayout:self.collectionViewLayout]; - if (self) { - [self commonMDCCollectionViewControllerInit:self.collectionViewLayout]; - } - return self; + return [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; } - (instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCollectionViewLayout:self.collectionViewLayout]; - if (self) { - [self commonMDCCollectionViewControllerInit:self.collectionViewLayout]; - } - return self; -} - -- (void)commonMDCCollectionViewControllerInit:(UICollectionViewLayout *)layout { - _collectionViewLayout = layout; + return [super initWithCoder:aDecoder]; } - (void)viewDidLoad { [super viewDidLoad]; + [self.collectionView setCollectionViewLayout:self.collectionViewLayout]; self.collectionView.backgroundColor = [UIColor whiteColor]; self.collectionView.alwaysBounceVertical = YES; diff --git a/components/Collections/src/MDCCollectionViewFlowLayout.m b/components/Collections/src/MDCCollectionViewFlowLayout.m index 55cccd39989..d20d711f9b8 100644 --- a/components/Collections/src/MDCCollectionViewFlowLayout.m +++ b/components/Collections/src/MDCCollectionViewFlowLayout.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionViewFlowLayout.h" #import "MDCCollectionViewController.h" diff --git a/components/Collections/src/private/MDCCollectionGridBackgroundView.m b/components/Collections/src/private/MDCCollectionGridBackgroundView.m index 12e3ec3fa46..2f275e3f100 100644 --- a/components/Collections/src/private/MDCCollectionGridBackgroundView.m +++ b/components/Collections/src/private/MDCCollectionGridBackgroundView.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionGridBackgroundView.h" #import "MaterialCollectionLayoutAttributes.h" diff --git a/components/Collections/src/private/MDCCollectionInfoBarView.m b/components/Collections/src/private/MDCCollectionInfoBarView.m index 37cd0e6ba4c..b3a3f3358ea 100644 --- a/components/Collections/src/private/MDCCollectionInfoBarView.m +++ b/components/Collections/src/private/MDCCollectionInfoBarView.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionInfoBarView.h" #import "MaterialShadowLayer.h" diff --git a/components/Collections/src/private/MDCCollectionStringResources.m b/components/Collections/src/private/MDCCollectionStringResources.m index bc9c4068a45..5dbb5265f0a 100644 --- a/components/Collections/src/private/MDCCollectionStringResources.m +++ b/components/Collections/src/private/MDCCollectionStringResources.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionStringResources.h" #import "MaterialCollectionsStrings.h" diff --git a/components/Collections/src/private/MDCCollectionViewEditor.m b/components/Collections/src/private/MDCCollectionViewEditor.m index 05d02d13a26..83e1cf0b14d 100644 --- a/components/Collections/src/private/MDCCollectionViewEditor.m +++ b/components/Collections/src/private/MDCCollectionViewEditor.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionViewEditor.h" #import "MDCCollectionViewEditingDelegate.h" @@ -437,15 +433,14 @@ - (void)panToReorderWithRecognizer:(UIPanGestureRecognizer *)recognizer { [_delegate collectionView:_collectionView willMoveItemAtIndexPath:previousIndexPath toIndexPath:newIndexPath]; + } - // Notify delegate item did move. - if ([_delegate respondsToSelector:@selector(collectionView: - didMoveItemAtIndexPath: - toIndexPath:)]) { - [_delegate collectionView:_collectionView - didMoveItemAtIndexPath:previousIndexPath - toIndexPath:newIndexPath]; - } + // Notify delegate item did move. + if ([_delegate + respondsToSelector:@selector(collectionView:didMoveItemAtIndexPath:toIndexPath:)]) { + [_delegate collectionView:_collectionView + didMoveItemAtIndexPath:previousIndexPath + toIndexPath:newIndexPath]; } } else { // Exit if delegate will not allow this indexPath to move. diff --git a/components/Collections/src/private/MDCCollectionViewStyler.m b/components/Collections/src/private/MDCCollectionViewStyler.m index daf495d2a2c..8b8daac7a67 100644 --- a/components/Collections/src/private/MDCCollectionViewStyler.m +++ b/components/Collections/src/private/MDCCollectionViewStyler.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCCollectionViewStyler.h" #import "MDCCollectionViewStylingDelegate.h" diff --git a/components/Dialogs/README.md b/components/Dialogs/README.md index bc5502e2f2a..a21b938cedc 100644 --- a/components/Dialogs/README.md +++ b/components/Dialogs/README.md @@ -2,13 +2,13 @@ title: "Dialogs" layout: detail section: components -excerpt: "The Dialogs component implements the Material Design specifications for modal presentations." +excerpt: "The Dialogs component implements the material design specifications for modal presentations." --- # Dialogs Dialogs provides a presentation controller that will display a modal dialog according to the -material spec. +material spec. Additionally, an alert controller is provided that will display a simple alert. ### Material Design Specifications @@ -20,13 +20,18 @@ material spec. #### Dialogs Presentation Controller and Transition Controller -Dialogs is comprised of two classes: MDCDialogPresentationController and +Presenting dialogs utilizes two classes: MDCDialogPresentationController and MDCDialogTransitionController. These allow the presentation of view controllers in a material specificed manner. MDCDialogPresentationController is a subclass of UIPresentationController that observes the presented view controller for preferred content size. MDCDialogTransitionController implements UIViewControllerAnimatedTransitioning and UIViewControllerTransitioningDelegate to vend the presentation controller during the transition. +#### Alert Controller + +MDCAlertController provides a simple interface for developers to present a simple modal dialog +according to the material spec. + ## Installation ### Requirements @@ -107,3 +112,38 @@ modalDialogViewController.transitioningDelegate = dialogTransitionController presentViewController(myDialogViewController animated:YES ...) ~~~ + +### Present an alert + +#### Objective-C + +~~~ objc +// Present a modal alert +MDCAlertController *alertController = + [MDCAlertController alertControllerWithTitle:titleString + message:messageString] + +MDCAlertAction *alertAction = + [MDCAlertAction actionWithTitle:@"OK" + handler:^(MDCAlertAction *action) + { + NSLog(@"OK"); + }]; + +[alertController addAction:alertAction]; + +[self presentViewController:alertController animated:YES completion:NULL]; + +~~~ + +#### Swift + +~~~ swift +// Present a modal alert +let alertController = MDCAlertController(title: titleString, message: messageString) +let action = MDCAlertAction(title:"OK") { (action) in print("OK") } +alertController.addAction(action) + +self.presentViewController(alertController, animated:true, completion:nil) + +~~~ diff --git a/components/Dialogs/examples/DialogsAlertViewController.m b/components/Dialogs/examples/DialogsAlertViewController.m new file mode 100644 index 00000000000..4cb0063e2e4 --- /dev/null +++ b/components/Dialogs/examples/DialogsAlertViewController.m @@ -0,0 +1,73 @@ +/* + Copyright 2016-present Google Inc. 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. + */ + +#import "DialogsAlertViewControllerSupplemental.h" + +#import "MaterialButtons.h" +#import "MaterialDialogs.h" + +@implementation DialogsAlertViewController + +- (IBAction)didTapShowAlert:(id)sender { + NSString *titleString = @"Using material alert controller?"; + NSString *messageString = @"Be careful with modal alerts as they can be annoying if over-used."; + + MDCAlertController *materialAlertController = + [MDCAlertController alertControllerWithTitle:titleString message:messageString]; + + MDCAlertAction *agreeAaction = [MDCAlertAction actionWithTitle:@"AGREE" + handler:^(MDCAlertAction *action) { + NSLog(@"%@", @"AGREE pressed"); + }]; + [materialAlertController addAction:agreeAaction]; + + MDCAlertAction *disagreeAaction = [MDCAlertAction actionWithTitle:@"DISAGREE" + handler:^(MDCAlertAction *action) { + NSLog(@"%@", @"DISAGREE pressed"); + }]; + [materialAlertController addAction:disagreeAaction]; + + [self presentViewController:materialAlertController animated:YES completion:NULL]; +} + +- (IBAction)didTapShowLongAlert:(id)sender { + NSString *messageString = + @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur " + "ultricies diam libero, eget porta arcu feugiat sit amet. Maecenas placerat felis sed risus " + "maximus tempus. Integer feugiat, augue in pellentesque dictum, justo erat ultricies leo, " + "quis eleifend nisi eros dictum mi. In finibus vulputate eros, in luctus diam auctor in. " + "Aliquam fringilla neque at augue dictum iaculis. Etiam ac pellentesque lectus. Aenean " + "vestibulum, tortor nec cursus euismod, lectus tortor rhoncus massa, eu interdum lectus " + "urna " + "ut nulla. Phasellus elementum lorem sit amet sapien dictum, vel cursus est semper. Aenean " + "vel turpis maximus, accumsan dui quis, cursus turpis. Nunc a tincidunt nunc, ut tempus " + "libero. Morbi ut orci laoreet, luctus neque nec, rhoncus enim. Cras dui erat, blandit ac " + "malesuada vitae, fringilla ac ante. Nullam dui diam, condimentum vitae mi et, dictum " + "euismod libero. Aliquam commodo urna vitae massa convallis aliquet."; + + MDCAlertController *materialAlertController = + [MDCAlertController alertControllerWithTitle:nil message:messageString]; + + MDCAlertAction *action = [MDCAlertAction actionWithTitle:@"OK" + handler:^(MDCAlertAction *action) { + NSLog(@"%@", @"OK pressed"); + }]; + [materialAlertController addAction:action]; + + [self presentViewController:materialAlertController animated:YES completion:NULL]; +} + +@end diff --git a/components/Dialogs/examples/DialogsLongAlertViewController.swift b/components/Dialogs/examples/DialogsLongAlertViewController.swift new file mode 100644 index 00000000000..74012f973f2 --- /dev/null +++ b/components/Dialogs/examples/DialogsLongAlertViewController.swift @@ -0,0 +1,82 @@ +// +// DialogsLongAlertViewController.swift +// Pods +// +// Created by Ian Gordon on 7/19/16. +// +// + +import Foundation + +/* + Copyright 2016-present Google Inc. 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. + */ + +import Foundation +import MaterialComponents + +class DialogsLongAlertViewController: UIViewController { + + let flatButton = MDCFlatButton() + + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = UIColor.whiteColor(); + + flatButton.setTitle("PRESENT ALERT", forState: .Normal) + flatButton.setTitleColor(UIColor.blueColor(), forState: .Normal); + flatButton.sizeToFit() + flatButton.translatesAutoresizingMaskIntoConstraints = false + flatButton.addTarget(self, action: #selector(tap), forControlEvents: .TouchUpInside) + self.view.addSubview(flatButton) + + NSLayoutConstraint(item:flatButton, attribute:.CenterX, relatedBy:.Equal, toItem:self.view, attribute:.CenterX, multiplier:1.0, constant: 0.0).active = true + + NSLayoutConstraint(item:flatButton, attribute:.CenterY, relatedBy:.Equal, toItem:self.view, attribute:.CenterY, multiplier:1.0, constant: 0.0).active = true + } + + func tap(sender: AnyObject) { + let messageString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur " + + "ultricies diam libero, eget porta arcu feugiat sit amet. Maecenas placerat felis sed risus " + + "maximus tempus. Integer feugiat, augue in pellentesque dictum, justo erat ultricies leo, " + + "quis eleifend nisi eros dictum mi. In finibus vulputate eros, in luctus diam auctor in. " + + "Aliquam fringilla neque at augue dictum iaculis. Etiam ac pellentesque lectus. Aenean " + + "vestibulum, tortor nec cursus euismod, lectus tortor rhoncus massa, eu interdum lectus urna " + + "ut nulla. Phasellus elementum lorem sit amet sapien dictum, vel cursus est semper. Aenean " + + "vel turpis maximus, accumsan dui quis, cursus turpis. Nunc a tincidunt nunc, ut tempus " + + "libero. Morbi ut orci laoreet, luctus neque nec, rhoncus enim. Cras dui erat, blandit ac " + + "malesuada vitae, fringilla ac ante. Nullam dui diam, condimentum vitae mi et, dictum " + + "euismod libero. Aliquam commodo urna vitae massa convallis aliquet."; + + let materialAlertController = MDCAlertController(title: nil, message: messageString) + + let action = MDCAlertAction(title:"OK") { (action) in print("OK") } + + materialAlertController.addAction(action) + + self.presentViewController(materialAlertController, animated: true, completion: nil) + } +} + +// MARK: Catalog by convention +extension DialogsLongAlertViewController { + class func catalogBreadcrumbs() -> Array { + return [ "Dialogs", "Swift Alert Demo"] + } + class func catalogDescription() -> String { + return "Swift Alert Example" + } +} diff --git a/components/Dialogs/examples/resources/DialogsAlertViewController.storyboard b/components/Dialogs/examples/resources/DialogsAlertViewController.storyboard new file mode 100644 index 00000000000..1d02d3c67ef --- /dev/null +++ b/components/Dialogs/examples/resources/DialogsAlertViewController.storyboard @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/Dialogs/examples/supplemental/DialogsAlertViewControllerSupplemental.h b/components/Dialogs/examples/supplemental/DialogsAlertViewControllerSupplemental.h new file mode 100644 index 00000000000..32a99dd983f --- /dev/null +++ b/components/Dialogs/examples/supplemental/DialogsAlertViewControllerSupplemental.h @@ -0,0 +1,9 @@ +/* IMPORTANT: + This file contains supplemental code used to populate the demos with dummy data or instructions. + It is not necessary to import this file to implement any Material Design Components. + */ + +#import + +@interface DialogsAlertViewController : UIViewController +@end diff --git a/components/Dialogs/examples/supplemental/DialogsAlertViewControllerSupplemental.m b/components/Dialogs/examples/supplemental/DialogsAlertViewControllerSupplemental.m new file mode 100644 index 00000000000..4967d3174d8 --- /dev/null +++ b/components/Dialogs/examples/supplemental/DialogsAlertViewControllerSupplemental.m @@ -0,0 +1,33 @@ +/* IMPORTANT: + This file contains supplemental code used to populate the examples with dummy data and/or + instructions. It is not necessary to import this file to implement any Material Design Components. + */ + +#import + +#import "DialogsAlertViewControllerSupplemental.h" +#import "MaterialButtons.h" +#import "MaterialDialogs.h" +#import "MaterialTypography.h" + +#pragma mark - DialogsAlertViewController + +@implementation DialogsAlertViewController (CatalogByConvention) + ++ (NSArray *)catalogBreadcrumbs { + return @[ @"Dialogs", @"AlertController" ]; +} + ++ (NSString *)catalogDescription { + return @"Demonstrate material spec'd alert controllers."; +} + ++ (BOOL)catalogIsPrimaryDemo { + return NO; +} + ++ (NSString *)catalogStoryboardName { + return @"DialogsAlertViewController"; +} + +@end diff --git a/components/Dialogs/examples/supplemental/DialogsTypicalUseSupplemental.h b/components/Dialogs/examples/supplemental/DialogsTypicalUseSupplemental.h index f802112e5dc..dffddc4abd0 100644 --- a/components/Dialogs/examples/supplemental/DialogsTypicalUseSupplemental.h +++ b/components/Dialogs/examples/supplemental/DialogsTypicalUseSupplemental.h @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/Dialogs/examples/supplemental/DialogsTypicalUseSupplemental.m b/components/Dialogs/examples/supplemental/DialogsTypicalUseSupplemental.m index ca34f0b082e..2a614af3100 100644 --- a/components/Dialogs/examples/supplemental/DialogsTypicalUseSupplemental.m +++ b/components/Dialogs/examples/supplemental/DialogsTypicalUseSupplemental.m @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/Dialogs/src/MDCAlertController.h b/components/Dialogs/src/MDCAlertController.h new file mode 100644 index 00000000000..1c305750713 --- /dev/null +++ b/components/Dialogs/src/MDCAlertController.h @@ -0,0 +1,132 @@ +/* + Copyright 2016-present Google Inc. 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. + */ + +#import + +#if !defined(__IPHONE_8_0) || (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0) +#error "This component only supports iOS 8.0 and above." +#endif + +@class MDCAlertAction; + +/** + MDCAlertController displays an alert message to the user, similar to UIAlertController. + + https://material.google.com/components/dialogs.html + + MDCAlertController requires iOS 8 or later. + + MDCAlertController class is intended to be used as-is and does not support subclassing. The view + hierarchy for this class is private and must not be modified. + */ +@interface MDCAlertController : UIViewController + +/** + Convenience constructor to create and return a view controller for displaying an alert to the user. + + After creating the alert controller, add actions to the controller by calling -addAction. + + @note Most alerts don't need titles. Use only for high-risk situations. + + @param title The title of the alert. + @param message Descriptive text that summarizes a decision in a sentence of two. + @return An initialized MDCAlertController object. + */ ++ (nonnull instancetype)alertControllerWithTitle:(nullable NSString *)title + message:(nullable NSString *)message; + +/** Alert controllers must be created with alertControllerWithTitle:message: */ +- (nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil + bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE; + +/** Alert controllers must be created with alertControllerWithTitle:message: */ +- (nullable instancetype)initWithCoder:(nonnull NSCoder *)aDecoder NS_UNAVAILABLE; + +/** + Adds an action to the alert dialog. + + Actions are the possible reactions of the user to the presented alert. Actions are added as a + button at the bottom of the alert. Affirmative actions should be added before dismissive actions. + Action buttons will be laid out from right to left if possible or top to bottom depending on space. + + Material spec recommends alerts should not have more than two actions. + + @param action Will be added to the end of MDCAlertController.actions. + */ +- (void)addAction:(nonnull MDCAlertAction *)action; + +/** + The actions that the user can take in response to the alert. + + The order of the actions in the array matches the order in which they were added to the alert. + */ +@property(nonatomic, nonnull, readonly) NSArray *actions; + +// TODO(iangordon): Add support for preferredAction to match UIAlertController. +// TODO(iangordon): Consider adding support for UITextFields to match UIAlertController. + +/** + High level description of the alert or decision being made. + + Use title only for high-risk situations, such as the potential loss of connectivity. If used, + users should be able to understand the choices based on the title and button text alone. + */ +@property(nonatomic, nullable, copy) NSString *title; + +/** Descriptive text that summarizes a decision in a sentence of two. */ +@property(nonatomic, nullable, copy) NSString *message; + +/** MDCAlertController handles its own transitioning delegate. */ +- (void)setTransitioningDelegate:(_Nullable id)transitioningDelegate NS_UNAVAILABLE; + +/** MDCAlertController.modalPresentationStyle is always UIModalPresentationCustom. */ +- (void)setModalPresentationStyle:(UIModalPresentationStyle)modalPresentationStyle NS_UNAVAILABLE; + +@end + +/** + MDCActionHandler is a block that will be invoked when the action is selected. + */ +typedef void (^MDCActionHandler)(MDCAlertAction *_Nonnull action); + +/** + MDCAlertAction is passed to an MDCAlertController to add a button to the alert dialog. + */ +@interface MDCAlertAction : NSObject + +/** + Action alerts control the buttons that will be displayed on the bottom of an alert controller. + + @param title The title of the button shown on the alert dialog. + @param handler A block to execute when the user selects the action. + @return An initialized MDCActionAlert object. + */ ++ (nonnull instancetype)actionWithTitle:(nonnull NSString *)title + handler:(__nullable MDCActionHandler)handler; + +/** Alert actions must be created with actionWithTitle:handler: */ +- (nullable instancetype)init NS_UNAVAILABLE; + +/** + Title of the button shown on the alert dialog. + + Alert actions titles must be set in the actionWithTitle:handler: method. + */ +@property(nonatomic, nullable, readonly) NSString *title; + +// TODO(iangordon): Add support for enabled property to match UIAlertAction + +@end diff --git a/components/Dialogs/src/MDCAlertController.m b/components/Dialogs/src/MDCAlertController.m new file mode 100644 index 00000000000..d7c6111122f --- /dev/null +++ b/components/Dialogs/src/MDCAlertController.m @@ -0,0 +1,481 @@ +/* + Copyright 2016-present Google Inc. 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. + */ + +#import "MDCAlertController.h" + +#import "MDCDialogTransitionController.h" +#import "MaterialButtons.h" +#import "MaterialTypography.h" + +@interface MDCAlertAction () + +@property(nonatomic, nullable, copy) MDCActionHandler completionHandler; + +@end + +@implementation MDCAlertAction + ++ (instancetype)actionWithTitle:(nonnull NSString *)title + handler:(void (^__nullable)(MDCAlertAction *action))handler { + return [[MDCAlertAction alloc] initWithTitle:title handler:handler]; +} + +- (instancetype)initWithTitle:(nonnull NSString *)title + handler:(void (^__nullable)(MDCAlertAction *action))handler { + self = [super init]; + if (self) { + _title = [title copy]; + _completionHandler = [handler copy]; + } + return self; +} + +- (id)copyWithZone:(NSZone *)zone { + MDCAlertAction *action = [[self class] actionWithTitle:self.title handler:self.completionHandler]; + + return action; +} + +@end + +// https://material.google.com/components/dialogs.html#dialogs-specs +static const UIEdgeInsets MDCDialogContentInsets = {24.0, 24.0, 24.0, 24.0}; +static const CGFloat MDCDialogContentVerticalPadding = 20.0; + +static const UIEdgeInsets MDCDialogActionsInsets = {8.0, 8.0, 8.0, 8.0}; +static const CGFloat MDCDialogActionsHorizontalPadding = 8.0; +static const CGFloat MDCDialogActionsVerticalPadding = 8.0; +static const CGFloat MDCDialogActionButtonHeight = 36.0; +static const CGFloat MDCDialogActionButtonMinimumWidth = 48.0; + +@interface MDCAlertController () + +@property(nonatomic, nonnull, strong) NSMutableArray *actionButtons; + +@property(nonatomic, strong) UIScrollView *contentScrollView; +@property(nonatomic, strong) UIScrollView *actionsScrollView; + +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) UILabel *messageLabel; + +@property(nonatomic, getter=isVerticalActionsLayout) BOOL verticalActionsLayout; + +@property(nonatomic, strong) MDCDialogTransitionController *transitionController; + +- (nonnull instancetype)initWithTitle:(nullable NSString *)title + message:(nullable NSString *)message; + +@end + +@implementation MDCAlertController { + NSString *_alertTitle; + NSString *_message; + + NSMutableArray *_actions; + + CGSize _previousLayoutSize; +} + ++ (instancetype)alertControllerWithTitle:(nullable NSString *)alertTitle + message:(nullable NSString *)message { + MDCAlertController *alertController = + [[MDCAlertController alloc] initWithTitle:alertTitle message:message]; + + return alertController; +} + +- (nonnull instancetype)initWithTitle:(nullable NSString *)title + message:(nullable NSString *)message { + self = [super initWithNibName:nil bundle:nil]; + if (self) { + _alertTitle = [title copy]; + _message = [message copy]; + + _contentScrollView = [[UIScrollView alloc] initWithFrame:CGRectZero]; + _actionsScrollView = [[UIScrollView alloc] initWithFrame:CGRectZero]; + + _actions = [[NSMutableArray alloc] init]; + _actionButtons = [[NSMutableArray alloc] init]; + + _transitionController = [[MDCDialogTransitionController alloc] init]; + super.transitioningDelegate = _transitionController; + super.modalPresentationStyle = UIModalPresentationCustom; + } + return self; +} + +/* Disable setter. Always use internal transition controller */ +- (void)setTransitioningDelegate:(id)transitioningDelegate { + NSAssert(NO, @"MDCAlertController.transitioningDelegate cannot be changed."); + return; +} + +/* Disable setter. Always use custom presentation style */ +- (void)setModalPresentationStyle:(UIModalPresentationStyle)modalPresentationStyle { + NSAssert(NO, @"MDCAlertController.modalPresentationStyle cannot be changed."); + return; +} + +- (NSString *)title { + return _alertTitle; +} + +- (void)setTitle:(NSString *)title { + _alertTitle = [title copy]; + self.titleLabel.text = _alertTitle; + + self.preferredContentSize = [self calculatePreferredContentSizeForBounds:CGRectInfinite.size]; + + [self.view setNeedsLayout]; +} + +- (NSString *)message { + return _message; +} + +- (void)setMessage:(NSString *)message { + _message = [message copy]; + self.messageLabel.text = _message; + + self.preferredContentSize = [self calculatePreferredContentSizeForBounds:CGRectInfinite.size]; + + [self.view setNeedsLayout]; +} + +- (NSArray *)actions { + return [_actions copy]; +} + +- (void)addAction:(MDCAlertAction *)action { + [_actions addObject:[action copy]]; + + MDCFlatButton *actionButton = [[MDCFlatButton alloc] initWithFrame:CGRectZero]; + [actionButton setTitle:action.title forState:UIControlStateNormal]; + // TODO(iangordon): Determine default text color values for Normal and Disabled + [actionButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; + [actionButton sizeToFit]; + CGRect buttonRect = actionButton.bounds; + buttonRect.size.height = MAX(buttonRect.size.height, MDCDialogActionButtonHeight); + buttonRect.size.width = MAX(buttonRect.size.width, MDCDialogActionButtonMinimumWidth); + actionButton.frame = buttonRect; + [actionButton addTarget:self + action:@selector(actionButtonPressed:) + forControlEvents:UIControlEventTouchUpInside]; + [self.actionsScrollView addSubview:actionButton]; + + [self.actionButtons addObject:actionButton]; + + self.preferredContentSize = [self calculatePreferredContentSizeForBounds:CGRectInfinite.size]; + + [self.view setNeedsLayout]; +} + +- (void)actionButtonPressed:(id)sender { + NSInteger actionIndex = [self.actionButtons indexOfObject:sender]; + MDCAlertAction *action = self.actions[actionIndex]; + + if (action.completionHandler) { + action.completionHandler(action); + } + + [self.presentingViewController dismissViewControllerAnimated:YES completion:NULL]; +} + +#pragma mark - UIViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.view.backgroundColor = [UIColor whiteColor]; + + self.contentScrollView.backgroundColor = [UIColor whiteColor]; + [self.view addSubview:self.contentScrollView]; + + self.actionsScrollView.backgroundColor = [UIColor whiteColor]; + [self.view addSubview:self.actionsScrollView]; + + self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + self.titleLabel.numberOfLines = 0; + self.titleLabel.textAlignment = NSTextAlignmentNatural; + self.titleLabel.font = [MDCTypography titleFont]; + [self.contentScrollView addSubview:self.titleLabel]; + + self.messageLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + self.messageLabel.numberOfLines = 0; + self.messageLabel.textAlignment = NSTextAlignmentNatural; + self.messageLabel.font = [MDCTypography body1Font]; + [self.contentScrollView addSubview:self.messageLabel]; + + self.titleLabel.text = self.title; + self.messageLabel.text = self.message; + + CGSize idealSize = [self calculatePreferredContentSizeForBounds:CGRectInfinite.size]; + + self.preferredContentSize = idealSize; + _previousLayoutSize = CGSizeZero; + + [self.view setNeedsLayout]; +} + +- (void)viewWillLayoutSubviews { + [super viewWillLayoutSubviews]; + + const CGSize viewSize = self.view.bounds.size; + + // Recalculate preferredSize, which is based on width available, if the viewSize has changed. + if (viewSize.width != _previousLayoutSize.width || + viewSize.height != _previousLayoutSize.height) { + CGSize currentPreferredContentSize = self.preferredContentSize; + CGSize calculatedPreferredContentSize = [self calculatePreferredContentSizeForBounds:viewSize]; + + if (!CGSizeEqualToSize(currentPreferredContentSize, calculatedPreferredContentSize)) { + self.preferredContentSize = calculatedPreferredContentSize; + } + + _previousLayoutSize = viewSize; + } + + CGSize boundsSize = CGRectInfinite.size; + boundsSize.width = viewSize.width; + + // Content + CGSize contentSize = [self calculateContentSizeThatFitsWidth:boundsSize.width]; + + CGRect contentRect = CGRectZero; + contentRect.size.width = viewSize.width; + contentRect.size.height = contentSize.height; + + self.contentScrollView.contentSize = contentRect.size; + + // Place Content in contentScrollView + boundsSize.width = boundsSize.width - MDCDialogContentInsets.left - MDCDialogContentInsets.right; + CGSize titleSize = [self.titleLabel sizeThatFits:boundsSize]; + titleSize.width = boundsSize.width; + CGSize messageSize = [self.messageLabel sizeThatFits:boundsSize]; + messageSize.width = boundsSize.width; + boundsSize.width = boundsSize.width + MDCDialogContentInsets.left + MDCDialogContentInsets.right; + + CGFloat contentInternalVerticalPadding = 0.0; + if (0.0 < titleSize.height && 0.0 < messageSize.height) { + contentInternalVerticalPadding = MDCDialogContentVerticalPadding; + } + + CGRect titleFrame = CGRectMake(MDCDialogContentInsets.left, MDCDialogContentInsets.top, + titleSize.width, titleSize.height); + CGRect messageFrame = CGRectMake(MDCDialogContentInsets.left, + CGRectGetMaxY(titleFrame) + contentInternalVerticalPadding, + messageSize.width, messageSize.height); + + self.titleLabel.frame = titleFrame; + self.messageLabel.frame = messageFrame; + + // Actions + CGSize actionSize = [self calculateActionsSizeThatFitsWidth:boundsSize.width]; + const CGFloat horizontalActionHeight = + MDCDialogActionsInsets.top + MDCDialogActionButtonHeight + MDCDialogActionsInsets.bottom; + if (horizontalActionHeight < actionSize.height) { + self.verticalActionsLayout = YES; + } else { + self.verticalActionsLayout = NO; + } + + CGRect actionsFrame = CGRectZero; + actionsFrame.size.width = self.view.bounds.size.width; + if (0 < [self.actions count]) { + actionsFrame.size.height = actionSize.height; + } + self.actionsScrollView.contentSize = actionsFrame.size; + + // Place buttons in actionsScrollView + if (self.isVerticalActionsLayout) { + CGPoint buttonCenter; + buttonCenter.x = self.actionsScrollView.contentSize.width * 0.5f; + buttonCenter.y = self.actionsScrollView.contentSize.height - MDCDialogActionsInsets.bottom; + for (UIButton *button in self.actionButtons) { + CGRect buttonRect = button.frame; + + buttonCenter.y -= buttonRect.size.height * 0.5; + + button.center = buttonCenter; + + if (button != [self.actionButtons lastObject]) { + buttonCenter.y -= buttonRect.size.height * 0.5; + buttonCenter.y -= MDCDialogActionsVerticalPadding; + } + } + + // TODO RTL Support by mirroring button rects + } else { + CGPoint buttonOrigin = CGPointZero; + buttonOrigin.x = self.actionsScrollView.contentSize.width - MDCDialogActionsInsets.right; + buttonOrigin.y = MDCDialogActionsInsets.top; + for (UIButton *button in self.actionButtons) { + CGRect buttonRect = button.frame; + + buttonOrigin.x -= buttonRect.size.width; + buttonRect.origin = buttonOrigin; + + button.frame = buttonRect; + + if (button != [self.actionButtons lastObject]) { + buttonOrigin.x -= MDCDialogActionsHorizontalPadding; + } + } + } + + // Place scrollviews + CGRect contentScrollViewRect = CGRectZero; + contentScrollViewRect.size = self.contentScrollView.contentSize; + + CGRect actionsScrollViewRect = CGRectZero; + actionsScrollViewRect.size = self.actionsScrollView.contentSize; + + const CGFloat requestedHeight = + self.contentScrollView.contentSize.height + self.actionsScrollView.contentSize.height; + if (requestedHeight <= self.view.bounds.size.height) { + // Simple layout case : both content and actions fit on the screen at once + self.contentScrollView.frame = contentScrollViewRect; + + actionsScrollViewRect.origin.y = + self.view.bounds.size.height - actionsScrollViewRect.size.height; + self.actionsScrollView.frame = actionsScrollViewRect; + } else { + // Complex layout case : Split the space between the two scrollviews + CGFloat maxActionsHeight = self.view.bounds.size.height * 0.5f; + actionsScrollViewRect.size.height = MIN(maxActionsHeight, actionsScrollViewRect.size.height); + actionsScrollViewRect.origin.y = + self.view.bounds.size.height - actionsScrollViewRect.size.height; + self.actionsScrollView.frame = actionsScrollViewRect; + + contentScrollViewRect.size.height = + self.view.bounds.size.height - actionsScrollViewRect.size.height; + self.contentScrollView.frame = contentScrollViewRect; + } +} + +- (void)viewWillTransitionToSize:(CGSize)size + withTransitionCoordinator:(id)coordinator { + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + + [coordinator animateAlongsideTransition:^( + id _Nonnull context) { + // Reset preferredContentSize on viewWIllTransition to take advantage of additional width + self.preferredContentSize = [self calculatePreferredContentSizeForBounds:CGRectInfinite.size]; + } + completion:nil]; +} + +#pragma mark - Internal + +// @param boundingWidth should not include any internal margins or padding +- (CGSize)calculateContentSizeThatFitsWidth:(CGFloat)boundingWidth { + CGSize boundsSize = CGRectInfinite.size; + boundsSize.width = boundingWidth - MDCDialogContentInsets.left - MDCDialogContentInsets.right; + + CGSize titleSize = [self.titleLabel sizeThatFits:boundsSize]; + CGSize messageSize = [self.messageLabel sizeThatFits:boundsSize]; + + CGFloat contentWidth = MAX(titleSize.width, messageSize.width); + contentWidth += MDCDialogContentInsets.left + MDCDialogContentInsets.right; + + CGFloat contentInternalVerticalPadding = 0.0; + if (0.0 < titleSize.height && 0.0 < messageSize.height) { + contentInternalVerticalPadding = MDCDialogContentVerticalPadding; + } + CGFloat contentHeight = titleSize.height + contentInternalVerticalPadding + messageSize.height; + contentHeight += MDCDialogContentInsets.top + MDCDialogContentInsets.bottom; + + CGSize contentSize; + contentSize.width = (CGFloat)ceil(contentWidth); + contentSize.height = (CGFloat)ceil(contentHeight); + + return contentSize; +} + +// @param boundingWidth should not include any internal margins or padding +- (CGSize)calculateActionsSizeThatFitsWidth:(CGFloat)boundingWidth { + CGSize boundsSize = CGRectInfinite.size; + boundsSize.width = boundingWidth; + + CGSize horizontalSize = [self actionButtonsSizeInHorizontalLayout]; + CGSize verticalSize = [self actionButtonsSizeInVericalLayout]; + + CGSize actionsSize; + if (boundsSize.width < horizontalSize.width) { + // Use VerticalLayout + actionsSize.width = MIN(verticalSize.width, boundsSize.width); + actionsSize.height = MIN(verticalSize.height, boundsSize.height); + } else { + // Use HorizontalLayout + actionsSize.width = MIN(horizontalSize.width, boundsSize.width); + actionsSize.height = MIN(horizontalSize.height, boundsSize.height); + } + + actionsSize.width = (CGFloat)ceil(actionsSize.width); + actionsSize.height = (CGFloat)ceil(actionsSize.height); + + return actionsSize; +} + +// @param boundsSize should not include any internal margins or padding +- (CGSize)calculatePreferredContentSizeForBounds:(CGSize)boundsSize { + // Content & Actions + CGSize contentSize = [self calculateContentSizeThatFitsWidth:boundsSize.width]; + CGSize actionSize = [self calculateActionsSizeThatFitsWidth:boundsSize.width]; + + // Final Sizing + CGSize totalSize; + totalSize.width = MAX(contentSize.width, actionSize.width); + totalSize.height = contentSize.height + actionSize.height; + + return totalSize; +} + +- (CGSize)actionButtonsSizeInHorizontalLayout { + CGSize size = CGSizeZero; + if (0 < [self.actions count]) { + size.height = + MDCDialogActionsInsets.top + MDCDialogActionButtonHeight + MDCDialogActionsInsets.bottom; + size.width = MDCDialogActionsInsets.left + MDCDialogActionsInsets.right; + for (UIButton *button in self.actionButtons) { + size.width += button.bounds.size.width; + if (button != [self.actionButtons lastObject]) { + size.width += MDCDialogActionsHorizontalPadding; + } + } + } + + return size; +} + +- (CGSize)actionButtonsSizeInVericalLayout { + CGSize size = CGSizeZero; + if (0 < [self.actions count]) { + size.height = MDCDialogActionsInsets.top + MDCDialogActionsInsets.bottom; + size.width = MDCDialogActionsInsets.left + MDCDialogActionsInsets.right; + for (UIButton *button in self.actionButtons) { + size.height += button.bounds.size.height; + size.width = MAX(size.width, button.bounds.size.width); + if (button != [self.actionButtons lastObject]) { + size.height += MDCDialogActionsVerticalPadding; + } + } + } + + return size; +} + +@end diff --git a/components/Dialogs/src/MDCDialogPresentationController.m b/components/Dialogs/src/MDCDialogPresentationController.m index a7d5ff58757..8f905dfe846 100644 --- a/components/Dialogs/src/MDCDialogPresentationController.m +++ b/components/Dialogs/src/MDCDialogPresentationController.m @@ -250,30 +250,6 @@ - (void)dismiss:(UIGestureRecognizer *)gesture { #pragma mark - Keyboard handling -// Convert UIViewAnimationCurve to UIViewAnimationOptions -// TODO(iangordon): Move to MDCKeyboardWatcher -static UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCurve animationCurve) { - switch (animationCurve) { - case UIViewAnimationCurveEaseInOut: - return UIViewAnimationOptionCurveEaseInOut; - case UIViewAnimationCurveEaseIn: - return UIViewAnimationOptionCurveEaseIn; - case UIViewAnimationCurveEaseOut: - return UIViewAnimationOptionCurveEaseOut; - case UIViewAnimationCurveLinear: - return UIViewAnimationOptionCurveLinear; - default: - // HACK: - // UIKeyboardWillChangeFrameNotification can happen with a curve of 7 which is not currently - // defined in UIViewAnimationCurve - if ((NSInteger)animationCurve != 7) { - NSLog(@"Unknown UIViewAnimationCurve : %ld", (long)animationCurve); - } - // animationCurve << 16 may an be acceptable workaround - return UIViewAnimationOptionCurveEaseInOut; - } -} - - (void)registerKeyboardNotifications { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWatcherHandler:) @@ -312,13 +288,11 @@ - (void)unregisterKeyboardNotifications { #pragma mark - KeyboardWatcher Notifications - (void)keyboardWatcherHandler:(NSNotification *)aNotification { - NSNumber *animationDurationNumber = - aNotification.userInfo[UIKeyboardAnimationDurationUserInfoKey]; - NSTimeInterval animationDuration = (NSTimeInterval)[animationDurationNumber doubleValue]; + NSTimeInterval animationDuration = + [MDCKeyboardWatcher animationDurationFromKeyboardNotification:aNotification]; - NSNumber *animationCurveNumber = aNotification.userInfo[UIKeyboardAnimationCurveUserInfoKey]; - UIViewAnimationCurve animationCurve = (UIViewAnimationCurve)[animationCurveNumber integerValue]; - UIViewAnimationOptions animationCurveOption = animationOptionsWithCurve(animationCurve); + UIViewAnimationOptions animationCurveOption = + [MDCKeyboardWatcher animationCurveOptionFromKeyboardNotification:aNotification]; [UIView animateWithDuration:animationDuration delay:0.0f diff --git a/components/Dialogs/src/MaterialDialogs.h b/components/Dialogs/src/MaterialDialogs.h index b4d401cb1a9..a919f99f53e 100644 --- a/components/Dialogs/src/MaterialDialogs.h +++ b/components/Dialogs/src/MaterialDialogs.h @@ -14,5 +14,6 @@ limitations under the License. */ +#import "MDCAlertController.h" #import "MDCDialogPresentationController.h" #import "MDCDialogTransitionController.h" diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorControlItem.h b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorControlItem.h index 33c2571498b..bb952692777 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorControlItem.h +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorControlItem.h @@ -16,7 +16,7 @@ /** IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorControlItem.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorControlItem.m index 333393ece19..5d5dc80918a 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorControlItem.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorControlItem.m @@ -16,7 +16,7 @@ /** IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import "FlexibleHeaderConfiguratorControlItem.h" diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.h b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.h index 7cd1b8df819..e1fda93b214 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.h +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.h @@ -16,7 +16,7 @@ /** IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.m index 77500599bbb..580ee7bb9a5 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderConfiguratorSupplemental.m @@ -16,7 +16,7 @@ /** IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import "FlexibleHeaderConfiguratorSupplemental.h" diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.h b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.h index c8a418fb630..30afcf96277 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.h +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.h @@ -16,7 +16,7 @@ /** IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.m index 2ffcd2485cc..45dd1676f3e 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderHorizontalPagingSupplemental.m @@ -16,7 +16,7 @@ /** IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import "FlexibleHeaderHorizontalPagingSupplemental.h" diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.h b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.h index ff4ee71bb61..14512293f58 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.h +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.h @@ -16,7 +16,7 @@ /** IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.m b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.m index 12756308bb3..5205d9c5ade 100644 --- a/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.m +++ b/components/FlexibleHeader/examples/supplemental/FlexibleHeaderTypicalUseSupplemental.m @@ -16,7 +16,7 @@ /** IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m b/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m index e8edf72439a..e95c7c714df 100644 --- a/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m +++ b/components/FlexibleHeader/src/MDCFlexibleHeaderContainerViewController.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCFlexibleHeaderContainerViewController.h" #import "MDCFlexibleHeaderView.h" diff --git a/components/FlexibleHeader/src/MDCFlexibleHeaderView.m b/components/FlexibleHeader/src/MDCFlexibleHeaderView.m index dd2676d22c9..44bf9ce3159 100644 --- a/components/FlexibleHeader/src/MDCFlexibleHeaderView.m +++ b/components/FlexibleHeader/src/MDCFlexibleHeaderView.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCFlexibleHeaderView.h" #import "private/MDCStatusBarShifter.h" @@ -157,6 +153,7 @@ - (instancetype)initWithFrame:(CGRect)frame { if (self) { _statusBarShifter = [[MDCStatusBarShifter alloc] init]; _statusBarShifter.delegate = self; + _statusBarShifter.enabled = [self fhv_shouldAllowShifting]; NSPointerFunctionsOptions options = (NSPointerFunctionsWeakMemory | NSPointerFunctionsObjectPointerPersonality); diff --git a/components/FlexibleHeader/src/MDCFlexibleHeaderViewController.m b/components/FlexibleHeader/src/MDCFlexibleHeaderViewController.m index a331499f303..44d6d54dae5 100644 --- a/components/FlexibleHeader/src/MDCFlexibleHeaderViewController.m +++ b/components/FlexibleHeader/src/MDCFlexibleHeaderViewController.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCFlexibleHeaderViewController.h" #import "MDCFlexibleHeaderContainerViewController.h" diff --git a/components/FlexibleHeader/src/private/MDCStatusBarShifter.m b/components/FlexibleHeader/src/private/MDCStatusBarShifter.m index 9228b3dd2bb..bcfcc7e65c6 100644 --- a/components/FlexibleHeader/src/private/MDCStatusBarShifter.m +++ b/components/FlexibleHeader/src/private/MDCStatusBarShifter.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCStatusBarShifter.h" static CGFloat kStatusBarExpectedHeight = 20; diff --git a/components/HeaderStackView/examples/supplemental/HeaderStackViewTypicalUseSupplemental.h b/components/HeaderStackView/examples/supplemental/HeaderStackViewTypicalUseSupplemental.h index 7dc4ca50ae5..414a2d04a3e 100644 --- a/components/HeaderStackView/examples/supplemental/HeaderStackViewTypicalUseSupplemental.h +++ b/components/HeaderStackView/examples/supplemental/HeaderStackViewTypicalUseSupplemental.h @@ -14,7 +14,7 @@ limitations under the License. */ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/HeaderStackView/examples/supplemental/HeaderStackViewTypicalUseSupplemental.m b/components/HeaderStackView/examples/supplemental/HeaderStackViewTypicalUseSupplemental.m index 0037576fe76..2b0378b48b9 100644 --- a/components/HeaderStackView/examples/supplemental/HeaderStackViewTypicalUseSupplemental.m +++ b/components/HeaderStackView/examples/supplemental/HeaderStackViewTypicalUseSupplemental.m @@ -14,7 +14,7 @@ */ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/HeaderStackView/src/MDCHeaderStackView.m b/components/HeaderStackView/src/MDCHeaderStackView.m index 119892c44ac..14a6ad7a1dc 100644 --- a/components/HeaderStackView/src/MDCHeaderStackView.m +++ b/components/HeaderStackView/src/MDCHeaderStackView.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCHeaderStackView.h" @implementation MDCHeaderStackView diff --git a/components/Ink/examples/supplemental/InkTypicalUseSupplemental.h b/components/Ink/examples/supplemental/InkTypicalUseSupplemental.h index f8acf8d3e00..036d9103cfb 100644 --- a/components/Ink/examples/supplemental/InkTypicalUseSupplemental.h +++ b/components/Ink/examples/supplemental/InkTypicalUseSupplemental.h @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/Ink/examples/supplemental/InkTypicalUseSupplemental.m b/components/Ink/examples/supplemental/InkTypicalUseSupplemental.m index a2ed7b96b5d..8c5b587ff9a 100644 --- a/components/Ink/examples/supplemental/InkTypicalUseSupplemental.m +++ b/components/Ink/examples/supplemental/InkTypicalUseSupplemental.m @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/Ink/src/private/MDCInkLayer.m b/components/Ink/src/private/MDCInkLayer.m index 44210af284d..1fdd88541b5 100644 --- a/components/Ink/src/private/MDCInkLayer.m +++ b/components/Ink/src/private/MDCInkLayer.m @@ -230,12 +230,10 @@ - (void)exit { // Bounded ripples move slightly towards the center of the tap target. Unbounded ripples // move to the center of the tap target. - CGPoint startPoint = [[self.presentationLayer valueForKeyPath:kInkLayerPosition] CGPointValue]; - CGFloat xOffset = self.targetFrame.origin.x - self.inkLayer.frame.origin.x; CGFloat yOffset = self.targetFrame.origin.y - self.inkLayer.frame.origin.y; - startPoint = CGPointMake(self.point.x + xOffset, self.point.y + yOffset); + CGPoint startPoint = CGPointMake(self.point.x + xOffset, self.point.y + yOffset); CGPoint endPoint = MDCInkLayerRectGetCenter(self.targetFrame); if (self.useCustomInkCenter) { endPoint = self.customInkCenter; diff --git a/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.h b/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.h index d55c7af8590..d82607a4b49 100644 --- a/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.h +++ b/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.h @@ -14,7 +14,7 @@ limitations under the License. */ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.m b/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.m index 210af80999b..7c52dc6a866 100644 --- a/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.m +++ b/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.m @@ -14,7 +14,7 @@ */ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.swift b/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.swift index 3c0e760d2d8..cdbcd5046eb 100644 --- a/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.swift +++ b/components/NavigationBar/examples/supplemental/NavigationBarTypicalUseExampleSupplemental.swift @@ -16,7 +16,7 @@ limitations under the License. /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or -instructions. It is not necessary to import this file to implement any Material Design Components. +instructions. It is not necessary to import this file to use Material Components iOS. */ import Foundation diff --git a/components/NavigationBar/src/MDCNavigationBar.m b/components/NavigationBar/src/MDCNavigationBar.m index 0b8495e2195..69aab33852b 100644 --- a/components/NavigationBar/src/MDCNavigationBar.m +++ b/components/NavigationBar/src/MDCNavigationBar.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCNavigationBar.h" #import "MaterialButtonBar.h" diff --git a/components/PageControl/README.md b/components/PageControl/README.md index eddb3b81910..f8e893926a9 100644 --- a/components/PageControl/README.md +++ b/components/PageControl/README.md @@ -2,7 +2,7 @@ title: "Page Control" layout: detail section: components -excerpt: "Page Control is a drop-in Material Design replacement for UIPageControl that implements Material Design animation and layout." +excerpt: "Page Control is a drop-in material design replacement for UIPageControl that implements material design animation and layout." --- # Page Control @@ -12,7 +12,7 @@ excerpt: "Page Control is a drop-in Material Design replacement for UIPageContro This control is designed to be a drop-in replacement for `UIPageControl`, with a user experience -influenced by Material Design specifications for animation and layout. The API methods are the +influenced by material design specifications for animation and layout. The API methods are the same as a `UIPageControl`, with the addition of a few key methods required to achieve the desired animation of the control. diff --git a/components/PageControl/examples/PageControlTypicalUseExample.m b/components/PageControl/examples/PageControlTypicalUseExample.m index 052d63f3e1e..f90ef1a3544 100644 --- a/components/PageControl/examples/PageControlTypicalUseExample.m +++ b/components/PageControl/examples/PageControlTypicalUseExample.m @@ -37,7 +37,7 @@ + (NSArray *)catalogBreadcrumbs { + (NSString *)catalogDescription { return @"This control is designed to be a drop-in replacement for UIPageControl, with a user" - " experience influenced by Material Design."; + " experience influenced by material design."; } + (BOOL)catalogIsPrimaryDemo { diff --git a/components/ProgressView/README.md b/components/ProgressView/README.md index 7443571392e..91b300c31ef 100644 --- a/components/ProgressView/README.md +++ b/components/ProgressView/README.md @@ -2,7 +2,7 @@ title: "Progress View" layout: detail section: components -excerpt: "Progress View is a determinate and linear progress indicator that implements Material Design animation and layout." +excerpt: "Progress View is a determinate and linear progress indicator that implements material design animation and layout." --- # Progress View @@ -12,7 +12,7 @@ excerpt: "Progress View is a determinate and linear progress indicator that impl This control is designed to be a drop-in replacement for `UIProgressView`, with a user experience -influenced by [Material Design specifications](https://material.google.com/components/progress-activity.html#) +influenced by [material design specifications](https://material.google.com/components/progress-activity.html#) for animation and layout. The API methods are the same as a `UIProgressView`, with the addition of a few key methods required to achieve the desired animation of the control. diff --git a/components/ProgressView/src/MDCProgressView.m b/components/ProgressView/src/MDCProgressView.m index eede04d796c..1cbd582832e 100644 --- a/components/ProgressView/src/MDCProgressView.m +++ b/components/ProgressView/src/MDCProgressView.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCProgressView.h" #import diff --git a/components/README.md b/components/README.md index a90cca5b046..fd5ad498804 100644 --- a/components/README.md +++ b/components/README.md @@ -8,7 +8,7 @@ section: components Material Components is a collection of standalone, production-quality user interface components for iOS. These components implement Google's -[Material Design](http://www.google.com/design/spec/material-design/introduction.html) specification +[material design](http://www.google.com/design/spec/material-design/introduction.html) specification and are developed by a team of iOS engineers and UX designers at Google. diff --git a/components/ShadowElevations/README.md b/components/ShadowElevations/README.md index f27b93218d7..73323c4eafa 100644 --- a/components/ShadowElevations/README.md +++ b/components/ShadowElevations/README.md @@ -2,11 +2,11 @@ title: "Shadow Elevations" layout: detail section: components -excerpt: "The Shadow Elevations component provides the most commonly-used Material Design elevations." +excerpt: "The Shadow Elevations component provides the most commonly-used material design elevations." --- # Shadow Elevations -This component provides the most commonly-used Material Design elevations. +This component provides the most commonly used material design elevations. ### Design Specifications diff --git a/components/ShadowLayer/README.md b/components/ShadowLayer/README.md index d01b5012da2..6ac2f7326b6 100644 --- a/components/ShadowLayer/README.md +++ b/components/ShadowLayer/README.md @@ -2,7 +2,7 @@ title: "Shadow Layer" layout: detail section: components -excerpt: "The Shadow Layer component implements the Material Design specifications for elevation and shadows." +excerpt: "The Shadow Layer component implements the material design specifications for elevation and shadows." --- # Shadow Layer @@ -12,7 +12,7 @@ excerpt: "The Shadow Layer component implements the Material Design specificatio [![Shadow Layer](docs/assets/shadow.png)](docs/assets/shadow.mp4) -Shadow Layer implements the Material Design specifications for elevation and shadows. +Shadow Layer implements the material design specifications for elevation and shadows. By simulating the physical properties of paper, elevation and light source, shadows give visual depth to components. Shadow Layer provides an elevation property which affects a shadow's depth and strength, automatically handling shadow diffusion based on the shadow's @@ -36,7 +36,7 @@ This is enabled by default and the internal portion of the layer is cut out. ### MDCShadowMetrics `MDCShadowMetrics` is a series of properties used to set `MDCShadowLayer`. `MDCShadowLayer` consists -of two distinct layers. The overlay of these two layers generates a single Material Design +of two distinct layers. The overlay of these two layers generates a single material design shadow that adheres to defined height and light source principles. ### Design Specifications @@ -102,7 +102,7 @@ import MaterialComponents -Example of a custom button based on UIButton with Material Design shadows: +Example of a custom button based on UIButton with material design shadows: diff --git a/components/ShadowLayer/examples/ShadowDragSquareExampleViewController.swift b/components/ShadowLayer/examples/ShadowDragSquareExampleViewController.swift index fda804d2679..fe916944b1b 100644 --- a/components/ShadowLayer/examples/ShadowDragSquareExampleViewController.swift +++ b/components/ShadowLayer/examples/ShadowDragSquareExampleViewController.swift @@ -80,7 +80,7 @@ class ShadowDragSquareExampleViewController: UIViewController { } class func catalogDescription() -> String { - return "Shadow Layer implements the Material Design specifications for elevation and shadows." + return "Shadow Layer implements the material design specifications for elevation and shadows." } class func catalogIsPrimaryDemo() -> Bool { diff --git a/components/ShadowLayer/src/MDCShadowLayer.h b/components/ShadowLayer/src/MDCShadowLayer.h index d266cbb256c..5abd2a3f4c5 100644 --- a/components/ShadowLayer/src/MDCShadowLayer.h +++ b/components/ShadowLayer/src/MDCShadowLayer.h @@ -59,7 +59,9 @@ /** The elevation of the layer in points. - The higher the elevation, the more spread out the shadow is. + The higher the elevation, the more spread out the shadow is. This is distinct from the layer's + zPosition which can be used to order overlapping layers, but will have no affect on the size of + the shadow. Negative values act as if zero were specified. */ diff --git a/components/Slider/README.md b/components/Slider/README.md index 32099c980db..5ce04e5cd9e 100644 --- a/components/Slider/README.md +++ b/components/Slider/README.md @@ -2,7 +2,7 @@ title: "Slider" layout: detail section: components -excerpt: "The Slider component provides a Material Design control for selecting a value from a continuous range or discrete set of values." +excerpt: "The Slider component provides a material design control for selecting a value from a continuous range or discrete set of values." --- # Slider @@ -11,7 +11,7 @@ excerpt: "The Slider component provides a Material Design control for selecting [![Slider](docs/assets/slider.png)](docs/assets/slider.mp4) -The `MDCSlider` object is a Material Design control used to select a value from a continuous range +The `MDCSlider` object is a material design control used to select a value from a continuous range or discrete set of values. diff --git a/components/Slider/examples/supplemental/SliderTypicalUseSupplemental.h b/components/Slider/examples/supplemental/SliderTypicalUseSupplemental.h index 48325c80348..473cc9a3c3f 100644 --- a/components/Slider/examples/supplemental/SliderTypicalUseSupplemental.h +++ b/components/Slider/examples/supplemental/SliderTypicalUseSupplemental.h @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/Slider/examples/supplemental/SliderTypicalUseSupplemental.m b/components/Slider/examples/supplemental/SliderTypicalUseSupplemental.m index 7278a1e0cb5..c3f235d5001 100644 --- a/components/Slider/examples/supplemental/SliderTypicalUseSupplemental.m +++ b/components/Slider/examples/supplemental/SliderTypicalUseSupplemental.m @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import @@ -18,7 +18,7 @@ + (NSArray *)catalogBreadcrumbs { } + (NSString *)catalogDescription { - return @"The MDCSlider object is a Material Design control used to select a value from a" + return @"The MDCSlider object is a material design control used to select a value from a" " continuous range or discrete set of values."; } diff --git a/components/Slider/src/MDCSlider.m b/components/Slider/src/MDCSlider.m index 704ee198c35..e0ee730da82 100644 --- a/components/Slider/src/MDCSlider.m +++ b/components/Slider/src/MDCSlider.m @@ -164,7 +164,9 @@ - (void)setEnabled:(BOOL)enabled { _thumbTrack.enabled = enabled; } -#pragma mark UIView methods +- (BOOL)isTracking { + return _thumbTrack.isTracking; +} - (CGSize)intrinsicContentSize { return CGSizeMake(kSliderDefaultWidth, kSliderFrameHeight); diff --git a/components/Snackbar/src/private/MDCSnackbarOverlayView.m b/components/Snackbar/src/private/MDCSnackbarOverlayView.m index ed33d95391b..86069c00b53 100644 --- a/components/Snackbar/src/private/MDCSnackbarOverlayView.m +++ b/components/Snackbar/src/private/MDCSnackbarOverlayView.m @@ -637,12 +637,12 @@ typedef NS_ENUM(NSUInteger, MDCAnimationTimingCurve) { MDCAnimationTimingCurveEaseOut = UIViewAnimationCurveEaseOut, MDCAnimationTimingCurveLinear = UIViewAnimationCurveLinear, - // Below are the interesting Material Design animation curves. + // Below are the interesting material design animation curves. /** - This is the most frequently used interpolation curve for Material Design animations. This curve + This is the most frequently used interpolation curve for material design animations. This curve is slow both at the beginning and end. It has similar characteristics to the system's EaseInOut. - This is known as FastOutSlowIn in the Material Design spec. + This is known as FastOutSlowIn in the material design spec. */ MDCAnimationTimingCurveQuantumEaseInOut, @@ -656,7 +656,7 @@ typedef NS_ENUM(NSUInteger, MDCAnimationTimingCurve) { /** This curve should be used for motion when exiting frame or when fading out to 0% opacity. This curve is slow at the beginning. It has similar characteristics to the system's EaseIn. This - is known as FastOutLinearIn in the Material Design spec. + is known as FastOutLinearIn in the material design spec. */ MDCAnimationTimingCurveQuantumEaseIn, diff --git a/components/SpritedAnimationView/README.md b/components/SpritedAnimationView/README.md index f930fdc9fa8..79f51e769bf 100644 --- a/components/SpritedAnimationView/README.md +++ b/components/SpritedAnimationView/README.md @@ -55,7 +55,7 @@ animation completes for each state, and be replaced with the other sprite image. ```objectivec // Animate the sprited view. -[_animationView startAnimatingWithCompletion:^{ +[_animationView startAnimatingWithCompletion:^(BOOL finished) { // When animation completes, toggle image. _toggle = !_toggle; @@ -97,7 +97,7 @@ animationView.tintColor = [UIColor blueColor]; [self.view addSubview:animationView]; // To Animate. -[animationView startAnimatingWithCompletion:^{ +[animationView startAnimatingWithCompletion:^(BOOL finished) { NSLog(@"Done animating."); }]; ``` diff --git a/components/SpritedAnimationView/examples/SpritedAnimationViewTypicalUseViewController.m b/components/SpritedAnimationView/examples/SpritedAnimationViewTypicalUseViewController.m index b4a664a3871..a80408d2a69 100644 --- a/components/SpritedAnimationView/examples/SpritedAnimationViewTypicalUseViewController.m +++ b/components/SpritedAnimationView/examples/SpritedAnimationViewTypicalUseViewController.m @@ -150,7 +150,7 @@ - (void)didTap:(UITapGestureRecognizer *)recognizer { recognizer.enabled = NO; // Animate the sprited view. - [_animationView startAnimatingWithCompletion:^{ + [_animationView startAnimatingWithCompletion:^(BOOL finished) { // When animation completes, toggle image. _toggle = !_toggle; diff --git a/components/SpritedAnimationView/src/MDCSpritedAnimationView.h b/components/SpritedAnimationView/src/MDCSpritedAnimationView.h index ca1ef8be21c..3586d336d40 100644 --- a/components/SpritedAnimationView/src/MDCSpritedAnimationView.h +++ b/components/SpritedAnimationView/src/MDCSpritedAnimationView.h @@ -82,7 +82,7 @@ @param completion Block called when transition completes. */ -- (void)startAnimatingWithCompletion:(nullable void (^)())completion; +- (void)startAnimatingWithCompletion:(nullable void (^)(BOOL finished))completion; /** Stop the animation. */ - (void)stop; diff --git a/components/SpritedAnimationView/src/MDCSpritedAnimationView.m b/components/SpritedAnimationView/src/MDCSpritedAnimationView.m index 611f7a83d56..6f66547b1fa 100644 --- a/components/SpritedAnimationView/src/MDCSpritedAnimationView.m +++ b/components/SpritedAnimationView/src/MDCSpritedAnimationView.m @@ -22,6 +22,7 @@ static const NSInteger kSpriteFrameRateDefault = 60; @interface MDCSpritedAnimationView () +@property(nonatomic, copy) void (^pendingCompletionBlock)(BOOL finished); @property(nonatomic, assign) NSInteger numberOfFrames; @property(nonatomic, assign) CGFloat singleFrameWidthInPercent; // 1 / numberOfFrames @property(nonatomic, strong) CALayer *spriteLayer; @@ -77,9 +78,10 @@ - (void)layoutSubviews { self.spriteLayer.bounds = self.bounds; } -- (void)startAnimatingWithCompletion:(void (^)())completion { - [CATransaction begin]; - [CATransaction setCompletionBlock:completion]; +- (void)startAnimatingWithCompletion:(void (^)(BOOL finished))completion { + [self stop]; + + self.pendingCompletionBlock = completion; NSMutableArray *linearValues = [NSMutableArray array]; NSMutableArray *keyTimes = [NSMutableArray array]; @@ -91,6 +93,7 @@ - (void)startAnimatingWithCompletion:(void (^)())completion { } CAKeyframeAnimation *animation = [CAKeyframeAnimation animation]; + animation.delegate = self; animation.duration = (NSTimeInterval)_numberOfFrames / (NSTimeInterval)_frameRate; animation.values = linearValues; animation.keyTimes = keyTimes; @@ -103,22 +106,37 @@ - (void)startAnimatingWithCompletion:(void (^)())completion { } [self.spriteLayer addAnimation:animation forKey:kSpriteAnimationKey]; - [CATransaction commit]; } - (void)stop { - // Removing the animation will cause the completion block to be also called. + // Removing the animation will trigger |animationDidStop| and therefore the completion block, but + // there is no guarantee it happens atomically so to ensure predictable call-order we manually + // trigger the completion block here. + void (^block)(BOOL cancelled) = self.pendingCompletionBlock; + self.pendingCompletionBlock = nil; + + if (block) { + block(NO); + } [self.spriteLayer removeAnimationForKey:kSpriteAnimationKey]; } - (void)seekToBeginning { + [self stop]; + [CATransaction begin]; + [CATransaction setDisableActions:YES]; self.spriteLayer.contentsRect = CGRectMake(0, 0, 1, _singleFrameWidthInPercent); + [CATransaction commit]; [self.spriteLayer setNeedsDisplay]; } - (void)seekToEnd { + [self stop]; + [CATransaction begin]; + [CATransaction setDisableActions:YES]; self.spriteLayer.contentsRect = CGRectMake(0, 1.0f - _singleFrameWidthInPercent, 1, _singleFrameWidthInPercent); + [CATransaction commit]; [self.layer setNeedsDisplay]; } @@ -166,13 +184,31 @@ - (void)updateSpriteAnimationLayer { CGSize spriteSheetSize = [_spriteSheetImage size]; CGFloat singleFrameWidth = spriteSheetSize.width; + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + // Disable implicit animations for these assignments CALayer *layer = self.spriteLayer; layer.contents = (id)_spriteSheetImage.CGImage; layer.bounds = CGRectMake(0, 0, singleFrameWidth, singleFrameWidth); layer.contentsRect = CGRectMake(0, 0, 1, _singleFrameWidthInPercent); + [CATransaction commit]; +} + +#pragma mark - CAAnimationDelegate + +- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished { + if (anim != [self.spriteLayer animationForKey:kSpriteAnimationKey]) { + return; + } + void (^block)(BOOL cancelled) = self.pendingCompletionBlock; + self.pendingCompletionBlock = nil; + + if (block) { + block(finished); + } } -#pragma mark Setters +#pragma mark - Setters - (void)setTintColor:(UIColor *)tintColor { if (_tintColor == tintColor) { @@ -186,6 +222,7 @@ - (void)setTintColor:(UIColor *)tintColor { } - (void)setSpriteSheetImage:(UIImage *)spriteSheetImage { + [self stop]; if (!spriteSheetImage) { _spriteSheetImage = spriteSheetImage; return; @@ -198,7 +235,6 @@ - (void)setSpriteSheetImage:(UIImage *)spriteSheetImage { _spriteSheetImage = [self colorizedSpriteSheet:spriteSheetImage]; [self invalidateIntrinsicContentSize]; [self updateSpriteAnimationLayer]; - [self.spriteLayer removeAllAnimations]; } @end diff --git a/components/SpritedAnimationView/tests/unit/SpritedAnimationViewTests.m b/components/SpritedAnimationView/tests/unit/SpritedAnimationViewTests.m index d46b45c9a17..eb53dcb1e5d 100644 --- a/components/SpritedAnimationView/tests/unit/SpritedAnimationViewTests.m +++ b/components/SpritedAnimationView/tests/unit/SpritedAnimationViewTests.m @@ -45,7 +45,7 @@ - (void)testAnimationCompletion { XCTestExpectation *expectation = [self expectationWithDescription:kExpectationDescription]; // Fulfill expectation after completion of animation. - [animationView startAnimatingWithCompletion:^{ + [animationView startAnimatingWithCompletion:^(BOOL completion) { [expectation fulfill]; }]; diff --git a/components/Switch/README.md b/components/Switch/README.md index d3f09618127..3763e939ab9 100644 --- a/components/Switch/README.md +++ b/components/Switch/README.md @@ -2,7 +2,7 @@ title: "Switch" layout: detail section: components -excerpt: "The Switch component provides an Material Design on/off switch control with an interface similar to UISwitch." +excerpt: "The Switch component provides an material design on/off switch control with an interface similar to UISwitch." --- # Switch @@ -12,7 +12,7 @@ excerpt: "The Switch component provides an Material Design on/off switch control [![Switch](docs/assets/switch.png)](docs/assets/switch.mp4) -Switch provides an Material Design on/off switch control with an interface similar to UISwitch. Note +Switch provides an material design on/off switch control with an interface similar to UISwitch. Note that `MDCSwitch` objects have an intrinsic size and are not resizable. diff --git a/components/Switch/examples/supplemental/SwitchSwiftExampleViewControllerSupplemental.swift b/components/Switch/examples/supplemental/SwitchSwiftExampleViewControllerSupplemental.swift index 023df401eac..88160f54426 100644 --- a/components/Switch/examples/supplemental/SwitchSwiftExampleViewControllerSupplemental.swift +++ b/components/Switch/examples/supplemental/SwitchSwiftExampleViewControllerSupplemental.swift @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ diff --git a/components/Switch/examples/supplemental/SwitchTypicalUseSupplemental.h b/components/Switch/examples/supplemental/SwitchTypicalUseSupplemental.h index 25d6681a12d..96f407512b0 100644 --- a/components/Switch/examples/supplemental/SwitchTypicalUseSupplemental.h +++ b/components/Switch/examples/supplemental/SwitchTypicalUseSupplemental.h @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the demos with dummy data or instructions. - It is not necessary to import this file to implement any Material Design Components. + It is not necessary to import this file to use Material Components iOS. */ #import diff --git a/components/Switch/examples/supplemental/SwitchTypicalUseSupplemental.m b/components/Switch/examples/supplemental/SwitchTypicalUseSupplemental.m index 2059152c55e..82cc9d4bf51 100644 --- a/components/Switch/examples/supplemental/SwitchTypicalUseSupplemental.m +++ b/components/Switch/examples/supplemental/SwitchTypicalUseSupplemental.m @@ -1,6 +1,6 @@ /* IMPORTANT: This file contains supplemental code used to populate the examples with dummy data and/or - instructions. It is not necessary to import this file to implement any Material Design Components. + instructions. It is not necessary to import this file to use Material Components iOS. */ #import @@ -18,7 +18,7 @@ + (NSArray *)catalogBreadcrumbs { } + (NSString *)catalogDescription { - return @"The MDCSlider object is a Material Design control used to select a value from a" + return @"The MDCSlider object is a material design control used to select a value from a" " continuous range or discrete set of values."; } diff --git a/components/Switch/src/MDCSwitch.m b/components/Switch/src/MDCSwitch.m index df5b499e13c..bf19bfc3045 100644 --- a/components/Switch/src/MDCSwitch.m +++ b/components/Switch/src/MDCSwitch.m @@ -278,6 +278,10 @@ - (void)thumbTrackValueChanged:(MDCThumbTrack *)thumbTrack { [self updateAccessibilityValues]; } +- (BOOL)isTracking { + return _thumbTrack.isTracking; +} + #pragma mark - Animation tracking - (void)thumbTrack:(MDCThumbTrack *)thumbTrack willAnimateToValue:(CGFloat)value { diff --git a/components/Typography/README.md b/components/Typography/README.md index abd0d3e6487..a06186894db 100644 --- a/components/Typography/README.md +++ b/components/Typography/README.md @@ -2,7 +2,7 @@ title: "Typography" layout: detail section: components -excerpt: "The Typography component provides methods for displaying text using the type sizes and opacities from the Material Design specifications." +excerpt: "The Typography component provides methods for displaying text using the type sizes and opacities from the material design specifications." --- # Typography @@ -12,7 +12,7 @@ excerpt: "The Typography component provides methods for displaying text using th The Typography component provides methods for displaying text using the type sizes and opacities -from the Material Design specifications. +from the material design specifications. ### Design Specifications @@ -73,20 +73,20 @@ import MaterialComponents ### Font Select a font most appropriate to its usage and set it as your label's font. All fonts are returned -from class methods beginning with the font's Material Design type style and ending with 'Font'. +from class methods beginning with the font's material design type style and ending with 'Font'. Material Typography should be used consistently throughout the entire UI. ### Opacity Each font has a respective opacity (alpha) value returned by class methods beginning with the -font's Material Design type style and ending with 'FontOpacity'. These CGFloats should be set on the +font's material design type style and ending with 'FontOpacity'. These CGFloats should be set on the label's alpha property. If animating alpha, it should be the maximum value reached. ## Type Sizes and Opacities `MDCTypography` provides a `UIFont` font and a `CGFloat` opacity for each of the standard type -settings in the Material Design specifications. +settings in the material design specifications. -### Material Design type styles and their respective `MDCTypography` methods +### Material design type styles and their respective `MDCTypography` methods | Material Design Type | MDCTypography Font | MDCTypography Opacity | | -------------------- | ------------------ | --------------------- | @@ -103,13 +103,13 @@ settings in the Material Design specifications. ### Font size reference -![Material Design Type Size](docs/assets/style_typography_styles_scale.png "Shows the Material Design font - sizes") +![Material Design Type Size](docs/assets/style_typography_styles_scale.png + "Shows the material design font sizes") ### Font opacity reference -![Material Design Type Opacity](docs/assets/style_typography_styles_contrast.png "Shows the Material Design font - opacities") +![Material Design Type Opacity](docs/assets/style_typography_styles_contrast.png + "Shows the material design font opacities") ## Examples diff --git a/components/Typography/examples/TypographyFontListExample.swift b/components/Typography/examples/TypographyFontListExample.swift index 2cb86750922..8b20abc436c 100644 --- a/components/Typography/examples/TypographyFontListExample.swift +++ b/components/Typography/examples/TypographyFontListExample.swift @@ -151,7 +151,7 @@ extension TypographyFontListExampleViewController { class func catalogDescription() -> String { return "The Typography component provides methods for displaying text using the type sizes and" - + " opacities from the Material Design specifications." + + " opacities from the material design specifications." } class func catalogIsPrimaryDemo() -> Bool { diff --git a/components/Typography/src/MDCTypography.m b/components/Typography/src/MDCTypography.m index 6eae7429f84..5758a1eee2a 100644 --- a/components/Typography/src/MDCTypography.m +++ b/components/Typography/src/MDCTypography.m @@ -14,10 +14,6 @@ limitations under the License. */ -#if !defined(__has_feature) || !__has_feature(objc_arc) -#error "This file requires ARC support." -#endif - #import "MDCTypography.h" static id sFontLoader = nil; diff --git a/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.h b/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.h index d207745f95a..af6fb9a27ff 100644 --- a/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.h +++ b/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.h @@ -37,6 +37,13 @@ OBJC_EXTERN NSString *const MDCKeyboardWatcherKeyboardWillChangeFrameNotificatio */ + (instancetype)sharedKeyboardWatcher; +/** Extract the animation duration from the keyboard notification */ ++ (NSTimeInterval)animationDurationFromKeyboardNotification:(NSNotification *)notification; + +/** Extract the animation curve option from the keyboard notification */ ++ (UIViewAnimationOptions)animationCurveOptionFromKeyboardNotification: + (NSNotification *)notification; + /** The distance from the top of the keyboard to the bottom of the screen. diff --git a/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.m b/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.m index 1d321f32c82..ffee6a17587 100644 --- a/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.m +++ b/components/private/KeyboardWatcher/src/MDCKeyboardWatcher.m @@ -177,6 +177,59 @@ - (CGFloat)keyboardOffset { return CGRectGetHeight(self.keyboardFrame); } ++ (NSTimeInterval)animationDurationFromKeyboardNotification:(NSNotification *)notification { + if (![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillShowNotification] && + ![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillHideNotification] && + ![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillChangeFrameNotification]) { + NSAssert(NO, @"Cannot extract the animation duration from a non-keyboard notification."); + + return 0.0; + } + + NSNumber *animationDurationNumber = notification.userInfo[UIKeyboardAnimationDurationUserInfoKey]; + NSTimeInterval animationDuration = (NSTimeInterval)[animationDurationNumber doubleValue]; + + return animationDuration; +} + +/** Convert UIViewAnimationCurve to UIViewAnimationOptions */ +static UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCurve animationCurve) { + switch (animationCurve) { + case UIViewAnimationCurveEaseInOut: + return UIViewAnimationOptionCurveEaseInOut; + case UIViewAnimationCurveEaseIn: + return UIViewAnimationOptionCurveEaseIn; + case UIViewAnimationCurveEaseOut: + return UIViewAnimationOptionCurveEaseOut; + case UIViewAnimationCurveLinear: + return UIViewAnimationOptionCurveLinear; + } + + // UIKit unpredictably returns values that aren't declared in UIViewAnimationCurve, so we can't + // assert here. + // UIKeyboardWillChangeFrameNotification can post with a curve of 7. + // Based on how UIViewAnimationOptions are defined in UIView.h, (animationCurve << 16) may an + // be acceptable return value for unrecognized curves. + return UIViewAnimationOptionCurveEaseInOut; +} + ++ (UIViewAnimationOptions)animationCurveOptionFromKeyboardNotification: + (NSNotification *)notification { + if (![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillShowNotification] && + ![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillHideNotification] && + ![notification.name isEqualToString:MDCKeyboardWatcherKeyboardWillChangeFrameNotification]) { + NSAssert(NO, @"Cannot extract the animation curve option from a non-keyboard notification."); + + return UIViewAnimationOptionCurveEaseInOut; + } + + NSNumber *animationCurveNumber = notification.userInfo[UIKeyboardAnimationCurveUserInfoKey]; + UIViewAnimationCurve animationCurve = (UIViewAnimationCurve)[animationCurveNumber integerValue]; + UIViewAnimationOptions animationCurveOption = animationOptionsWithCurve(animationCurve); + + return animationCurveOption; +} + #pragma mark - Notifications - (void)updateOffsetWithUserInfo:(NSDictionary *)userInfo diff --git a/components/private/ThumbTrack/src/MDCThumbTrack.m b/components/private/ThumbTrack/src/MDCThumbTrack.m index d579dc4950c..80b8d4a71de 100644 --- a/components/private/ThumbTrack/src/MDCThumbTrack.m +++ b/components/private/ThumbTrack/src/MDCThumbTrack.m @@ -999,6 +999,12 @@ - (void)sendDiscreteChangeAction { } } +#pragma mark - UIControl methods + +- (BOOL)isTracking { + return _isDraggingThumb; +} + #pragma mark - Private - (void)interruptAnimation { diff --git a/contributing/README.md b/contributing/README.md index 87062603d54..8c593fbf330 100644 --- a/contributing/README.md +++ b/contributing/README.md @@ -4,12 +4,14 @@ layout: landing section: contributing --- +Want to contribute? Great! First, read this page (including the [small print](#the-small-print)). + # Contributing Material Components for iOS is intended to be a full open source project that accepts contributions -from community members. We can work together to optimize Material Design on iOS. +from community members. We can work together to optimize material design on iOS. -- [Slack Channel](http://googleoss.slack.com) +- [Slack Channel](http://mdc-private.slack.com) - [GitHub Issues](https://github.com/google/material-components-ios/issues) @@ -25,9 +27,9 @@ from community members. We can work together to optimize Material Design on iOS. Members of the core team are engineers from Google, Inc. responsible for the strategic direction of Material Components and appointment of technical leaders from the community. The Core Team will -work with the community to accept contributions in line with the [Material Design +work with the community to accept contributions in line with the [material design spec](http://www.google.com/design/spec). You can reach members of the core team on our [Slack -discussion channel](http://googleoss.slack.com). +discussion channel](http://mdc-private.slack.com). - - - @@ -37,7 +39,7 @@ As contributors and maintainers of the project, we pledge to respect everyone wh through posting issues, updating documentation, submitting pull requests, providing feedback in comments and any other related activities. -Communication through any of our Material Design channels +Communication through any of our material design channels ([GitHub](http://github.com/google/material-components-ios), [Stack Overflow](http://stackoverflow.com/questions/tagged/material-components-ios), [Google+](http://plus.google.com/+googledesign), [Twitter](https://twitter.com/googledesign), etc.) @@ -98,10 +100,10 @@ _This code of conduct was adapted from the following sources:_ If you have questions about how to use Material Components for iOS: -- Please post questions to Stack Overflow with the tag `material-components-ios`. - Search previous questions that have been answered by visiting [Stack Overflow](http://stackoverflow.com/questions/tagged/material-components-ios). -- Join us on our [Slack discussion channel](https://googleoss.slack.com/messages/mdc-ios/) for more +- Please post questions to Stack Overflow with the tag `material-components-ios`. +- Join us on our [Slack discussion channel](https://mdc-private.slack.com/messages/mdc-ios/) for more direct discussions with the team. - - - @@ -110,7 +112,7 @@ If you have questions about how to use Material Components for iOS: If you find a bug in the source code or a mistake in the documentation, you can help us by [submitting an issue](https://github.com/google/material-components-ios/issues) to our GitHub -repository. Even better: submit a fix as a pull request! +repository. Even better: send a fix as a [pull request](https://github.com/google/material-components-ios/compare/)! - - - @@ -124,7 +126,8 @@ would like to implement a new feature then consider what kind of change it is: mailing list](https://groups.google.com/forum/#!forum/material-components-ios-discuss) so that we can better coordinate our efforts, prevent duplication of work, and help you to craft the change so that it is successfully accepted into the project. -- Small changes can be crafted and submitted to the GitHub Repository as a Pull Request. +- Small changes can be crafted and submitted to the GitHub Repository as a [pull request] +(https://github.com/google/material-components-ios/compare/). - - - @@ -144,8 +147,8 @@ issue being dealt with quickly: - Reproduction steps - was it just a one time error or can you show the steps to reproduce? - Related issues - has a similar issue been reported before? -Here is a great example of a well defined issue: -[https://github.com/angular/angular.js/issues/5069](https://github.com/angular/angular.js/issues/5069) +Here is a great example of a [well defined issue](https://github.com/angular/angular.js/issues/5069) +in angular.js. - - - @@ -154,14 +157,14 @@ Here is a great example of a well defined issue: Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code changes to be accepted, the CLA must be signed. It's a quick process, we promise! -- For individuals we have a [simple click-through - form](http://code.google.com/legal/individual-cla-v1.0.html). -- For corporations we'll need you to print, sign and one of scan+email, fax or mail [the form. - ](http://code.google.com/legal/corporate-cla-v1.0.html) +- For individuals we have a [simple click-through form] +(http://code.google.com/legal/individual-cla-v1.0.html). +- For corporations we'll need you to sign a different [agreement] +(http://code.google.com/legal/corporate-cla-v1.0.html). - - - -## Submitting a Pull Request +## Pull requests For major changes, it's worthwhile discussing the idea on our [mailing list](https://groups.google.com/forum/#!forum/material-components-ios-discuss)—that way you'll get @@ -170,10 +173,70 @@ is working on it. [Search our GitHub](https://github.com/google/material-compone issues to see if anyone has proposed the idea before, too. Feature requests and bug fixes should be tracked with issues, so file one early on and assign it to yourself. -Once you have code that is ready to share, please create a pull request against our [GitHub +### Tips for a good pull request + +Pull requests can be hard to review if they try to tackle too many things +at once. Phabricator's +"[Writing Reviewable Code](https://secure.phabricator.com/book/phabflavor/article/writing_reviewable_code/)" +provides a set of guidelines that help increase the likelihood of your +pull request getting merged. + +In short (slightly modified from the original article): + +- A pull request should be as small as possible, but no smaller. +- The smallest a pull request can be is a single cohesive idea: don't + make pull requests so small that they are meaningless on their own. +- Turn large pull requests into small pull requests by dividing large + problems into smaller problems and solving the small problems one at + a time. +- Write sensible pull request descriptions. + +Our additions: + +- A pull request should affect as few components as possible. +- Pull requests must include a modification to the CHANGELOG.md summarizing the + change. + +### Conventions + +This repository follows a file layout convention that ensures consistency and +predictability across all of our components. The conventions are described in +the [GOS-conventions](https://github.com/google/GOS-conventions) repository. + +### Before you contribute + +Before we can use your code, you must sign the +[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1) +(CLA), which you can do online. The CLA is necessary mainly because you own the +copyright to your changes, even after your contribution becomes part of our +codebase, so we need your permission to use and distribute your code. We also +need to be sure of various other things—for instance that you'll tell us if you +know that your code infringes on other people's patents. You don't have to sign +the CLA until after you've submitted your code for review and a member has +approved it, but you must do it before we can put your code into our codebase. +Before you start working on a larger contribution, you should get in touch with +us first through the issue tracker with your idea so that we can help out and +possibly guide you. Coordinating up front makes it much easier to avoid +frustration later on. + +### Code reviews + +All submissions, including submissions by project members, require review. We +allow pull requests to be filed, but we perform code reviews on codereview.cc. + +### The small print + +Contributions made by corporations are covered by a different agreement than +the one above, the +[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate). + +### Submitting a [Pull Request](https://github.com/google/material-components-ios/compare/) + +Once you have code that is ready to share, please create a [pull request](https://github.com/google/material-components-ios/compare/) against our [GitHub repo](https://github.com/google/material-components-ios). See [GitHub's documentation about pull requests](https://help.github.com/articles/using-pull-requests) for more information. +### Subject Format We use a simple format for titles: - Start the title with `[ComponentName]` to identify which component a change affects. Use @@ -181,8 +244,8 @@ We use a simple format for titles: rare. - Use `[ComponentName]!` to indicate that a change introduce a breakage: removing/renaming an element of the public API. -- Use `[ComponentName]?` to indicate that a change (deliberately) introduces warnings, such as in - deprecations. +- Use `[ComponentName]?` to indicate that a change (deliberately) introduces warnings. For example + when we mark an API deprecated. A good example of a title is: @@ -205,7 +268,60 @@ account on Phabricator and join the discussion of your changes. We have deferred all conversations about coding style to [clang-format](http://clang.llvm.org/docs/ClangFormat.html) and it is an automated part of our work flow. We follow the [Google style guide](https://google.github.io/styleguide/objcguide.xml). We -recommend running clang format on your changes before sending a pull request. +recommend running clang format on your changes before sending a pull request because it will +facilitate readability by everyone working on the project. Reading and understanding the code faster +results in landing your code into our codebase faster. + +- - - + +# Component checklist + +This checklist describes the process by which Material components are built. + +## API review + +API reviews work like typical code reviews with the added constraint of only reviewing the +component's **public APIs**. + +To initiate an API review, send a pull request that only includes the public APIs you wish to +review. + +TODO(featherless): Flesh this out with some concrete examples of existing API reviews. + +## Minimize dependencies + +The work: avoid non-essential dependencies. + +The why: the team has had many discussions on this topic. Generally speaking, we use the following +considerations as a basis for minimizing dependencies: + +- dependencies increase cost of maintenance and cost of usage for a component, and +- dependency-less components are much easier to drop in and, most importantly, to remove from a + project. + +[Reach out to the team directly](contributing/#questions) for advice or questions on this matter. + +Recommendations: + +- Aim for zero non-platform dependencies. +- Reasonable exceptions can be made, but must be justified. +- Do not create "Core" or "Utility" libraries. + +## Nullability annotations + +The work: add nullability annotations to every header of your component. + +The why: nullability annotations improve Swift usage of a component's APIs. +[Learn more](https://developer.apple.com/swift/blog/?id=25) + +Recommendations: + +We **explicitly** annotate all public APIs rather than use `NS_ASSUME_NONNULL_BEGIN`. This is an +intentional deviation from Apple’s practice of using the `ASSUME` macros. + +Further reading: + +- http://nshipster.com/swift-1.2/#nullability-annotations - - - diff --git a/contributing/contributor_guides/checklist.md b/contributing/checklist.md similarity index 100% rename from contributing/contributor_guides/checklist.md rename to contributing/checklist.md diff --git a/contributing/contributor_guides/hotfixing.md b/contributing/hotfixing.md similarity index 100% rename from contributing/contributor_guides/hotfixing.md rename to contributing/hotfixing.md diff --git a/contributing/maintaining.md b/contributing/maintaining.md new file mode 100644 index 00000000000..8f841eb1a96 --- /dev/null +++ b/contributing/maintaining.md @@ -0,0 +1,127 @@ +# Maintaining + +These instructions describe how we accept changes into the material-components-ios (MDC) repository. +This doc is for core contributors. If you are looking for more casual contribution see the +[contributing page](https://github.com/googlmaterial-components-ios/blob/develop/contributing/README.md). + +## Install contributor tools + +Run the `./scripts/install_contributor_tools` to ensure you have the same version of third party +tools like clang-format, proselint, jazzy, arc. + +## Arc commands + +We use Phabricator as our code review tool. As a core contributor you will be using `arc` commands +to post your code up to [codereview.cc/differential](http://codereview.cc/differential/) where it +will be reviewed by at least one other core team member before it gets committed into our develop +branch. +The [arc user guide](https://secure.phabricator.com/book/phabricator/article/arcanist_diff) is a +good reference. We have changed our default `arc diff` range to `origin/develop..HEAD` since develop +is our active branch. `arc --help` lists all arc commands. + +### Typical life of a diff + +#### Do the work + +``` +arc feature awesomeChange # Will create a git branch named awesomeChange +touch awesomeFile.m # Make some changes +git commit -am "[Awesome] Need to make this awesome" # Commit those changes +``` + +#### Send it off for review: + +``` +git checkout awesomeChange # To get back on your branch if you were somewhere else +arc diff # Will upload a diff off develop and mark it ready for review +``` + +The `arc diff` command will present you with an opportunity to edit the diff's subject, summary, +reviewers and more but that can be edited later in the web UI. + +#### If someone `Requests Changes`: + +``` +git checkout awesomeChange # To get back on your branch if you were somewhere else +touch awesomeFile.h # Make the change requested. +git commit -am "Made that change you wanted." +arc diff # Will update the diff to the new state and mark it ready for review. +``` + +Keep repeating this until you the reviewer marks the diff `Accept Revision` + + +#### Once we get a approval + +``` +git checkout awesomeChange # To get back on your branch if you were somewhere else +arc land # Will squash the commits, use the diff's title and summary and rebase + # onto develop. +``` + +The `arc land` will automatically push the changes up to develop and delete your feature branch. +Phabricator is also watching for changes to the repository and will mark diffs closed once you land +them. + +If you are unsure of what will happen use `arc which` for information or `arc land --hold` to do a +dry run (everything but push). Use `arc land --help` to see the reference doc. + +## Pull Request Flow + +This assumes that there is a GitHub pull request in flight and you are trying to get shepherd it +into the repository. + +### Run github-to-phabricator script + +Get the github-to-phabricator script and from the root of the project run +``` +node mirror_prs.js +``` +You know it worked if [codereview.cc](http://codereview.cc) has a new diff with a github-bot author +and the pull request has a comment pointing at that diff. + +#### Error: unlikely able to merge + +If you get an `Unlikely able to merge` it means their branch is behind google:develop and needs to +be synced for the script to work. + +##### You can sync it for them +If you do so they will lose credit for the change because you will be the last person to make a +commit before our github-to-phabricator script runs. + +To sync their branch for them follow these steps: + +* Add their fork to [your remotes](https://help.github.com/articles/pushing-to-a-remote/#remotes-and-forks) + * Note: The pull request page has `` inside the `command line instructions` + link. +``` +git remote add contributorsHandleFork git@github.com:contributorsHandle/material-components-ios.git +git fetch contributorsHandleFork +``` +* Follow **Step 1** on the GitHub pull request web page to get their changes. + This would look something like: +``` +git checkout -b contributorsHandle-patch-1 develop +git pull git@github.com:contributorsHandle/material-components-ios.git patch-1 +``` +* Push the changes back to their branch on their +[fork](https://help.github.com/articles/pushing-to-a-remote/) of the repository. +``` +git push contributorsHandleFork patch-1 +``` + +At this point you should try to rerun the github-to-phabricator script. + +### Commandeer revision from the github-bot + +We assuming that you have a gitub-bot authored diff that came from a pull request on GitHub. If this +is not the case see above for triggering the [github-to-phabricator](#run-github-to-phabricator-script) +script. + +You should: +* Take the `Commandeer Revision` action on the diff in the web UI. +* Run `arc patch` the diff to your local machine. +* Run `arc diff` the diff to run the linter and unit tests. +* Get the diff approved by another core team member like you would any other diff. +* Run `arc land` the diff as you would any other diff. + * Note: this will preserve the original author of the pull request by using the last commit. diff --git a/contributing/contributor_guides/mdc-local-folder-and-branch-structure.png b/contributing/mdc-local-folder-and-branch-structure.png similarity index 100% rename from contributing/contributor_guides/mdc-local-folder-and-branch-structure.png rename to contributing/mdc-local-folder-and-branch-structure.png diff --git a/contributing/new-components.md b/contributing/new-components.md new file mode 100644 index 00000000000..7597a068111 --- /dev/null +++ b/contributing/new-components.md @@ -0,0 +1,30 @@ +# Documenting a new component + +Components are the basic organizational unit in Material Components iOS. When a new component is +added, its documentation needs to be inserted in various places in the repo and on the web site. + +## What you'll need + +1. The component's code, +1. A relevant reference to the spec, +1. A demo video, +1. A screenshot, +1. A short one-line description of the component. +1. An icon for the [component list](https://material-ext.appspot.com/mdc-ios-preview/components/). + This can be omitted at first but be sure to follow up with a team member to get it generated. + +Check the other components for good examples of the above. + +## Steps to document the component + +1. Add the component itself to `components/` using the existing component structure. +1. Write a README.md for the component in `components//README.md`. +1. Add an entry for the new component to the list in `components/README.md`. +1. Capture visual assets: + 1. A short demo video in `components//docs/assets/.mp4`. + 1. A screenshot in `components//docs/assets/.png`. +1. Run `scripts/generate_jazzy_yamls.sh` to generate `components//.jazzy.yaml`, the + configuration for [Jazzy](https://github.com/realm/jazzy), our code documentation generator. +1. Add the YAML prefix (delimited by the `---` markers) to `components//README.md`. Use the +components' name as the `title` and its description as the `excerpt`. +[Example](https://raw.githubusercontent.com/google/material-components-ios/develop/components/AppBar/README.md). diff --git a/contributing/contributor_guides/releasing.md b/contributing/releasing.md similarity index 100% rename from contributing/contributor_guides/releasing.md rename to contributing/releasing.md diff --git a/contributing/contributor_guides/site_content_update.md b/contributing/site_content_update.md similarity index 100% rename from contributing/contributor_guides/site_content_update.md rename to contributing/site_content_update.md diff --git a/contributing/contributor_guides/site_development.md b/contributing/site_development.md similarity index 100% rename from contributing/contributor_guides/site_development.md rename to contributing/site_development.md diff --git a/contributing/contributor_guides/writing_readmes.md b/contributing/writing_readmes.md similarity index 100% rename from contributing/contributor_guides/writing_readmes.md rename to contributing/writing_readmes.md diff --git a/demos/Pesto/Podfile.lock b/demos/Pesto/Podfile.lock index 6c2bbd56903..ff5c2b25535 100644 --- a/demos/Pesto/Podfile.lock +++ b/demos/Pesto/Podfile.lock @@ -1,33 +1,33 @@ PODS: - - MaterialComponents (12.2.0): - - MaterialComponents/ActivityIndicator (= 12.2.0) - - MaterialComponents/AppBar (= 12.2.0) - - MaterialComponents/ButtonBar (= 12.2.0) - - MaterialComponents/Buttons (= 12.2.0) - - MaterialComponents/CollectionCells (= 12.2.0) - - MaterialComponents/CollectionLayoutAttributes (= 12.2.0) - - MaterialComponents/Collections (= 12.2.0) - - MaterialComponents/Dialogs (= 12.2.0) - - MaterialComponents/FlexibleHeader (= 12.2.0) - - MaterialComponents/FontDiskLoader (= 12.2.0) - - MaterialComponents/HeaderStackView (= 12.2.0) - - MaterialComponents/Ink (= 12.2.0) - - MaterialComponents/NavigationBar (= 12.2.0) - - MaterialComponents/OverlayWindow (= 12.2.0) - - MaterialComponents/PageControl (= 12.2.0) - - MaterialComponents/Palettes (= 12.2.0) - - MaterialComponents/private (= 12.2.0) - - MaterialComponents/ProgressView (= 12.2.0) - - MaterialComponents/RobotoFontLoader (= 12.2.0) - - MaterialComponents/ShadowElevations (= 12.2.0) - - MaterialComponents/ShadowLayer (= 12.2.0) - - MaterialComponents/Slider (= 12.2.0) - - MaterialComponents/Snackbar (= 12.2.0) - - MaterialComponents/SpritedAnimationView (= 12.2.0) - - MaterialComponents/Switch (= 12.2.0) - - MaterialComponents/Typography (= 12.2.0) - - MaterialComponents/ActivityIndicator (12.2.0) - - MaterialComponents/AppBar (12.2.0): + - MaterialComponents (13.0.0): + - MaterialComponents/ActivityIndicator (= 13.0.0) + - MaterialComponents/AppBar (= 13.0.0) + - MaterialComponents/ButtonBar (= 13.0.0) + - MaterialComponents/Buttons (= 13.0.0) + - MaterialComponents/CollectionCells (= 13.0.0) + - MaterialComponents/CollectionLayoutAttributes (= 13.0.0) + - MaterialComponents/Collections (= 13.0.0) + - MaterialComponents/Dialogs (= 13.0.0) + - MaterialComponents/FlexibleHeader (= 13.0.0) + - MaterialComponents/FontDiskLoader (= 13.0.0) + - MaterialComponents/HeaderStackView (= 13.0.0) + - MaterialComponents/Ink (= 13.0.0) + - MaterialComponents/NavigationBar (= 13.0.0) + - MaterialComponents/OverlayWindow (= 13.0.0) + - MaterialComponents/PageControl (= 13.0.0) + - MaterialComponents/Palettes (= 13.0.0) + - MaterialComponents/private (= 13.0.0) + - MaterialComponents/ProgressView (= 13.0.0) + - MaterialComponents/RobotoFontLoader (= 13.0.0) + - MaterialComponents/ShadowElevations (= 13.0.0) + - MaterialComponents/ShadowLayer (= 13.0.0) + - MaterialComponents/Slider (= 13.0.0) + - MaterialComponents/Snackbar (= 13.0.0) + - MaterialComponents/SpritedAnimationView (= 13.0.0) + - MaterialComponents/Switch (= 13.0.0) + - MaterialComponents/Typography (= 13.0.0) + - MaterialComponents/ActivityIndicator (13.0.0) + - MaterialComponents/AppBar (13.0.0): - MaterialComponents/FlexibleHeader - MaterialComponents/HeaderStackView - MaterialComponents/NavigationBar @@ -36,15 +36,15 @@ PODS: - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/ButtonBar (12.2.0): + - MaterialComponents/ButtonBar (13.0.0): - MaterialComponents/Buttons - MaterialComponents/private/RTL - - MaterialComponents/Buttons (12.2.0): + - MaterialComponents/Buttons (13.0.0): - MaterialComponents/Ink - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/CollectionCells (12.2.0): + - MaterialComponents/CollectionCells (13.0.0): - MaterialComponents/CollectionLayoutAttributes - MaterialComponents/Ink - MaterialComponents/private/Icons/ic_check @@ -55,88 +55,88 @@ PODS: - MaterialComponents/private/Icons/ic_reorder - MaterialComponents/private/RTL - MaterialComponents/Typography - - MaterialComponents/CollectionLayoutAttributes (12.2.0) - - MaterialComponents/Collections (12.2.0): + - MaterialComponents/CollectionLayoutAttributes (13.0.0) + - MaterialComponents/Collections (13.0.0): - MaterialComponents/CollectionCells - MaterialComponents/CollectionLayoutAttributes - MaterialComponents/Ink - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/Dialogs (12.2.0): + - MaterialComponents/Dialogs (13.0.0): - MaterialComponents/Buttons - MaterialComponents/private/KeyboardWatcher - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - - MaterialComponents/FlexibleHeader (12.2.0) - - MaterialComponents/FontDiskLoader (12.2.0) - - MaterialComponents/HeaderStackView (12.2.0) - - MaterialComponents/Ink (12.2.0) - - MaterialComponents/NavigationBar (12.2.0): + - MaterialComponents/FlexibleHeader (13.0.0) + - MaterialComponents/FontDiskLoader (13.0.0) + - MaterialComponents/HeaderStackView (13.0.0) + - MaterialComponents/Ink (13.0.0) + - MaterialComponents/NavigationBar (13.0.0): - MaterialComponents/ButtonBar - MaterialComponents/private/RTL - MaterialComponents/Typography - - MaterialComponents/OverlayWindow (12.2.0) - - MaterialComponents/PageControl (12.2.0) - - MaterialComponents/Palettes (12.2.0) - - MaterialComponents/private (12.2.0): - - MaterialComponents/private/Color (= 12.2.0) - - MaterialComponents/private/Icons (= 12.2.0) - - MaterialComponents/private/KeyboardWatcher (= 12.2.0) - - MaterialComponents/private/Overlay (= 12.2.0) - - MaterialComponents/private/RTL (= 12.2.0) - - MaterialComponents/private/ThumbTrack (= 12.2.0) - - MaterialComponents/private/Color (12.2.0) - - MaterialComponents/private/Icons (12.2.0): - - MaterialComponents/private/Icons/Base (= 12.2.0) - - MaterialComponents/private/Icons/ic_arrow_back (= 12.2.0) - - MaterialComponents/private/Icons/ic_check (= 12.2.0) - - MaterialComponents/private/Icons/ic_check_circle (= 12.2.0) - - MaterialComponents/private/Icons/ic_chevron_right (= 12.2.0) - - MaterialComponents/private/Icons/ic_info (= 12.2.0) - - MaterialComponents/private/Icons/ic_radio_button_unchecked (= 12.2.0) - - MaterialComponents/private/Icons/ic_reorder (= 12.2.0) - - MaterialComponents/private/Icons/Base (12.2.0) - - MaterialComponents/private/Icons/ic_arrow_back (12.2.0): + - MaterialComponents/OverlayWindow (13.0.0) + - MaterialComponents/PageControl (13.0.0) + - MaterialComponents/Palettes (13.0.0) + - MaterialComponents/private (13.0.0): + - MaterialComponents/private/Color (= 13.0.0) + - MaterialComponents/private/Icons (= 13.0.0) + - MaterialComponents/private/KeyboardWatcher (= 13.0.0) + - MaterialComponents/private/Overlay (= 13.0.0) + - MaterialComponents/private/RTL (= 13.0.0) + - MaterialComponents/private/ThumbTrack (= 13.0.0) + - MaterialComponents/private/Color (13.0.0) + - MaterialComponents/private/Icons (13.0.0): + - MaterialComponents/private/Icons/Base (= 13.0.0) + - MaterialComponents/private/Icons/ic_arrow_back (= 13.0.0) + - MaterialComponents/private/Icons/ic_check (= 13.0.0) + - MaterialComponents/private/Icons/ic_check_circle (= 13.0.0) + - MaterialComponents/private/Icons/ic_chevron_right (= 13.0.0) + - MaterialComponents/private/Icons/ic_info (= 13.0.0) + - MaterialComponents/private/Icons/ic_radio_button_unchecked (= 13.0.0) + - MaterialComponents/private/Icons/ic_reorder (= 13.0.0) + - MaterialComponents/private/Icons/Base (13.0.0) + - MaterialComponents/private/Icons/ic_arrow_back (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_check (12.2.0): + - MaterialComponents/private/Icons/ic_check (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_check_circle (12.2.0): + - MaterialComponents/private/Icons/ic_check_circle (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_chevron_right (12.2.0): + - MaterialComponents/private/Icons/ic_chevron_right (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_info (12.2.0): + - MaterialComponents/private/Icons/ic_info (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_radio_button_unchecked (12.2.0): + - MaterialComponents/private/Icons/ic_radio_button_unchecked (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_reorder (12.2.0): + - MaterialComponents/private/Icons/ic_reorder (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/KeyboardWatcher (12.2.0) - - MaterialComponents/private/Overlay (12.2.0) - - MaterialComponents/private/RTL (12.2.0) - - MaterialComponents/private/ThumbTrack (12.2.0): + - MaterialComponents/private/KeyboardWatcher (13.0.0) + - MaterialComponents/private/Overlay (13.0.0) + - MaterialComponents/private/RTL (13.0.0) + - MaterialComponents/private/ThumbTrack (13.0.0): - MaterialComponents/Ink - MaterialComponents/private/Color - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - - MaterialComponents/ProgressView (12.2.0): + - MaterialComponents/ProgressView (13.0.0): - MaterialComponents/private/RTL - - MaterialComponents/RobotoFontLoader (12.2.0): + - MaterialComponents/RobotoFontLoader (13.0.0): - MaterialComponents/FontDiskLoader - MaterialComponents/Typography - - MaterialComponents/ShadowElevations (12.2.0) - - MaterialComponents/ShadowLayer (12.2.0) - - MaterialComponents/Slider (12.2.0): + - MaterialComponents/ShadowElevations (13.0.0) + - MaterialComponents/ShadowLayer (13.0.0) + - MaterialComponents/Slider (13.0.0): - MaterialComponents/private/ThumbTrack - - MaterialComponents/Snackbar (12.2.0): + - MaterialComponents/Snackbar (13.0.0): - MaterialComponents/Buttons - MaterialComponents/OverlayWindow - MaterialComponents/private/KeyboardWatcher - MaterialComponents/private/Overlay - - MaterialComponents/SpritedAnimationView (12.2.0) - - MaterialComponents/Switch (12.2.0): + - MaterialComponents/SpritedAnimationView (13.0.0) + - MaterialComponents/Switch (13.0.0): - MaterialComponents/private/ThumbTrack - - MaterialComponents/Typography (12.2.0) + - MaterialComponents/Typography (13.0.0) DEPENDENCIES: - MaterialComponents (from `../../`) @@ -146,7 +146,7 @@ EXTERNAL SOURCES: :path: "../../" SPEC CHECKSUMS: - MaterialComponents: dc641f565bbf36b134427bf24fea1e02016d657c + MaterialComponents: d25237e4b011014b9fe91baecf4d0bd48319aaa0 PODFILE CHECKSUM: f138be16d4835113ff672258fc7529fad3f90e91 diff --git a/demos/Shrine/Podfile.lock b/demos/Shrine/Podfile.lock index 8f64fe639a1..cf8ef02e023 100644 --- a/demos/Shrine/Podfile.lock +++ b/demos/Shrine/Podfile.lock @@ -1,33 +1,33 @@ PODS: - - MaterialComponents (12.2.0): - - MaterialComponents/ActivityIndicator (= 12.2.0) - - MaterialComponents/AppBar (= 12.2.0) - - MaterialComponents/ButtonBar (= 12.2.0) - - MaterialComponents/Buttons (= 12.2.0) - - MaterialComponents/CollectionCells (= 12.2.0) - - MaterialComponents/CollectionLayoutAttributes (= 12.2.0) - - MaterialComponents/Collections (= 12.2.0) - - MaterialComponents/Dialogs (= 12.2.0) - - MaterialComponents/FlexibleHeader (= 12.2.0) - - MaterialComponents/FontDiskLoader (= 12.2.0) - - MaterialComponents/HeaderStackView (= 12.2.0) - - MaterialComponents/Ink (= 12.2.0) - - MaterialComponents/NavigationBar (= 12.2.0) - - MaterialComponents/OverlayWindow (= 12.2.0) - - MaterialComponents/PageControl (= 12.2.0) - - MaterialComponents/Palettes (= 12.2.0) - - MaterialComponents/private (= 12.2.0) - - MaterialComponents/ProgressView (= 12.2.0) - - MaterialComponents/RobotoFontLoader (= 12.2.0) - - MaterialComponents/ShadowElevations (= 12.2.0) - - MaterialComponents/ShadowLayer (= 12.2.0) - - MaterialComponents/Slider (= 12.2.0) - - MaterialComponents/Snackbar (= 12.2.0) - - MaterialComponents/SpritedAnimationView (= 12.2.0) - - MaterialComponents/Switch (= 12.2.0) - - MaterialComponents/Typography (= 12.2.0) - - MaterialComponents/ActivityIndicator (12.2.0) - - MaterialComponents/AppBar (12.2.0): + - MaterialComponents (13.0.0): + - MaterialComponents/ActivityIndicator (= 13.0.0) + - MaterialComponents/AppBar (= 13.0.0) + - MaterialComponents/ButtonBar (= 13.0.0) + - MaterialComponents/Buttons (= 13.0.0) + - MaterialComponents/CollectionCells (= 13.0.0) + - MaterialComponents/CollectionLayoutAttributes (= 13.0.0) + - MaterialComponents/Collections (= 13.0.0) + - MaterialComponents/Dialogs (= 13.0.0) + - MaterialComponents/FlexibleHeader (= 13.0.0) + - MaterialComponents/FontDiskLoader (= 13.0.0) + - MaterialComponents/HeaderStackView (= 13.0.0) + - MaterialComponents/Ink (= 13.0.0) + - MaterialComponents/NavigationBar (= 13.0.0) + - MaterialComponents/OverlayWindow (= 13.0.0) + - MaterialComponents/PageControl (= 13.0.0) + - MaterialComponents/Palettes (= 13.0.0) + - MaterialComponents/private (= 13.0.0) + - MaterialComponents/ProgressView (= 13.0.0) + - MaterialComponents/RobotoFontLoader (= 13.0.0) + - MaterialComponents/ShadowElevations (= 13.0.0) + - MaterialComponents/ShadowLayer (= 13.0.0) + - MaterialComponents/Slider (= 13.0.0) + - MaterialComponents/Snackbar (= 13.0.0) + - MaterialComponents/SpritedAnimationView (= 13.0.0) + - MaterialComponents/Switch (= 13.0.0) + - MaterialComponents/Typography (= 13.0.0) + - MaterialComponents/ActivityIndicator (13.0.0) + - MaterialComponents/AppBar (13.0.0): - MaterialComponents/FlexibleHeader - MaterialComponents/HeaderStackView - MaterialComponents/NavigationBar @@ -36,15 +36,15 @@ PODS: - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/ButtonBar (12.2.0): + - MaterialComponents/ButtonBar (13.0.0): - MaterialComponents/Buttons - MaterialComponents/private/RTL - - MaterialComponents/Buttons (12.2.0): + - MaterialComponents/Buttons (13.0.0): - MaterialComponents/Ink - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/CollectionCells (12.2.0): + - MaterialComponents/CollectionCells (13.0.0): - MaterialComponents/CollectionLayoutAttributes - MaterialComponents/Ink - MaterialComponents/private/Icons/ic_check @@ -55,88 +55,88 @@ PODS: - MaterialComponents/private/Icons/ic_reorder - MaterialComponents/private/RTL - MaterialComponents/Typography - - MaterialComponents/CollectionLayoutAttributes (12.2.0) - - MaterialComponents/Collections (12.2.0): + - MaterialComponents/CollectionLayoutAttributes (13.0.0) + - MaterialComponents/Collections (13.0.0): - MaterialComponents/CollectionCells - MaterialComponents/CollectionLayoutAttributes - MaterialComponents/Ink - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - MaterialComponents/Typography - - MaterialComponents/Dialogs (12.2.0): + - MaterialComponents/Dialogs (13.0.0): - MaterialComponents/Buttons - MaterialComponents/private/KeyboardWatcher - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - - MaterialComponents/FlexibleHeader (12.2.0) - - MaterialComponents/FontDiskLoader (12.2.0) - - MaterialComponents/HeaderStackView (12.2.0) - - MaterialComponents/Ink (12.2.0) - - MaterialComponents/NavigationBar (12.2.0): + - MaterialComponents/FlexibleHeader (13.0.0) + - MaterialComponents/FontDiskLoader (13.0.0) + - MaterialComponents/HeaderStackView (13.0.0) + - MaterialComponents/Ink (13.0.0) + - MaterialComponents/NavigationBar (13.0.0): - MaterialComponents/ButtonBar - MaterialComponents/private/RTL - MaterialComponents/Typography - - MaterialComponents/OverlayWindow (12.2.0) - - MaterialComponents/PageControl (12.2.0) - - MaterialComponents/Palettes (12.2.0) - - MaterialComponents/private (12.2.0): - - MaterialComponents/private/Color (= 12.2.0) - - MaterialComponents/private/Icons (= 12.2.0) - - MaterialComponents/private/KeyboardWatcher (= 12.2.0) - - MaterialComponents/private/Overlay (= 12.2.0) - - MaterialComponents/private/RTL (= 12.2.0) - - MaterialComponents/private/ThumbTrack (= 12.2.0) - - MaterialComponents/private/Color (12.2.0) - - MaterialComponents/private/Icons (12.2.0): - - MaterialComponents/private/Icons/Base (= 12.2.0) - - MaterialComponents/private/Icons/ic_arrow_back (= 12.2.0) - - MaterialComponents/private/Icons/ic_check (= 12.2.0) - - MaterialComponents/private/Icons/ic_check_circle (= 12.2.0) - - MaterialComponents/private/Icons/ic_chevron_right (= 12.2.0) - - MaterialComponents/private/Icons/ic_info (= 12.2.0) - - MaterialComponents/private/Icons/ic_radio_button_unchecked (= 12.2.0) - - MaterialComponents/private/Icons/ic_reorder (= 12.2.0) - - MaterialComponents/private/Icons/Base (12.2.0) - - MaterialComponents/private/Icons/ic_arrow_back (12.2.0): + - MaterialComponents/OverlayWindow (13.0.0) + - MaterialComponents/PageControl (13.0.0) + - MaterialComponents/Palettes (13.0.0) + - MaterialComponents/private (13.0.0): + - MaterialComponents/private/Color (= 13.0.0) + - MaterialComponents/private/Icons (= 13.0.0) + - MaterialComponents/private/KeyboardWatcher (= 13.0.0) + - MaterialComponents/private/Overlay (= 13.0.0) + - MaterialComponents/private/RTL (= 13.0.0) + - MaterialComponents/private/ThumbTrack (= 13.0.0) + - MaterialComponents/private/Color (13.0.0) + - MaterialComponents/private/Icons (13.0.0): + - MaterialComponents/private/Icons/Base (= 13.0.0) + - MaterialComponents/private/Icons/ic_arrow_back (= 13.0.0) + - MaterialComponents/private/Icons/ic_check (= 13.0.0) + - MaterialComponents/private/Icons/ic_check_circle (= 13.0.0) + - MaterialComponents/private/Icons/ic_chevron_right (= 13.0.0) + - MaterialComponents/private/Icons/ic_info (= 13.0.0) + - MaterialComponents/private/Icons/ic_radio_button_unchecked (= 13.0.0) + - MaterialComponents/private/Icons/ic_reorder (= 13.0.0) + - MaterialComponents/private/Icons/Base (13.0.0) + - MaterialComponents/private/Icons/ic_arrow_back (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_check (12.2.0): + - MaterialComponents/private/Icons/ic_check (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_check_circle (12.2.0): + - MaterialComponents/private/Icons/ic_check_circle (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_chevron_right (12.2.0): + - MaterialComponents/private/Icons/ic_chevron_right (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_info (12.2.0): + - MaterialComponents/private/Icons/ic_info (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_radio_button_unchecked (12.2.0): + - MaterialComponents/private/Icons/ic_radio_button_unchecked (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/Icons/ic_reorder (12.2.0): + - MaterialComponents/private/Icons/ic_reorder (13.0.0): - MaterialComponents/private/Icons/Base - - MaterialComponents/private/KeyboardWatcher (12.2.0) - - MaterialComponents/private/Overlay (12.2.0) - - MaterialComponents/private/RTL (12.2.0) - - MaterialComponents/private/ThumbTrack (12.2.0): + - MaterialComponents/private/KeyboardWatcher (13.0.0) + - MaterialComponents/private/Overlay (13.0.0) + - MaterialComponents/private/RTL (13.0.0) + - MaterialComponents/private/ThumbTrack (13.0.0): - MaterialComponents/Ink - MaterialComponents/private/Color - MaterialComponents/ShadowElevations - MaterialComponents/ShadowLayer - - MaterialComponents/ProgressView (12.2.0): + - MaterialComponents/ProgressView (13.0.0): - MaterialComponents/private/RTL - - MaterialComponents/RobotoFontLoader (12.2.0): + - MaterialComponents/RobotoFontLoader (13.0.0): - MaterialComponents/FontDiskLoader - MaterialComponents/Typography - - MaterialComponents/ShadowElevations (12.2.0) - - MaterialComponents/ShadowLayer (12.2.0) - - MaterialComponents/Slider (12.2.0): + - MaterialComponents/ShadowElevations (13.0.0) + - MaterialComponents/ShadowLayer (13.0.0) + - MaterialComponents/Slider (13.0.0): - MaterialComponents/private/ThumbTrack - - MaterialComponents/Snackbar (12.2.0): + - MaterialComponents/Snackbar (13.0.0): - MaterialComponents/Buttons - MaterialComponents/OverlayWindow - MaterialComponents/private/KeyboardWatcher - MaterialComponents/private/Overlay - - MaterialComponents/SpritedAnimationView (12.2.0) - - MaterialComponents/Switch (12.2.0): + - MaterialComponents/SpritedAnimationView (13.0.0) + - MaterialComponents/Switch (13.0.0): - MaterialComponents/private/ThumbTrack - - MaterialComponents/Typography (12.2.0) + - MaterialComponents/Typography (13.0.0) DEPENDENCIES: - MaterialComponents (from `../../`) @@ -146,7 +146,7 @@ EXTERNAL SOURCES: :path: "../../" SPEC CHECKSUMS: - MaterialComponents: dc641f565bbf36b134427bf24fea1e02016d657c + MaterialComponents: d25237e4b011014b9fe91baecf4d0bd48319aaa0 PODFILE CHECKSUM: b585ca32a2884e050823cc1f861e8b7246f7dcc1 diff --git a/howto/README.md b/howto/README.md index fb21f98e233..765a36c99d5 100644 --- a/howto/README.md +++ b/howto/README.md @@ -9,10 +9,10 @@ section: howto Material Components iOS should be immediately useable out of the box with Apple's standard development tool chain. -- [Tutorial]({{ site.folder }}/howto/tutorial/) +- [Tutorial](tutorial/README.md) -- [Build environment]({{ site.folder }}/howto/build-env/) +- [Build environment](build-env/README.md) diff --git a/howto/build-env/README.md b/howto/build-env/README.md index ec12f15ff79..aec697a4018 100644 --- a/howto/build-env/README.md +++ b/howto/build-env/README.md @@ -43,6 +43,14 @@ versions. All components are expected to support **iOS 7.0 and above**. +#### iOS 8.0 and above components + +* [Dialogs](https://github.com/google/material-components-ios/tree/develop/components/Dialogs) + +### CocoaPods + +We are using CocoaPods 1.0.1. + ### Ruby The core team uses **Ruby 2.0.0**. Newer versions of ruby have subtle modifications that affect our diff --git a/howto/tutorial/README.md b/howto/tutorial/README.md index 156cc40df71..463ce8dc054 100644 --- a/howto/tutorial/README.md +++ b/howto/tutorial/README.md @@ -7,14 +7,14 @@ section: howto # Material Components Development Guide Material Components for iOS is a set of components that help iOS app developers -build Material Design apps. These are the same components Google uses to build +build material design apps. These are the same components Google uses to build apps like Google Maps, Calendar, Chrome and many more. -Individually, the components bring Material Design principles to common UI +Individually, the components bring material design principles to common UI elements and behaviors, but tailored for iOS. Our team has taken care to design the APIs to feel natural on iOS. -Our goal is to make implementing Material Design as easy as possible. The +Our goal is to make implementing material design as easy as possible. The components are easy to assemble and be used piecemeal. This tutorial will take you through building an example app called Abstractor @@ -757,7 +757,7 @@ override func collectionView(collectionView: UICollectionView, didSelectItemAtIn ## Next steps -This tutorial has taken you through implementing a basic Material Design style +This tutorial has taken you through implementing a basic material design style app with some of our components. There are a lot more components that are not covered which are covered in our component documentation. diff --git a/scripts/external/arc-xcode-test-engine b/scripts/external/arc-xcode-test-engine index 671ddf3db38..6f60d28ef93 160000 --- a/scripts/external/arc-xcode-test-engine +++ b/scripts/external/arc-xcode-test-engine @@ -1 +1 @@ -Subproject commit 671ddf3db381b1c53e908504ed056fd82cd302ee +Subproject commit 6f60d28ef93efab42d4f0565d97b7727b1d02a9a diff --git a/scripts/release/bump b/scripts/release/bump index 98bfc306c01..6894d111f48 100755 --- a/scripts/release/bump +++ b/scripts/release/bump @@ -154,7 +154,7 @@ def main(): update_podspec_file(verbose_printer, p, args.version) # Update all pod files. - manage_pods.update_all_podfile_dirs(args.directory, args.fast_pod_install) + manage_pods.install_all_podfile_dirs(args.directory, args.fast_pod_install) if __name__ == '__main__': main() diff --git a/scripts/release/release_checklist.txt b/scripts/release/release_checklist.txt index 3604cbe8270..7f4d9436946 100644 --- a/scripts/release/release_checklist.txt +++ b/scripts/release/release_checklist.txt @@ -1,19 +1,23 @@ Release candidate. +[Releasing guide] +(https://github.com/google/material-components-ios/blob/develop/contributing/contributor_guides/releasing.md) Checklist: -- [ ] Ran `arc unit --everything`. -- [ ] Ran `scripts/build_all_pod_projects`. -- [ ] Ran `scripts/release/api_diff` and pasted the results into CHANGELOG.md. -- [ ] Ran `scripts/release/changes` and pasted the results into CHANGELOG.md. -- [ ] Visually inspected the API diff to ensure it accurately reflects the release's changes. -- [ ] Ran `scripts/release/diff components/*/src/` and visually inspected the changes. -- [ ] Ran `scripts/release/bump` with the new version number. -- [ ] Updated CHANGELOG.md's latest section header to match the release's version number. -- [ ] I did not `arc land` this change because I followed the [releasing guide](https://github.com/google/material-components-ios/blob/develop/contributing/contributor_guides/releasing.md) and did the following: -- [ ] Marked this diff needs review in the web UI. -- [ ] Got another MDC'er to approve the release. -- [ ] Ran `scripts/release/merge` -- [ ] Push to master -- [ ] Push to develop -- [ ] Manually marked this diff closed in the web ui \ No newline at end of file +- [] Ran `arc unit --everything`. +- [] Ran `scripts/build_all_pod_projects`. +- [] Ran `scripts/release/api_diff` and pasted the results into CHANGELOG.md. +- [] Ran `scripts/release/changes` and pasted the results into CHANGELOG.md. +- [] Visually inspected the API diff to ensure it accurately reflects the release's changes. +- [] Ran `scripts/release/diff components/*/src/` and visually inspected the changes. +- [] Ran `scripts/release/bump` with the new version number. +- [] Updated CHANGELOG.md's latest section header to match the release's version number. +- [] I did not `arc land` this change because I followed the [releasing guide] +(https://github.com/google/material-components-ios/blob/develop/contributing/releasing.md) +and did the following: +- [] Marked this diff `needs review` in the web UI. +- [] Got another MDC'er to approve the release. +- [] Ran `scripts/release/merge` +- [] Push to master +- [] Push to develop +- [] See this diff get automatically closed in the web UI (because it is watching GitHub)