125 Commits

Author SHA1 Message Date
Jeff Verkoeyen
fbb1f20aa2 Internal change
PiperOrigin-RevId: 332151481
2020-09-16 21:01:21 -07:00
Bryan Oltman
da4b8f7c7f Fix mdc_elevationDidChangeBlock block parameter types for Xcode 12
PiperOrigin-RevId: 331843566
2020-09-15 13:39:15 -07:00
Jeff Verkoeyen
453eaa8a9a [BottomAppBar] Fix bug where FAB shadow would "bounce" when the position changed.
There are two related fixes involved here:

1. The horizontal shift animations were using the default CABasicAnimation timing function, Linear. These have been adjusted to EaseInEaseOut to match the guidelines.
2. The shadow was doing a wonky "bounce" animation by always animating to an elevation of 1 followed by an animation to the target elevation. This bounce animation has been removed.

Note that, while the bouncing has been removed, the shadow now does not animate at all. This is intentional for two reasons:

1. The shadow is expected to swap z-ordering with the bottom bar.
2. The animation is very subtle.

The result of these two constraints is that if we animate the shadow to the secondary position, then we need to change the z-order at the end of the animation. This would result in the shadow being "clipped" by the bar as the shadow moves from the foreground to the background. This ends up being more visible than the animation itself, and more distracting than the lack of an animation.

We could animate to the primary position, but at this point handling this logic would add complexity for a very subtle effect that doesn't necessarily improve the effect.

PiperOrigin-RevId: 326713093
2020-08-14 12:59:58 -07:00
Andrew Overton
68fa549cc1 [BottomAppBar] Update links in README
PiperOrigin-RevId: 324077893
2020-07-30 14:05:06 -07:00
Andrew Overton
07c46757cc Replace material.io API doc links with links to the relevant header f…
This PR replaces API links containing "/api-docs/" with links to suitable header files in GitHub because the site previously linked to is being taken down and replaced with something that won't handle API docs.

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/10045 from andrewoverton:replace-mio-api-docs-with-github-links 0d6e56cc11d0c147366a4f6cde829d8b51567ecc
PiperOrigin-RevId: 323424362
2020-07-27 13:09:23 -07:00
Andrew Overton
d6255fa0f4 [BottomAppBar] Material io bottom app bar
This PR replaces the bottom app bar docs

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

PiperOrigin-RevId: 322647459
2020-07-22 13:54:02 -07:00
Alyssa Weiss
eb324d0394 Internal change
PiperOrigin-RevId: 321437366
2020-07-15 14:19:44 -07:00
Nobody
70716800b8 Internal change
PiperOrigin-RevId: 312085611
2020-05-18 16:41:12 +00:00
Andrew Overton
0a36a3a12b [MDC-iOS] Fix broken links
This CL fixes some longstanding and some newly broken links.

PiperOrigin-RevId: 311351416
2020-05-13 10:09:44 -07:00
Andrew Overton
9220d5b801 [BottomAppBar] Have BottomAppBar respect safe area
This change makes it so that the safe area impacts the inset of the floating button in a bottom app bar view.

