371 Commits

Author SHA1 Message Date
Yarden Eitan
5a4f5baac6 [AppBar] Deprecate AppBar color themer APIs.
PiperOrigin-RevId: 333371966
2020-09-23 14:23:36 -07:00
Yarden Eitan
bf90886353 [AppBar] Deprecate API from MDCAppBarNavigationController.
PiperOrigin-RevId: 333366853
2020-09-23 14:08:37 -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
2445d52589 [AppBar] Remove redundant To Be Deprecated annotation.
PiperOrigin-RevId: 318503719
2020-06-26 10:59:09 -07:00
Andrew Overton
b205164477 Delete obsolete markdown files
As I've gone through and replaced all the READMEs I haven't always been good at deleting the markdown files that were stitched together to make the old READMEs. This PR removes all the ones I forgot to remove. All the relevant material in these files is already in the new READMEs, so we're not losing anything by doing this.

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/10029 from andrewoverton:delete-unused-docs 65ea55253af300ea7a4c13ea4ce14976097a6253
PiperOrigin-RevId: 318079032
2020-06-24 09:31:01 -07:00
Jeff Verkoeyen
b78737be48 [AppBar] Inject AppBars after view controllers have been added to the navigation controller.
Before this change, it was never possible to interact with the navigationController property in a pushed view controller's viewDidLoad property when using MDCAppBarNavigationController. This behavior is surprising for folks using UINavigationController, which does allow you to access navigationController from within viewDidLoad.

This expectation is an anti-pattern (e.g. viewDidLoad is never guaranteed to be invoked after a view controller has been pushed onto a navigationController stack), but the goal of MDCAppBarNavigationController is to provide a drop-in replacement for UINavigationController so our intent is to align behaviors, even if they're not necessarily for the right reasons.

All that being said, the change introduced in this CL simply swaps the ordering of pushing the view controller and injecting the AppBar, such that the injection now happens after the super implementation of pushViewController has been invoked. This allows the viewDidLoad logic to be invoked after navigationController has been initialized on the view controller.

The reason we were doing it the other way before was so that the AppBar could intercept the relevant status bar appearance events. We work around that requirement in this change by invoking setNeedsStatusBarAppearanceUpdate and setNeedsUpdateOfHomeIndicatorAutoHidden immediately after injecting the AppBar.

PiperOrigin-RevId: 313410464
2020-05-27 10:06:04 -07:00
Galia Kaufman
09171d15c7 [AppBar] Fix a failing snapshot test
PiperOrigin-RevId: 312260009
2020-05-19 05:29:15 -07:00
Jeff Verkoeyen
e479b366e7 [AppBar] Roll-back "inject AppBars after view controllers have been added to the navigation controller."
PiperOrigin-RevId: 311550067
2020-05-14 09:47:14 -07:00
Jeff Verkoeyen
c0b4ff9cb3 [AppBar] Inject AppBars after view controllers have been added to the navigation controller.
Before this change, it was never possible to interact with the navigationController property in a pushed view controller's viewDidLoad property when using MDCAppBarNavigationController. This behavior is surprising for folks using UINavigationController, which does allow you to access navigationController from within viewDidLoad.

This expectation is an anti-pattern (e.g. viewDidLoad is never guaranteed to be invoked after a view controller has been pushed onto a navigationController stack), but the goal of MDCAppBarNavigationController is to provide a drop-in replacement for UINavigationController so our intent is to align behaviors, even if they're not necessarily for the right reasons.

All that being said, the change introduced in this CL simply swaps the ordering of pushing the view controller and injecting the AppBar, such that the injection now happens after the super implementation of pushViewController has been invoked. This allows the viewDidLoad logic to be invoked after navigationController has been initialized on the view controller.

The reason we were doing it the other way before was so that the AppBar could intercept the relevant status bar appearance events. We work around that requirement in this change by invoking setNeedsStatusBarAppearanceUpdate and setNeedsUpdateOfHomeIndicatorAutoHidden immediately after injecting the AppBar.

PiperOrigin-RevId: 311342757
2020-05-13 09:29:59 -07:00
Jeff Verkoeyen
dbb9ab1170 [AppBar] Add NavigationController example with AppBar initially hidden.
Note that this new example demonstrates a bug in which the AppBar is not, in fact, hidden when presented.

