55 Commits

Author SHA1 Message Date
Yarden Eitan
f8465c8fb3 [Collections] Add Ripple as an opt-in for MDCCollections and MDCCollectionCells
PiperOrigin-RevId: 318026061
2020-06-24 02:09:05 -07:00
Wenyu Zhang
5e0294184b [Collections] Fix dynamic color not working when it is used in collectionView:cellBackgroundColorAtIndexPath:.
PiperOrigin-RevId: 310352709
2020-05-07 07:20:49 -07:00
Jeff Verkoeyen
146fb7754c [Collections] Remove special characters from example breadcrumbs.
PiperOrigin-RevId: 310287164
2020-05-06 21:12:47 -07:00
Andrew Overton
c56d5d76d3
Add @objc annotations to get examples to show up in Dragons (#7168)
This is a follow up PR for #7166 adds @objc annotations to Swift catalogMetadata() methods, because the Swift 4 compiler no longer attempts to infer what methods should be visible to Objective-C. As a result of this change in the compiler, no Swift examples were showing up in Dragons after #7166. See this article: https://useyourloaf.com/blog/objc-warnings-upgrading-to-swift-4/ for additional context.
2019-04-17 21:35:43 -04:00
Robert Moore
800188a649
{clang-format} Format the components. (#6347)
This is a follow-up to https://github.com/material-components/material-components-ios/pull/6027

```
find components \( -name "*.h" -or -name "*.m" \) | xargs clang-format -i
```
2019-01-23 11:08:43 -05:00
Yarden Eitan
2803125b2c
ran clang-format (#6027) 2019-01-11 13:23:51 -05:00
Robert Moore
03f3351ad5
Global replace of single-precision floats with CGFloat casts. (#5718)
Replacing all non-integral, single-precision floating point literals with double-precision values explicitly cast to CGFloat.  For example, `0.1f` should become `(CGFloat)0.1`.

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

PiperOrigin-RevId: 220683126
2018-11-12 10:50:01 -05:00
Robert Moore
74a27253e8
Global replace of integral single-precision literals with integer literals. (#5709)
Global replace of integral single-precision literals with integer literals.

Regular expression used:
```perl
/[^\w]([0-9]+)\.[0]*[fF]/$1/
```
2018-11-08 14:02:04 -05:00
featherless
2181084272
[automated] Standardize our open source license stanza to what Xcode generates. (#4985)
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.

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

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at

 http://www\.apache\.org/licenses/LICENSE-2\.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at

http://www\.apache\.org/licenses/LICENSE-2\.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at
 http://www\.apache\.org/licenses/LICENSE-2\.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
2018-08-31 12:13:07 -04:00
Yarden Eitan
3480c50c67
updated to newest CbC standard (#4956)
Move to the new CbC standard released in CatalogByConvention v2.5.0. See PR: material-foundation/cocoapods-catalog-by-convention#27 for more info on the change.
2018-08-29 20:45:13 -04:00
featherless
bbe4a23fe0
Remove all __IPHONE_11_0 checks now that we no longer support Xcode 8. (#4915)
We can now make use of @available throughout our codebase.

We support Xcode 9 and up, which includes the iOS 11 SDK. This means we can remove any guards for SDKs prior to iOS 11.

This was cleaned up by running a global find-and-replace with the following regular expression:

```
Find:#if defined\(__IPHONE_11_0\) && \(__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0\)\n(.+if \(@available\(iOS 11.0, \*\)\) \{(?:.|\n)*?)(?:#else(?:.|\n)*?)?\n#endif
Replace:$1
```

With some additional cleanup for stragglers that didn't match this pattern. Note that else clauses were intentionally dropped.

Closes https://github.com/material-components/material-components-ios/issues/4909
2018-08-28 09:57:30 -04:00
featherless
01e592cb72
[Collections] Mark all examples as dragons. (#3697)
This is in preparation for us sunsetting the component. We will start putting more focus towards Cards and List instead.

Pivotal story: https://www.pivotaltracker.com/story/show/156982080
2018-05-03 16:39:18 -04:00
Robert Moore
2fd85a2c29
[Tabs] Fix format string types in debug, examples (#3195)
Xcode 9.3 is now complaining that our format strings are accepting the wrong
type for NSIntegers. Explicitly casting to formattable types.
2018-03-30 12:53:52 -04:00
strangewiz
caf58f3089 [MDCCollectionViewFlowLayout] Set hasSectionItems in ordinalPositionForListElementWithAttribute (#3049)
* Set hasSectionItems in ordinalPositionForListElementWithAttribute

* Add sample demonstrating issue

* Debugging code removed
2018-03-07 15:42:10 -05:00
Robert Moore
e03186525d
[Examples/Tests] Convert @imports to imports (#2761)
In order to make the internal build systems happier, @import statements should not be used.
2017-12-22 12:30:25 -05:00
Yarden Eitan
29d760c7d6
Added isPresentable to catalog files, ported over ZShadow to dragons. (#2726) 2017-12-15 12:20:35 -05:00
Randall Li
b1ec22207f
Fixed float conversion build errors (#2602)
* Fixed float conversion build errors
Implicit conversion loses floating-point precision: 'double' to 'CGFloat' (aka 'float')

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

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

Found by turning on warnings via: https://github.com/material-components/material-components-ios/pull/2480
2017-12-06 15:57:04 -05:00
Randall Li
ef179750a0
Fixed method collision build errors (#2603)
* Fixed method collision build errors
multiple methods named 'count' found

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

* switch to using using a more precise array of arrays rather than casting the array.
2017-12-06 15:56:46 -05:00
Yurii Samsoniuk
2a96682230 Replace unnecessary imports with forward declarations (#2429)
* [Themes] Remove unnecessary imports.

* [TextFields] Remove unnecessary imports.

* [Typography] Do not use an umbrella header inside of a component.

* [Snackbar] Do not use self umbrella header.

* [ActivityIndicator] Do not use self umbrella header.

* [AppBar] Use umbrella headers.

* [AppBar] Remove self import header.

* [ButtonBar] Removed self umbrella header imports.

* [Buttons] Removed self umbrella header imports.

* [Collections] Update imports.

* [Dialogs] Moved import into an m file.

* [Collections] Fixed imports.

* [FeatureHighlight] Removed self umbrealla imports.

* [HeaderStackView] Reordered imports.

* [Ink] Replaced imports with forward declarations.

* [Slider] Replaced self umbrella import use.

* [Snackbar] Removed self umbrella header import.

* [Tabs] Changed math import. Replaced self umbrella header import.

* [Icons] Removed unnecessary imports.

* [Overlay] Replaced umbrella header import.

* [ShapeLibrary] Replace Shapes imports with an umbrella header.

* [Shapes] Replaced imports with forward declarations.

* [AppBar] Replace import with a forward declaration.

* [Examples] Updated imports.

* Fixed conflicting imports

* Added space between different import categories
2017-11-16 18:25:06 -05:00
Martin Petrov
f98a9d42ed @objc annoaing catalog by convention (#2305) 2017-10-30 10:24:17 -04:00
Cody Weaver
a462a2ac4f [Mutliple components] Update components that use colors to use MDCPalette. (#2129)
* Update components that use colors to use MDCPalette.

* Update podspec to make palettes available to Collection Cell
2017-10-09 12:53:50 -04:00
Gauthier Ambard
cd39384b48 [Collections] Update collections to support iPhone X (#1988)
* [Collections] Update collections to support iPhone X

The collections use the contentInset to compute the width of the cells.
With iPhone X, the width must take into account possible inset of the side.
This patch makes sure that the collection takes into account the adjustedContentInset, which may take the safe area into consideration.

Closes #1980

* Correct respondsToSelect

* Use macro + @available instead of NSInvocation

* Fix CollectionCellsExamples and add a swift version check to the swift example.

* Make UIScrollViewContentInsetAdjustmentAlways the default

* Remove override from CollectionsSectionInsetsExample
2017-10-06 11:32:07 -04:00
Robert Moore
8940d77d6d [Catalog] Verify all examples provide CatalogByConvention methods (#1911)
All examples now have at least the required `+catalogBreadcrumbs` and `+catalogIsPrimaryDemo`.  All examples in the same breadcrumbs path have only one primary demo.  There should be only one `-catalogDescription` attached to the primary demo.

Closes #1897
2017-08-31 08:46:10 -04:00
Robert Moore
584e212fa0 [Collections] Fix example property attribute (#1854)
The static analyzer complained that 2 NSMutableArrays would be copied as
immutable. Fixing their attributes to please the analyzer.
2017-08-21 09:17:21 -04:00
Gauthier Ambard
84a7a6bf71 [Collections] Limit the drag needed to dismiss an item (#1811)
When using the swipe-to-dimiss gesture on large screens, the distance on which the user has to move the item can be big. This commit limits the distance by using the width of the item instead of the width of the collection.

Closes #1780
2017-08-17 10:02:54 -04:00
Robert Moore
14e00b76ce [Collections] Add "editing" performance example (#1710)
* [Collections] Add "editing" performance example

New example to demonstrate scrolling performance when a collection
contains a large number of cells. "Editing" mode is currently very
inefficient.

* Refactoring, pulling some code into supplemental

* Making cell identifier symbol unique
2017-07-28 13:15:39 -04:00
Gauthier Ambard
14496a33a2 [Collections] Add StylingDelegate methods to control separator display (#1627)
* [Collections] Add StylingDelegate methods to control separator display

Adds methods to MDCCollectionViewStylingDelegate, allowing the delegate to control the display of the separator on cells, header and footer.

Closes #1406
2017-07-25 09:48:14 -04:00
Robert Moore
0495092f1e [Collections] Allow custom UIEdgeInsets (#1614)
* [Collections] Allow custom UIEdgeInsets

MDCCollectionViewController implements custom logic for computing the
`UIEdgeInsets` depending on the `MDCCollectionViewCellStyle` and the
`MDCCollectionViewCellLayoutType`. Subclasses need to override this
functionality to customize their presentation.

* MDCCollectionViewController will use the public
  `-collectionView:layout:section` to compute the width of its
   supplementary view instead of the internal implementation directly.
* Update the Collections layout example to have different horizontal
  edge insets depending on the view's horizontal size class.

Closes #1507

* Add EarlGrey test to verify the insets exampl

* Removing changes to Collection Cells example

* Running code formatter

* Supplemental files.

* Some code clean-up based on willlarche@'s comments

* Removing old header, small cleanup

* Changing block parameter types to match the desired class

* One last id to remove

* Making Earl Grey test a bit better. Some formatting

* Fixing a bug with the flowLayout delegate
2017-07-17 17:30:37 -04:00
ianegordon
f018e09afe Eliminate static analyzer warnings. Simplify Collection supplementary views (#1316) 2017-04-17 17:46:55 -04:00
ianegordon
2ce144abd0 Fix warnings uncovered by the Xcode 8.3 static analyzer (#1298)
* Fix warnings from the 8.3 static analyzer

* Revert scheme change

* Revert Scheme change

* Additional warning fixes

* Revert Scheme Changes
2017-04-03 20:21:31 -04:00
Will Larche
8c5350de31 [All] Formatting. (#1269) 2017-03-22 12:18:15 -04:00
Gauthier Ambard
6ddf3fbdcf [Collection] Fix text in header/footer example (#1266)
The header and the footer of the catalog example now display the correct text.
2017-03-21 11:15:23 -04:00
Justin Shephard
620b5be111 [Collections] - Updated README docs and example to use collection headers in editing mode (#1193)
* [ReadMes] - Updated readme docs for collection views to include note about using section headers/footers while editing

* Updated docs

* [ReadMes] - Fixed code snippets

* [ReadMes] - Updated indention in code blocks

* [ReadMes] - Corrected indentions in code snippets

* [Collections] - Updated cell editing example

* [Collections] - Updated example spacing

* [Collections] Fixed return statement

* [Collections] - Updated example

* [Collections] - Added TODO comment with bug reference

* [Collections] - Added comment TODO comment to example code as well
2017-02-15 16:35:57 -05:00
Adrian Secord
8bcb19781c More SwiftLint fixes for unit tests and example apps. (#1154)
* ClangFormat changes.

* Added swiftlint to scripts/format_all.`

* Fix scripts/lint_all to work from any directory.

* Fixed swiftlint invocation.

* Remove the checks for force casting (! operator).

* Some fixes.

* More Swift fixes.
2017-01-11 13:27:57 -05:00
Adrian Secord
6843303f9d [Collections] Added custom Storyboard cell to the Storyboard example. (#1152) 2017-01-10 18:17:51 -05:00
Adrian Secord
7ba66bf09c Formatted all Objective-C sources with clang-format. (#1133) 2017-01-05 10:17:24 -05:00
Adrian Secord
4842a362f5 Convert component examples to Swift 3 (#1002)
* WIP

* WIP

* Simplified build script and fixed it to build all schemes.

* WIP

* Renamed script to build_all and added better output.

* Add scripts/list_xcode_workspaces.

* Filtered out the CocoaPods schemes.

* Use Xcode to update Swift to v3.

* Updated tracked touches map from NSNumber to Int.

* Fixed button sorting that was not actually sorting.

* targetContentOffset no longer allowed to be nil.

* "Fixed" failing test by reducing random number range?

* Swift 3 syntax change.

* Swift 3 syntax change.

* Removed invalid center-aligning tests.

Fixed default nav bar alignment test.
2016-12-12 09:55:36 -05:00
Adrian Secord
171e5bfbc5 Remove MDCSwitch examples and catalog usage. (#892)
* Remove MDCSwitch examples and catalog usage.

* Restored deletion of Switch examples.

* Revert "Restored deletion of Switch examples."

This reverts commit efe9fc75ae3310b58fbb4b56c31caedb7a109bf9.

* No, really. Restore Switch examples.

* Removed all Podfile references.
2016-11-28 14:38:32 -05:00
Ed Chin
68651011a0 Showcase a collectionView footer that does not have card style background in a card style collectionView. (#709) 2016-09-30 16:35:05 -04:00
Adrian Secord
0b57f48e1d Removed all warnings from the build.
Reviewers: O1 Material components iOS, randallli

Reviewed By: O1 Material components iOS, randallli

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D1633
2016-09-19 10:20:45 -04:00
Adrian Secord
8c3af252be Adding AUTHORS and removing CONTRIBUTORS.txt.
We can credit any contributor who would like to be credited this way, by adding them on request to the AUTHORS file. The copyright statement changes are required for this to work. Note that this has...

Summary:

We can credit any contributor who would like to be credited this way, by adding them on request to the AUTHORS file. The copyright statement changes are required for this to work. Note that this has no legal change, since the contributors always retained their copyright despite the copyright notice, but it's a nice acknowledgement.

Changed copyright statement to include non-Google authors.

Command run:

find * \( -name '*\.m' -or -name '*\.h' -or -name '*\.swift' \) -and -not \( -path 'scripts/external*' -name Pods  \) -print0 | xargs -0 sed -i '' 's/Copyright \(.*\) Google Inc/Copyright \1 the Material Components for iOS authors/'

Added non-source files.

Command run:

grep -Rl 'Copyright .* Google Inc' * --exclude-dir scripts/external --null | xargs -0 sed -i '' 's/Copyright \(.*\) Google Inc/Copyright \1 the Material Components for iOS authors/'

Reviewers: featherless, O1 Material components iOS, randallli

Reviewed By: O1 Material components iOS, randallli

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D1415
2016-08-08 08:16:37 -07:00
Sam Morrison
10e11da725 Remove ARC guards from MDC
Reviewers: O1 Material components iOS, ajsecord

Reviewed By: O1 Material components iOS, ajsecord

Subscribers: ajsecord

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D1304
2016-07-22 11:38:27 -04:00
Chris Cox
627206634f [Collections] Adds storyboard example.
Reviewers: O1 Material components iOS, iangordon

Reviewed By: O1 Material components iOS, iangordon

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D1192
2016-07-12 11:22:36 -04:00
Adrian Secord
3aedace959 Re-enabled 100-character line limit.
Reviewers: randallli, O1 Material components iOS

Reviewed By: randallli, O1 Material components iOS

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D965
2016-06-13 13:34:57 -04:00
Chris Cox
f5d26d4b84 [Collections] Fixes bug when setting own collection view on MDCCollectionViewController. Also adds editing in example.
Summary: Closes https://github.com/google/material-components-ios/issues/542

Reviewers: O1 Material components iOS, ajsecord

Reviewed By: O1 Material components iOS, ajsecord

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D897
2016-05-27 11:27:38 -04:00
Chris Cox
6c8ca27405 [Collections] Adds API to allow setting cell ink color at given index path.
Reviewers: ajsecord, #mdc_ios_owners

Reviewed By: ajsecord, #mdc_ios_owners

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D857
2016-05-11 10:19:18 -04:00
Chris Cox
86174317b3 [Collections]! Updates ink to fire on cell highlight/unhighlight for faster response. Also adds demo to catalog.
Summary: Closes https://github.com/google/material-components-ios/issues/498

Reviewers: ajsecord, #mdc_ios_owners, featherless

Reviewed By: #mdc_ios_owners, featherless

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D848
2016-05-09 16:39:16 -04:00
Chris Cox
4e79ce507f [Collections] Adds lightweight generics to NSArray of NSIndexPath
Summary: Closes https://github.com/google/material-components-ios/issues/488

Reviewers: #mdc_ios_owners, ajsecord

Reviewed By: #mdc_ios_owners, ajsecord

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D832
2016-05-05 15:38:29 -04:00
Chris Cox
2e08c3768d [Collections] Adds example of subclass providing own collection view.
Reviewers: #mdc_ios_owners, ajsecord

Reviewed By: #mdc_ios_owners, ajsecord

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D816
2016-05-04 10:43:23 -04:00
Chris Cox
787c09ddb0 [Collections] Updates editing example and readme to reverse sort order index paths before removal.
Reviewers: ajsecord, randallli, #mdc_ios_owners

Reviewed By: randallli, #mdc_ios_owners

Subscribers: randallli

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D797
2016-05-02 14:26:22 -04:00