64 Commits

Author SHA1 Message Date
Yarden Eitan
29d760c7d6
Added isPresentable to catalog files, ported over ZShadow to dragons. (#2726) 2017-12-15 12:20:35 -05:00
ianegordon
4befe61f74
[Buttons] Add a custom font property (#2715)
* [Button] Add custom font properties

* Add example and tests

* Add sample supporting custom font and dynamic type

* Clean up tests

* Fix C&P error in Copyright date.

* Remove outdated warning

* Fix misuse of standardFont and simplify scale invocation.
2017-12-14 11:48:17 -05:00
Randall Li
00611df7bd
[Buttons] Corrected imports in examples. (#2645)
* [Buttons] Corrected imports in examples.

PiperOrigin-RevId: 175377616

* added import UIKit
2017-12-08 11:40:03 -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
Robert Moore
f01c39d050 [Buttons] Readability for newlines (#2568)
Moving assignment/boolean operators to previous lines.

PR feedback for #2563
2017-12-04 18:09:05 -05:00
Robert Moore
2d8333d7d8 [Buttons] Extended FAB (#2563)
* [Buttons] Remove .largeIcon shape from FloatingButton (#2513)

The LargeIcon shape is not required, since the same behavior (support
for 36-point images) can be achieved by setting the contentEdgeInsets to
.zero.

Also updates one of the button examples to use a 36-point icon.

* [Buttons] Add extended FAB layout code (#2528)

Creating (internal for now) the required properties and layout code to support
the extended FAB. Unit tests to confirm the behavior and some minor
adjustments to existing values like default contentEdgeInsets values.

Implements #2495

* [Buttons] Expose Extended FAB properties (#2543)

Making the new properties public and also migrating away from simple
property setters to the new forShape:inMode: setters required for
UIAppearance support.

* minimumSize
* maximumSize
* contentEdgeInsets
* hitAreaInsets

Implements #2495

* [Buttons] Add basic Floating Button example (#2554)

Includes automatic adjustment of extended/normal layout depending on size
classes.

Demonstrates #2495

* [Buttons] Update README for Extended FAB (#2561)

The README includes usage examples for the FAB. Adding a section to
demonstrate how to configure the FAB in its different shapes and modes.

Documents #2495
2017-12-04 12:55:55 -05:00
Randall Li
2f29f00d86 Fixed some compiler warnings (#2426)
* Added warnings to examples.

* fixed some warnings

* using button sender parameter.

* use button sender in example

* use button sender in example

* removed sender from methods that don’t use it.

* removed sender from methods that don’t use it.

* use button sender in example

* use button sender in example

* use button sender in example

* use button sender in example

* Fixed init of header configurator to use passed in parameter

* removed unused API

* use button sender in example

* Revert "Added warnings to examples."

This reverts commit 91f0480f86cb609c47b00f1346f82de67c31c4e9.

* fixed example: Using the view controllers navigationItem rather than creating a new one.

* removed finished checks from animation blocks in examples.

* reverted id sender checks

* revert id sender check for Flexible header UINavigationBar

* revert clug

* revert clug

* addressing nits

* removed sender check for FeatureHighlightTypicalUseView

* more nits
2017-11-22 10:51:55 -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
Robert Moore
108aa31fb9 [Buttons] Fix example storyboard module (#2427)
The Storyboard example had the wrong module name (catalog) instead of
the "examples" module.

Closes #2425
2017-11-15 11:59:16 -05:00
Martin Petrov
f98a9d42ed @objc annoaing catalog by convention (#2305) 2017-10-30 10:24:17 -04:00
Cody Weaver
1c7c9cd541 Update layout constraint to offset buttons by 20pt upwards, move catalog functions into extension (#2194) 2017-10-16 22:47:40 -04:00
Adrian Secord
f49aaa823c Change MDCButton to use MDCShadowElevation type instead of CGFloat. Fixes #2105. 2017-10-10 12:19:34 -04:00
Cody Weaver
4e4c06fd8d [Swiftlint][Buttons] Refactor ButtonsStoryboardAndProgrammatic.swift (#2060)
Reduce the length of `viewDidLoad` and move Catalog by Convention methods into an extension.

Closes #2048
2017-09-28 20:40:49 +09:00
Robert Moore
d44164290f [Catalog] Fix button examples (#2047)
The FAB in Typical Use was misaligned, resulting in a blurry image. The
Storyboard and Swift example had misaligned buttons due to
safeAreaInsets on iOS 11.
2017-09-27 23:58:17 +09:00
Sam Morrison
0e3b57c785 Revert [Buttons] Deprecate subclassing to set cornerRadius and contentEdgeInsets (#1896) (#1948)
* [Buttons] Deprecate subclassing cornerRadius and defaultContentEdgeInsets

    * Remove unused import

    * Set contentEdgeInsets via UIAppearance

    * Content edge insets comment

    * Use correct value for FAB hit area insets

    * Fix FAB contentEdgeInsets
2017-09-05 14:15:58 -04:00
Sam Morrison
3951775187 [Buttons] Deprecate subclassing to set cornerRadius and contentEdgeInsets (#1896)
* [Buttons] Deprecate subclassing cornerRadius and defaultContentEdgeInsets

* Remove unused import

* Set contentEdgeInsets via UIAppearance

* Content edge insets comment

* Use correct value for FAB hit area insets

* Fix FAB contentEdgeInsets
2017-08-31 15:06:19 -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
Sam Morrison
e0324dd64b [Buttons] Add state-based border color and width (#1878)
* [Buttons] Add state-based border color and width

* Review improvements

* Explicitly cast to CGFloat
2017-08-25 18:04:04 -04:00
Robert Moore
d5f28a6a4f [Catalog] Fix ButtonsTypicalUse FAB position (#1847)
The Floating Action Button still fails to translate its autoresizing
mask into constraints, making the layout break on iOS 9.

Fixes #1757
2017-08-18 21:09:58 -04:00
Robert Moore
4c6d0ba437 [Catalog] Fix button typical use layout on iOS 9 (#1769)
The manual layout code was disabling automatic constraints generation
and trying to lay-out the view before subviews were laid-out.  The
combination led to broken layout on iOS 9 the first time the view was
loaded.

Resolves #1757
2017-08-10 17:59:24 -04:00
Robert Moore
aaab9e6bb2 [Buttons] Creating animations for FAB appearance (#1755)
The Floating Action Button (FAB) is supposed to "pop-in" to a view when the
view appears. Adding some basic animation code to allow the FAB to be
animated-in and -out of views.
2017-08-10 15:52:49 -04:00
Robert Moore
e03ad370c6 [Math] Align frames to pixel boundaries (#1730)
Adding a new function to realign a CGRect (frame) to pixel boundaries
based on the screen scale. After a review of the catalog, I'm updating
the areas where I found misaligned frames.

Closes #1723
2017-08-07 16:46:32 -04:00
Sam Morrison
04b8ced5a4 [Buttons] Add a stroked button to the examples (#1714) 2017-08-01 15:53:36 -07:00
Sam Morrison
057a430b4b [Buttons] Fix storyboard backgroundColor assignment (#1706)
* Update ButtonsStoryboardAndProgrammatic example with more distinct colors and comment explaining use

* Fix MDCButton for loading colors from storyboard without clobbering values
2017-07-27 13:10:37 -04:00
Robert Moore
cafcbe3544 [Buttons] Unbounded ink aligns to content insets (#1670)
* [Buttons] Unbounded ink aligns to content insets

Unbounded ink should be centered on the content of buttons, but bounded
ink should remain aligned with the bounds of the button.

* Changing Ink behavior for unbounded ink
* Modified Content Rect Insets example in the Catalog

Closes #1669

* Making example buttons have same width
2017-07-21 13:54:27 -04:00
Sam Morrison
4c84b99f2b [Buttons] Deprecate customTitleColor and remove auto-accessibility from setTitleColor (#1609)
* Prefer setTitleColor:forState over customTitleColor

* Mark customTitleColor as deprecated

* Replace customTitleColor implemention

* Replace doc-comment of customTitleColor

* Don't encode customTitleColor

* Remove outdated todo

* Remove outdated comment

* Replace more customTitleColor uses with setTitleColor:forState:

* Update button styles
2017-07-17 16:45:59 -04:00
Martin Petrov
1e14d41091 Explicitly annotating some known ObjC methods. (#1617)
This improves Swift4 compatibility, see:
https://help.apple.com/xcode/mac/current/#/deve838b19a1
2017-07-10 19:46:22 -04:00
Robert Moore
cc57a07918 [Buttons] Ink should ignore content edge insets (#1593)
The `contentEdgeInsets` value of an MDCButton causes the `_inkView` to
realign to match the `contentRect`.  This results in a ripple/highlight
that does not match the position of the button on-screen (doesn't align
with the background).

This commit removes the re-alignment code, so `_inkView` will remain
aligned with the rest of the button's view.
2017-06-30 15:01:40 -04:00
Will Larche
f879c91a90 [Swift] Fixing swift style errors (#1577)
* [TextFields] Linting

* [Catalog] Swift style.

* [Catalog] Swift style.

* [Buttons] Swift style.

* [FlexibleHeader] Swift style.

* [NavBar] Swift style.

* [Snackbar] Swift style.

* [Tabs] Swift style.
2017-06-27 12:36:21 -04:00
Junius Gunaratne
2873e798f2 [Themes] Add ability to change catalog theme (#1477)
Discussed merge with Ian offline. Issues with Travis CI may be resolved once the PR is merged.

* Add color to tiles.

* Add theming to catalog

* Update text field tile.

* Implementation method signatures should match those in header.

* Update MDCDrawFunc typedef

* Pass color scheme through NSNotification

* Add component theming

* Add tabbar themer

* Update tab example to use UIAppearance

* Theme sliders based on UIAppearance proxy

* Allow any class conforming to MDCColorScheme

* Override navigation bar color theme for imagery example.

* Update AppBar and ButtonBar color theming

* Update button bar themer comment

* Update button theming

* Remove theme imports where not necessary.

* Fix case of private
2017-06-23 11:36:48 -04:00
Alastair Tse
4a46c8c19e Monochromatic sweep of all catalog components (#1370)
* Replace MDC all icons

* Update border

* Replace MDCActionExtension icon with new logo

* Update all headers to be white on black

* Make Catalog greyscale to match Material’s style.

* Fix collection tile

* Update all headers to be white on black

* Make Catalog greyscale to match Material’s style.

* Fix collection tile

* WIP: Updating TabBar example to use black/green theme.

* WIP: Monochoroming all examples.

* Switch MDC Catalog to a black and white theme (#1355)

* Replace MDC all icons

* Update border

* Replace MDCActionExtension icon with new logo

* Update all headers to be white on black

* Make Catalog greyscale to match Material’s style.

* Fix collection tile

* Update all headers to be white on black

* Make Catalog greyscale to match Material’s style.

* Fix collection tile

* Fix floats

* Make Catalog greyscale to match Material’s style.

* More black and whiting

* WIP: Snackbar and global style

* Simplify snack bar examples.

* Page control
2017-05-05 16:16:47 -04:00
Will Larche
8c5350de31 [All] Formatting. (#1269) 2017-03-22 12:18:15 -04:00
ianegordon
05d0ad2074 [Button] Add Dynamic Type support (#1211)
* [Button] Add Dynamic Type support
2017-02-16 10:43:55 -05:00
Adrian Secord
7ff646b58a [Swiftlint] Moar swiftlint fixes (#1155)
* Quieted swiftlint down in scripts/format_all.

* BONUS clang-format for ObjC code.

* Fixed two stray ObjC warnings (not swiftlint related).

* Fixed remaning swiftlint warnings.

* Fixed typos in Shrine fixes.

* Swift cleanups, again.

This reverts commit 7489fca4e4741ae02b406cdaacaf1dae26e19837.
2017-01-25 17:23:20 -05:00
Adrian Secord
7489fca4e4 Revert "Swift cleanups."
This reverts commit 129789c601a2bb6b09648af953c5433ebe3cebe0.
2017-01-25 16:58:40 -05:00
Adrian Secord
129789c601 Swift cleanups. 2017-01-25 16:56:24 -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
Sam Symons
bb561ac257 [Scripts] SwiftLint integration (#1129)
* Integrate SwiftLint in the Catalog.

* Update the disabled SwiftLint rules.

* Reference a local swiftlint.yml symlink.

This prevents us from getting warnings about code style violations from the other demos.

* Fix SwiftLint violations in the Catalog and Components.

* Ignore the `third_party` directory when running the linter.

We should not have to deal with warnings in code we may not be able to fix easily.

* Integrate SwiftLint into Shrine.

Additionally, fix a number of warnings introduced.

* Run SwiftLint on Travis.

* Enable many of the previously disabled rules and correct them.

* Fix control statement violations from SwiftLint.
2017-01-06 16:37:23 -05:00
Sam Symons
94a6d589e0 [Catalog] Center views in the Buttons (Swift and Storyboard) demo (#1126)
* Center the Storyboard button demo.

This uses an outer container to set up a view which is 50% the screen width (to allow for the other half of the button demo), and then an inner container to vertically and horizontally center the buttons.

* Center the buttons added programatically.
2017-01-04 17:46:45 -05:00
Adrian Secord
e93a16ca02 Capitalize "Material" in documentation (#1014)
* s/material design/Material Design/g

* s/material components/Material Components/g

* s/material\([ \t\n]\)/Material\1/g

* s/aterial design/aterial Design/g
2016-12-13 08:06:55 -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
Sam Morrison
dff304e062 Add missing license headers (#900) 2016-11-30 09:43:22 -05:00
Junius Gunaratne
4596b7c861 [MDCFloatingButton] Floating action button should use a shape rather than text (#833)
* [MDCInkView] cancelAllAnimationsAnimated should support disabling animation

* [MDCProgressView] Allow completion block to be modified if setHidden:animated:completion is called sequentially

* Call completion block immediately rather than storing as a property.

* Add nil check for completion block

* [Shrine] Update to Swift 3

* [AppBar] Add Objective C AppBar storyboard example

* Add right button bar item to AppBar swift demo

* Add plus shape icon to FAB

* Move plus symbol to example code

* Add plus icon asset, move to supplemental

* Remove unused methods

* Undo change to print.

* Move plus CAShapeLayer code into its own method

* Remove plus path method

* Use supplemental method to get plus symbol CAShapeLayer
2016-11-16 13:31:59 -05: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
randallli
681cc2b6f7 [Docs] Replaced incorrect name of the product. Material Components *for* iOS
Summary:
s/material components ios/Material Components for iOS/
s/material components for ios/Material Components for iOS/

lint copy edit line length

Reviewers: ajsecord, O1 Material components iOS

Reviewed By: ajsecord, O1 Material components iOS

Subscribers: ajsecord

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D1372
2016-08-01 16:45:12 -07:00
Adrian Secord
65a05eed31 Lowercase "material design" in text.
Summary: "Material design" is not capitalized except when referring to the actual Material Design team at Google.

Reviewers: O1 Material components iOS, randallli

Reviewed By: O1 Material components iOS, randallli

Subscribers: randallli, featherless

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D1306
2016-07-25 14:13:08 -04:00
Ian Gordon
0aef4c3e08 Reverting D1250 pending further investigation.
Summary: This reverts commit c06e244794116e7cbf54e0334fee059b5bd41c49.

Test Plan: revert-hammer

Reviewers:

Subscribers:
2016-07-18 16:32:40 -04:00
Ian Gordon
c06e244794 [Buttons] Explicitly set default title color for flat buttons
Summary: Use the default value in our example

Test Plan: UI change is visible in the Button Storyboard and Programmatic sample.

Reviewers: randallli, O1 Material components iOS

Reviewed By: randallli, O1 Material components iOS

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D1250
2016-07-18 14:38:43 -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
Eric Li
25ea19e76a updated examples and readme to use new swift selector syntax
Summary:
Updated project to use new swift #selector syntax

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

Reviewers: featherless, O1 Material components iOS

Reviewed By: featherless, O1 Material components iOS

Subscribers: featherless

Tags: #material_components_ios

Differential Revision: http://codereview.cc/D938
2016-06-06 15:43:37 -04:00