PiperOrigin-RevId: 311104930
2020-05-13 14:41:30 +00:00
Jeff Verkoeyen
a502ce66b9 [FlexibleHeader] Ensure that the FlexibleHeader's position reacts to safeAreaInsets changes when hidden.
## The bug

Repro steps:

1. Open MDCDragons on an iPhone with a notch.
2. Open App Bar -> Presented hidden.
3. Present the App Bar.
4. Observe.

Expected behavior:
- The AppBar is completely hidden.

Actual behavior:
- The AppBar is partially hidden.

## Root cause analysis

When the FlexibleHeader is hidden using shiftHeaderOffScreenAnimated:, the expectation is that the header will be shifted entirely off-screen. If this method is invoked before the FlexibleHeader is attached to a window hierarchy, then the offset applied to shift the header off-screen may not correctly include the necessary safe area insets to hide the header fully.

When flexibleHeaderSafeAreaTopSafeAreaInsetDidChange was being invoked after the safe area insets were made available to the FlexibleHeader, we were not taking into consideration whether the FlexibleHeader was supposed to be hidden which resulted in the FlexibleHeader getting stuck in a partially hidden state.

## The fix

In flexibleHeaderSafeAreaTopSafeAreaInsetDidChange, we now check whether the FlexibleHeader wants to be hidden and, if it does (and we're not already animating it), we immediately snap the FlexibleHeader to the new necessary offset.

PiperOrigin-RevId: 311104051
2020-05-13 14:40:20 +00:00
Jeff Verkoeyen
97702e8b0c [AppBar] Make the presented hidden example show a new view controller each time.
The example was reusing the same view controller instance after each presentation, which made it difficult to consistently test the same buggy behavior.

PiperOrigin-RevId: 310980123
2020-05-12 15:11:46 -04:00
Jeff Verkoeyen
3b99d09c69 [AppBar] Add a presented hidden example.
This example demonstrates a bug where the AppBar does not appear to respect shiftHeaderOffScreenAnimated: when the shiftBehavior is set to hideable.

PiperOrigin-RevId: 310898136
2020-05-11 06:18:08 -07:00
Jeff Verkoeyen
459066d00e [AppBar] Don't hide the navigation bar in AppBarNavigationControllerExample.
This example doesn't actually manage its own app bar; it only presents one. This fixes a bug where the example did not show a navigation bar at all.

PiperOrigin-RevId: 310870101
2020-05-11 02:13:39 -07:00
Jeff Verkoeyen
580a1ecbde [AppBar] Clarify the purpose of the example supplemental view controllers.
The prior names of composed vs inherited didn't meaningfully translate to the intended purpose of the two view controllers, which is to provide harnesses within which the flexible header can be placed either as a child or as a sibling to its tracking scroll view. This distinction is important because the flexible header behaves differently when it is a child of its tracking scroll view, as is the case when using UITableViewController.

PiperOrigin-RevId: 310869953
2020-05-11 02:11:26 -07:00
Jeff Verkoeyen
783c9de40e [AppBar] Extract a sample app bar view controller to supplemental.
This controller will be reused in other examples.

PiperOrigin-RevId: 310869906
2020-05-11 02:08:50 -07:00
Andrew Overton
7814b0c460 Replace App Bar docs
This PR replaces the AppBar README. The content is mostly the same, I just had to restructure it in order to fit the new template.

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

PiperOrigin-RevId: 309097690
2020-04-29 14:32:52 -07:00
Nobody
e035d70f50 Project import generated by Copybara.
PiperOrigin-RevId: 309039129
2020-04-29 17:00:59 +00: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
25471afea0 Rename "flaky" to "skip_snapshots".
PiperOrigin-RevId: 308259307
2020-04-24 08:34:12 -07:00
Jeff Verkoeyen
776dacc084 [AppBar] Mark the webview examples as flaky.
PiperOrigin-RevId: 308252919
2020-04-24 07:51:05 -07:00
Jeff Verkoeyen
de34b1cbfd [AppBar] Implement catalogShouldHideNavigation in all examples.
Implementing this method ensures that the navigation bar is hidden when these examples are shown.

PiperOrigin-RevId: 308044966
2020-04-23 07:21:30 -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
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
Yarden Eitan
13b6382861 [AppBar] Fix AppBar from jumping when contentOffset updates when VoiceOver is on.
The problem occurs because the transform of the flexible header view's Y positioning based on the contentOffset is not done in coordination with the scroll view animation.

Similarly to the jumping effect in https://github.com/material-components/material-components-ios/pull/9872 , we coordinate the transform when VoiceOver is on with the scroll view content offset change.

This was tested with the Expandable Cells example and the glitch is fixed.

PiperOrigin-RevId: 304352119
2020-04-02 01:45:33 -07:00
Yarden Eitan
5e99873e05 [AppBar] Add example to dragons to demonstrate AppBar crash when VoiceOver is turned on and contentInset is set.
PiperOrigin-RevId: 303958379
2020-03-31 07:11:52 -07:00
Cody Weaver
fdf87c5995 [MDC/ColorScheme] Remove usage of init within MDC.
We recommend using `initWithDefaults` and we should follow the recommendation. This change removes all usage of `init` within MDC components in order to let us remove that initializer from the public surface.

PiperOrigin-RevId: 302958447
2020-03-25 13:36:51 -07:00
Bryan Oltman
bf2e9af1a7 [AppBar] Move protocol definitions into separate header files
PiperOrigin-RevId: 301860566
2020-03-19 11:42:25 -07:00
featherless
9ea7f0d21a
[AppBar] Add a delegate for customizing accessibilityPerformEscape behavior. (#9879)
MDCAppBarViewController has a new delegate property with an optional method, `-appBarViewControllerAccessibilityPerformEscape:`. This method can be implemented to override the default behavior of MDCAppBarViewController when an accessibilityPerformEscape event is received.

Closes https://github.com/material-components/material-components-ios/issues/9576
2020-03-15 09:54:31 -04:00
featherless
c58d4d8abd
[AppBar] Test the UINavigationController accessibilityPerformEscape behavior. (#9876)
Pre-work for https://github.com/material-components/material-components-ios/issues/9576
2020-03-12 13:57:24 -04:00
featherless
027f240063
[AppBar] Add AppBarCustomButtonThemeExample. (#9883)
This example demonstrates the recommended way to create a custom-themed button in the AppBar.

![Simulator Screen Shot - iPhone 8 Plus - 2020-03-11 at 13 56 04](https://user-images.githubusercontent.com/45670/76448011-11a27c80-63a0-11ea-8d37-cbde277e4db0.png)

Closes https://github.com/material-components/material-components-ios/issues/9007
2020-03-12 13:34:59 -04:00
featherless
e6989ce5e3
[AppBar] Add AppBarWithExpandableCells example. (#9873)
This example demonstrates a bug where the AppBar will "jump" with the following repro steps:

1. Open the example.
2. Tap any cell.
3. Scroll the tapped cell until it is above the AppBar.
4. Tap any other cell.

Expected behavior: the AppBar stays in place while the cell heights change.

Actual behavior: the AppBar "jumps" up and then animates back into place.

This is pre-work for https://github.com/material-components/material-components-ios/issues/9853
2020-03-11 11:12:30 -04:00
Nobody
a409da4cf0 internal change
PiperOrigin-RevId: 293283016
2020-02-04 19:51:57 -08:00
Jeff Verkoeyen
5fc9ec512e [AppBar] Add an AppBar Theming example.
This example provides a toggle between Primary and Surface theming of the AppBar.

PiperOrigin-RevId: 292541295
2020-01-31 07:31:32 -08:00
featherless
85150487fc [AppBar] Always apply the default shadow behavior when theming.
Both Primary and Surface theming are expected to have a shadow when scrolled. See https://material.io/components/app-bars-top/#theming for more details.

This fixes a bug where the AppBar's Primary theming implementation would set a shadow layer that would not react to scrolling.

Example before/after of a Surface-themed app bar (note the darker shadow in alignment with the expected behavior)

| Before | After |
|:--|:--|
| ![before](https://user-images.githubusercontent.com/45670/73462821-5e7b4800-434a-11ea-97e9-b6ed8a05696d.png) | ![after](https://user-images.githubusercontent.com/45670/73462834-61763880-434a-11ea-8114-6712e397fe3d.png) |

Related to https://github.com/material-components/material-components-ios/issues/6332

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/9529 from jverkoey:theming 62ba0b8d84b204833164745d823002c3f4faf0eb
PiperOrigin-RevId: 292526419
2020-01-31 05:11:41 -08:00
Jeff Verkoeyen
26bca1a6af [AppBar] Add a snapshot test for a scrolled app bar.
This test will enable us to validate changes in shadow layer behavior for scrolled app bars.

PiperOrigin-RevId: 292434992
2020-01-30 15:20:40 -08:00
Jeff Verkoeyen
d17144ee68 [AppBar] Minor clarification to example documentation.
PiperOrigin-RevId: 291942763
2020-01-28 08:57:06 -08:00
Jeff Verkoeyen
e00414aaf1 merged release-candidate 2020-01-24 08:49:03 -05:00
featherless
53ab07d693
[AppBar] Fix swipe to go back gesture for MDCAppBarNavigationController. (#9448)
https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/gestures/

"But users can also navigate back by swiping from the side of the screen."

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

Tested manually on:

- iPhone 7, 11.2
- iPhone X, 12.2
- iPhone 8 Plus, 13.2.2

## Testing Steps
1. Set MDCAppBarNavigationController as the root view controller
2. Push a view controller.
3. Swipe from the trailing edge toward the leading edge.

Tested by running the MDCCatalog and verifying that I can swipe to dismiss pushed view controllers on the root navigation controller.
2020-01-22 12:10:58 -05:00
featherless
8f80efe08d [AppBar] Annotate MDCAppBarNavigationControllerDelegate's appBarNavigationController:willAddAppBar:asChildOfViewController: as to be deprecated. (#9395)
Part of https://github.com/material-components/material-components-ios/issues/9392
2020-01-21 16:21:14 -05:00
featherless
d7c2865c3d
[AppBar] Annotate MDCAppBarContainerViewController's appBar and topLayoutGuideAdjustmentEnabled as to be deprecated. (#9394)
Part of https://github.com/material-components/material-components-ios/issues/9392
2020-01-14 09:20:08 -05:00
featherless
b7cf0de915
[bazel] Remove all unused swift_library load statements. (#9369)
Found by searching for all references to `\bswift_library` and removing load statements from files that only returned one result.

Clean up as part of https://github.com/material-components/material-components-ios/issues/5491
2020-01-02 11:01:31 -05:00
featherless
0a0bc4b47b
[automated] Ran buildifier on all BUILD files. (#9366)
```
find . -name BUILD | xargs buildifier
```

This is in preparation of https://github.com/material-components/material-components-ios/issues/9363
2020-01-02 10:05:07 -05:00
Bryan Oltman
a2eb1dcdbd
[FlexibleHeader] Delete MDCFlexibleHeaderColorThemer (#9351)
Deletes the deprecated `MDCFlexibleHeaderColorThemer`.

Fixes #9286
Fixes #9284
Fixes #9287
Fixes #9285
2019-12-30 10:39:19 -05:00
Bryan Oltman
8febe04908
[FlexibleHeader] Remove uses of MDCFlexibleHeaderColorThemer (#9282)
Removes our use of the newly-deprecated `MDCFlexibleHeaderColorThemer`.

Part of:
#9284
#9285
#9286
#9287
2019-12-13 17:32:21 -05:00
Bryan Oltman
e729515e5c
[FlexibleHeader] Deprecate MDCFlexibleHeaderColorThemer (#9281)
MDCFlexibleHeaderColorThemer was marked as "ToBeDeprecated". This PR performs that deprecation.
2019-12-13 16:21:09 -05:00
Robert Moore
8eb7296dab
[Catalog] Fix container scheme properties. (#9192)
Making remaining examples use protocol for container schemes to match the
project's expected convention.

Found while reviewing #9188
2019-12-09 10:48:25 -05:00
featherless
d0322ef8c2 [AppBar] Rename test cases to match component conventions. (#9038)
Dropping the MDC prefix to match the majority of the other test cases.

Part of https://github.com/material-components/material-components-ios/issues/5185
2019-12-02 08:32:54 -05:00
featherless
ae53242109 [AppBar] Add a shouldSetNavigationBarHiddenHideAppBar behavior flag. (#9001)
This new flag allows view controllers to control the visibility of their app bar via the standard UINavigationController setNavigationBarHidden: APIs. When enabled, calls to these APIs will result in the AppBar's visibility being adjusted.

Closes https://github.com/material-components/material-components-ios/issues/5185
2019-12-02 08:32:13 -05:00
Galia Kaufman
af583a5828
[MDC Dragons] AppBar example has low-contrast text (#8966)
Replacing old "Themers" in "Presented" AppBar example with new theming extensions - in order to improve contrast ratio.
2019-11-15 16:26:03 -05:00