PiperOrigin-RevId: 309734661
2020-05-04 06:53:52 -07:00
Wenyu Zhang
a3381717f7
Fix the bazel BUILD files and snapshot that were restored unintentionally.(#9983) 2020-04-29 11:00:00 -04:00
Jeff Verkoeyen
bcd0c79ef4 Internal change.
PiperOrigin-RevId: 308358719
2020-04-24 17:42:29 -07:00
Jeff Verkoeyen
25471afea0 Rename "flaky" to "skip_snapshots".
PiperOrigin-RevId: 308259307
2020-04-24 08:34:12 -07:00
Jeff Verkoeyen
92254ea119 Rename all icons to an ic_<#name#> convention.
PiperOrigin-RevId: 308232277
2020-04-24 04:33:51 -07:00
Randall Li
0100cfe414 [MDC-iOS/BottomSheet] Fix dismissOnDraggingDownSheet behavior
The bottom sheet incorrectly allowed the sheet to be drag dismissed when `dismissOnDraggingDownSheet` was set to NO.

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

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

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

PiperOrigin-RevId: 307802500
2020-04-22 06:21:26 -07:00
Cody Weaver
cd30e764c2 [MDC/BottomAppBar] Add MDCRipple support to MDCBottomAppBarView
Clients may want to support ripple throughout their application and be using MDCBottomAppBar. Since the bottom app bar does not expose it's navigation bar we need to have a pass through property to enable the ripple in the navigation bar. Users shouldn't get any ripple effect on the bar itself so we don't need any additional support other than what the navigation bar has. If clients want to enable it on the floating action button that is exposed so they can do so. This change also allows them to customize the ripple color.

PiperOrigin-RevId: 306278679
2020-04-13 12:00:45 -07:00
Jeff Verkoeyen
8abbb099a9 Delete all bazel support.
We no longer support bazel.

This PR deletes everything related to bazel support from our repo.

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

PiperOrigin-RevId: 306227127
2020-04-13 07:13:47 -07:00
Jeff Verkoeyen
c2c1cc64b3 [Catalog] Expose the catalog by convention tree via the AppDelegate and walk the tree with the UI test runner.
This allows our UI test runner to fetch the catalog by convention tree at runtime in order to generate dynamic test runners that walk the entire catalog by convention tree without requiring maintenance of an explicit list of breadcrumbs.

In this change I have replaced the explicit list of components with such a dynamic walker. In a follow-up change we will be able to dynamically walk through every node of the three and take screenshots. In a subsequent change from there we may allow certain nodes to implement "testActionStart" and "testActionStop" methods that allow the test runner to invoke certain canonical actions automatically (e.g. present a dialog).

A couple examples are flaky, so a new convention has been added to those examples of providing a "flaky" tag on the example's metadata. If this flag is YES, then the example will not be snapshotted.

PiperOrigin-RevId: 306214455
2020-04-13 09:26:51 -04:00
Randall Li
a204ee6f8e
[Material][Availability] Migrates BottomAppBar to MDCAvailability. (#9729)
[Material][Availability] Migrates BottomAppBar to MDCAvailability.
2020-02-18 13:41:47 -05:00
Bryan Oltman
3596a5638b
[BottomAppBar] Add intrinsicContentSize (#9290)
* [BottomAppBar] Add snapshot test to verify autolayout bug

* Update snapshot

* [BottomAppBar] Add intrinsicContentSize
2019-12-13 18:08:12 -05:00
Bryan Oltman
2a17b6ef46
[BottomAppBar] Add snapshot test to verify autolayout bug (#9289)
* [BottomAppBar] Add snapshot test to verify autolayout bug

* Update snapshot
2019-12-13 17:50:53 -05:00
Bryan Oltman
68a65d33d3
[BottomAppBar] Delete deprecated MDCBottomAppBarColorThemer (#9166)
MDCBottomAppBarColorThemer has no internal use and is deprecated.

Fixes #9164
Fixes #9165
2019-12-06 17:10:33 -05:00
featherless
5425884431
[examples] Annotate all catalogShouldHideNavigation invocations with @objc. (#8791)
Context:

Due to changes in the Swift runtime over the past years, methods that are considered "optional" in Objective-C need to have @objc annotations in order for Objective-C to be able to perform `respondsToSelector:` invocations.

Problem:
Many of our examples had not annotated their `catalogShouldHideNavigation` methods with the `@objc` annotation, causing the Catalog to wrap the examples in a container app bar view controller. The reason most of these examples would implement `catalogShouldHideNavigation` is because they are managing their own navigation (e.g. to demonstrate AppBar functionality), so this would often result in duplicate AppBars appearing in the example.

The fix:
All `catalogShouldHideNavigation` Swift methods have been annotated with `@objc`.

Fixes https://github.com/material-components/material-components-ios/issues/7576
Fixes https://github.com/material-components/material-components-ios/issues/7578
2019-11-12 16:54:55 -05:00
Robert Moore
8cebc56185
[*] Suppress deprecation warnings. (#8481)
Suppresses deprecation warnings either for implementations of our own
deprecated APIs or for their use in tests and elsewhere.

Part of #7537
2019-09-23 12:48:42 -04:00
featherless
a01712388b
[BottomAppBar] Deprecate the ColorThemer. (#8438)
Part of https://github.com/material-components/material-components-ios/issues/8429

There is no internal usage of this API.
2019-09-11 09:00:36 -04:00
Robert Moore
ff0c94cdf8
[BottomAppBar] Use Starlark macros. (#8156)
Adds the unit test Objective-C Starlark macro to the BUILD file to make
releases easier.

Part of #8150
2019-08-01 15:23:30 -04:00
Robert Moore
1c0827f2ef
[*] Correct elevationDidChangeBlock type. (#8106)
The property type for `elevationDidChangeBlock` declared in `MDCElevatable` should not be changed when declaring the property in headers. If it is, the compiler can generate a warning or error because the types are incompatible.

Closes #8105
2019-07-29 08:08:39 -04:00
Bryan Oltman
02a707a5b4
[BottomAppBar] Add conformance to MDCElevatable, MDCElevationOverriding (#8094)
* [BottomAppBar] Add conformance to MDCElevatable, MDCElevationOverriding

* PR feedback
2019-07-26 14:49:26 -04:00
Robert Moore
db4b31e1ed
[BottomAppBar] Remove no-op tests. (#8072) 2019-07-24 14:59:23 -04:00
Robert Moore
8dcf1e4a56
[*] Remove RTL snapshot method overrides. (#7996)
With #7986, most snapshot tests began overriding a method that had nearly the
same behavior.
2019-07-22 21:11:17 -07:00
Wenyu Zhang
bc4a297012
[BottomAppBar] add support for dynamic color. (#7975)
closes https://github.com/material-components/material-components-ios/issues/7883.
2019-07-22 00:43:35 -04:00
Cody Weaver
ce0ab9122e
[BottomAppBar] Add traitCollectionDidChange block (#7930)
The bottom app bar needs an API so clients can hook-in to trait collection changes. This additionally passes the bottom app bar as a parameter so clients can modify the bottom app bar within the block.

Closes #7927
2019-07-16 05:13:16 -07:00
featherless
9c8e34138a
[Buttons] Remove all example references to MDCFloatingActionButtonThemer. (#7505)
This is pre-work for being able to annotate MDCFloatingActionButtonThemer as deprecated.

Part of https://github.com/material-components/material-components-ios/issues/5702
2019-06-17 20:59:33 -04:00
Yarden Eitan
efe61588a6
update (#7246)
We need to add @objc annotations to colorScheme and typographyScheme instances in our Swift examples, because we moved to Swift 4.2, the respondsToSelector won't find `setColorScheme:` and `setTypographyScheme:` setters otherwise.
2019-04-23 10:21:14 -04:00
featherless
5e8360e2fa [BottomAppBar] Annotate themer APIs with the recommended APIs. (#7214)
Part of https://github.com/material-components/material-components-ios/issues/7108
2019-04-22 12:39:54 -04:00
Andrew Overton
c56d5d76d3
Add @objc annotations to get examples to show up in Dragons (#7168)
This is a follow up PR for #7166 adds @objc annotations to Swift catalogMetadata() methods, because the Swift 4 compiler no longer attempts to infer what methods should be visible to Objective-C. As a result of this change in the compiler, no Swift examples were showing up in Dragons after #7166. See this article: https://useyourloaf.com/blog/objc-warnings-upgrading-to-swift-4/ for additional context.
2019-04-17 21:35:43 -04:00
Andrew Overton
b38372192f
Update to Swift 4.2 (#7166)
This PR updates the Swift version to 4.2.

Partially resolves #6874.
2019-04-17 16:59:02 -04:00
Yarden Eitan
c4d24627ee
updated jazzy yaml files to include framework root (#6750)
We have had errors when generating the docs using jazzy specifically around components giving a fatal error around not finding imports when depending on other components. This is because each component for jazzy is isolated and on its own unless we provide the framework root. This caused our website generator to crash each time and fail to generate a new website.

This should resolve this problem.

QA=
Before the fix when running the website generator we got these errors:
```
/material-components-ios/components/BottomAppBar/src/MDCBottomAppBarView.h:17:9: fatal error: 'MaterialButtons.h' file not found
building site
building search index
^C/Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge/lexer.rb:458:in `load': Interrupt
	from /Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge/lexer.rb:458:in `load_lexer'
	from /Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge.rb:50:in `block in <top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge.rb:49:in `each'
	from /Library/Ruby/Gems/2.3.0/gems/rouge-3.1.1/lib/rouge.rb:49:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/jazzy_markdown.rb:2:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/jazzy_markdown.rb:2:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/doc.rb:7:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/doc.rb:7:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/config.rb:5:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy/config.rb:5:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy.rb:1:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/lib/jazzy.rb:1:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/bin/jazzy:13:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/jazzy-0.9.3/bin/jazzy:13:in `<top (required)>'
	from /usr/local/bin/jazzy:22:in `load'
	from /usr/local/bin/jazzy:22:in `<top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `load'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:28:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli.rb:463:in `exec'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli.rb:27:in `dispatch'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/cli.rb:18:in `start'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/exe/bundle:30:in `block in <top (required)>'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
	from /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/exe/bundle:22:in `<top (required)>'
	from /usr/local/bin/bundle:22:in `load'
	from /usr/local/bin/bundle:22:in `<main>'
/material-components-site-generator/scripts/lib/reporter.js:36
      throw e;
      ^

Error: Command failed: bundle exec jazzy         --output "/material-components-site-generator/.stage/ios/catalog/bottomnavigation/api-docs/"         --theme "/material-components-site-generator/ios-api-docs-src/theme"         --head '/components'         --use-safe-filenames
    at checkExecSyncError (child_process.js:601:13)
    at execSync (child_process.js:641:13)
    at JazzyApiGenerator.build (/material-components-site-generator/scripts/lib/jazzy-api-generator.js:34:5)
    at PlatformSite.generateApiDocs (/material-components-site-generator/scripts/lib/platform-site.js:212:17)
    at platformSites.forEach (/material-components-site-generator/scripts/build:86:14)
    at Array.forEach (<anonymous>)
    at reporter.step (/material-components-site-generator/scripts/build:85:21)
    at Reporter.step (/material-components-site-generator/scripts/lib/reporter.js:32:22)
    at Object.<anonymous> (/material-components-site-generator/scripts/build:84:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
```
Now we no longer get fatal errors or crash when running the script.
2019-03-01 16:52:02 -05:00
Wenyu Zhang
ea0986d30c
[BottomAppBar] hide swift example from Catalog. (#6725) 2019-02-28 15:26:10 -05:00
Yarden Eitan
71512ff72e reverting 2019-02-26 11:50:30 -05:00
Robert Moore
f1b5318d5e
[ColorScheme] Add test schemes. (#6690)
Adding test schemes useful for unit/snapshot tests where the baseline
scheme is insufficient (for example to verify bindings).
2019-02-22 09:43:42 -05:00
Robert Moore
fb8190d8d4
[BottomAppBar] Add basic snapshot tests. (#6643)
Adding a few simple snapshot tests to capture the default appearance of
the bar.
2019-02-19 09:25:57 -05:00
Robert Moore
ecf420e23e
[BottomAppBar] Fix FAB location when RTL changes. (#6644)
If the `semanticContentAttribute` for an MDCBottomAppBarView changes
during its lifetime, it won't correctly reposition the FAB. Instead of
checking the interface layout orientation once during initialization, it
should check every time it needs to perform layout.

|Before|After|
|---|---|
|<img width="380" alt="testfloatingbuttontrailingrtl_11_2-develop" src="https://user-images.githubusercontent.com/1753199/52929433-6812c800-3312-11e9-8505-07933e1ee077.png">|<img width="380" alt="testfloatingbuttontrailingrtl_11_2 2x" src="https://user-images.githubusercontent.com/1753199/52929438-6ba64f00-3312-11e9-805f-edc2e68cf1a5.png">|

    
Fixes #6642
2019-02-19 08:36:30 -05:00
Peter Friese
e1008e5206 [BottomAppBar] Fix it/bottom app bar cut out (#6420)
[BottomAppBar] Fix it/bottom app bar cut out (#5958)

### Context
FABs can be circular or pill-shaped. As described in #5414, the cutout on BottomAppBar does not take into account pill-shaped FABs.

### The Problem
The UIBezierPath used in the current implementation draws a half circle where the FAB appears. For pill-shaped FABS, this doesn't work, as the cutout needs to made up of two quarter circle and a line connecting them.

### The Fix
I implemented a UIBezierPath that is made up of two quarter circles connected by a line, as well as the remainder of the rectangle that makes up the BottomAppBar's background. By doing so, I was able to provide **one** bezier path for both circular and pill-shaped cutouts, and **one** bezier path for a non-cutout version of the rectangle. This results in a smooth animation between the cutout and non-cutout state.

See https://stackoverflow.com/a/9522806 for an explanation of why the cutout and non-cutout bezier paths need to have the same general structure (e.g. number of path elements, and element types).
2019-02-04 11:16:43 -05:00
Robert Moore
800188a649
{clang-format} Format the components. (#6347)
This is a follow-up to https://github.com/material-components/material-components-ios/pull/6027

```
find components \( -name "*.h" -or -name "*.m" \) | xargs clang-format -i
```
2019-01-23 11:08:43 -05:00
Robert Moore
a3b0031f3f
[BottomAppBar] Formatting BUILD file. (#6355) 2019-01-17 12:14:51 -05:00
Cody Weaver
4be982a5c6
[BottomAppBar] Add examples to BUILD file (#6348)
This change is the part of the move to add all examples to BUILD files, this additionally adds the missing imports in the examples.
Closes #6223
2019-01-16 09:51:13 -05:00
Yarden Eitan
2803125b2c
ran clang-format (#6027) 2019-01-11 13:23:51 -05:00
Yarden Eitan
e30327f8a7 Revert "[BottomAppBar] Fix it/bottom app bar cut out (#5958)"
This reverts commit 068786a9c620e6e760b8f30d414067b1da203808.
2019-01-08 14:59:06 -05:00
Peter Friese
068786a9c6 [BottomAppBar] Fix it/bottom app bar cut out (#5958)
### Context
FABs can be circular or pill-shaped. As described in #5414, the cutout on BottomAppBar does not take into account pill-shaped FABs.

### The Problem
The UIBezierPath used in the current implementation draws a half circle where the FAB appears. For pill-shaped FABS, this doesn't work, as the cutout needs to made up of two quarter circle and a line connecting them.

### The Fix
I implemented a UIBezierPath that is made up of two quarter circles connected by a line, as well as the remainder of the rectangle that makes up the BottomAppBar's background. By doing so, I was able to provide **one** bezier path for both circular and pill-shaped cutouts, and **one** bezier path for a non-cutout version of the rectangle. This results in a smooth animation between the cutout and non-cutout state.

See https://stackoverflow.com/a/9522806 for an explanation of why the cutout and non-cutout bezier paths need to have the same general structure (e.g. number of path elements, and element types).
2019-01-07 17:06:13 -05:00