58 Commits

Author SHA1 Message Date
Bryan Oltman
da4b8f7c7f Fix mdc_elevationDidChangeBlock block parameter types for Xcode 12
PiperOrigin-RevId: 331843566
2020-09-15 13:39:15 -07:00
Nobody
e79fd9b191 [MDCBottomDrawerViewController] Optional dismiss on accessibilityPerformEscape.
This adds a dismissOnAccessibilityPerformEscape bit that allows clients to control whether the bottom drawer should dismiss or not on Z swipe. This is useful for when clients have an extra step before dismissal (e.g. confirmation on dismiss).

PiperOrigin-RevId: 331594189
2020-09-14 20:32:48 +00:00
Nobody
4cba6bbf5c [MDCBottomDrawerViewController] Adds shouldDisplayMobileLandscapeFullscreen property to MDCBottomDrawerContainerViewController and MDCBottomDrawerPresentationController to share the property between MDCBottomDrawerContainerViewController and MDCBottomDrawerViewController.
This adds a new property to MDCBottomDrawerViewController and MDCBottomDrawerContainerViewController that allows for non-fullscreen mobile landscape bottom drawer view.

PiperOrigin-RevId: 327626953
2020-08-20 08:06:39 -07:00
Nobody
d63936f671 [MDCBottomDrawerViewController] Adds shouldDisplayMobileLandscapeFullscreen property to MDCBottomDrawerViewController.
This adds a new property to MDCBottomDrawerViewController that allows for non-fullscreen mobile landscape bottom drawer view.

PiperOrigin-RevId: 327070504
2020-08-17 12:14:11 -07:00
Nobody
f3b77c466b [MDCBottomDrawerViewController] Add new delegate for when scrim is tapped.
This adds a new optional MDCBottomDrawerViewController delegate method for when the scrim is tapped.

PiperOrigin-RevId: 324593723
2020-08-03 06:43:52 -07:00
Cody Weaver
33daf325e6 [MDC/NavDrawer] Support a max height
Currently the NavigationDrawer drawer expands to full screen as a user scrolls, this allows the client to set a maximum height that a navigation drawer can grow to. I tried doing multiple calculations to prevent the drawer from going passed a certain height but that made the component much more complex and still had some bugs. If a client chooses a `maximumDrawerHeight` that goes into the safe area the header will not grow, I am going to address that in a follow up.

PiperOrigin-RevId: 313214108
2020-05-26 10:09:53 -07:00
Yarden Eitan
19c171280b [NavigationDrawer] Add ability to change the maximumInitialDrawerHeight after drawer has been presented.
PiperOrigin-RevId: 292305019
2020-01-30 02:06:23 -08:00
Yarden Eitan
62fc063481 [NavigationDrawer] Adding a flag to allow clients to opt-in to when the preferredContentSize of the contentViewController changes, it visually updates the drawer height.
PiperOrigin-RevId: 292303752
2020-01-30 01:57:11 -08:00
Nobody
c9eba44c69 Implemented opt-in ability to have a "sticky" view, presented behind top safe area, when a headerViewController is not provided (continuation of #9464).
PiperOrigin-RevId: 292038584
2020-01-28 23:01:55 -05:00
Nobody
afe22513f7 Move off of MDCDeviceTopSafeAreaInset (continuation of #9476).
PiperOrigin-RevId: 291998789
2020-01-28 13:17:56 -08:00
Jeff Verkoeyen
e2197af115 Revert "[NavigationDrawer] Enable changing the preferred size and maximum height (#8224)"
This reverts commit 3112e8e228ea7914a111b0f3dbc4ed9919bf24b7.
2020-01-27 07:37:46 -05:00
Jonathan Willing
3112e8e228 [NavigationDrawer] Enable changing the preferred size and maximum height (#8224)
Prior to these changes, changing the maximumInitialDrawerHeight did not have any effect after initial presentation. This adds the ability to modify the value after presentation.

Also enables the ability to change the preferred content size with an animation. If the preferred content size is less than the maximum initial drawer height, the visible portion of the content will be adjusted. Previously, the visible portion would remain the same size, even if more could be shown on screen.

Closes #7369.
2020-01-22 12:50:28 +02:00
Jake Rockland
620d2e27ef [NavigationDrawer] Added ability to account for bottom safe are… (#9321)
Added ability to account for bottom safe area in presentation of initial drawer height, parameterized by default-off flag.

Fixes #9322.

I tried adding unit tests on this, per our conversation @yarneo, but ran into some issues with writing tests around this as: 
1) unit testing for this is difficult as one cannot manually set the `safeAreaInsets` 
2) snapshot testing this requires that the test suite is done on an iPhone X or similar device with bottom insets, which is not the current test device for snapshots as far as I can tell 

I'm happy to add tests but need a bit of guidance regarding how to best test this given the above constraints. I didn't see a test testing the related `shouldIncludeSafeAreaInContentHeight` behavior, which I was looking to use as a test reference, but perhaps could do something similar to: b8090cb638/components/FlexibleHeader/tests/unit/supplemental/FlexibleHeaderTopSafeAreaTestsFakeViewController.m (L90-L94).

Wanted to get your thoughts on this before diving further @yarneo.
2020-01-02 11:26:10 -05:00
Yarden Eitan
ead4785d5c
[NavigationDrawer] allow trackingScrollView to be resettable (#9206)
This allows trackingScrollView to be set to a different value after the drawer has been presented.

Closes #7553

Before gif:
![beforedrawer](https://user-images.githubusercontent.com/4066863/70638889-a4981300-1c07-11ea-97c8-9419132ec867.gif)

After gif:
![afterdrawer](https://user-images.githubusercontent.com/4066863/70638896-a8c43080-1c07-11ea-97e3-dc959723cfa3.gif)
2019-12-11 13:11:17 -05:00
Randall Li
b578f9ee67
[BottomDrawer] Allow touch events to propagate to delegate for MDCBottomNavigationDrawer (#8578)
[BottomDrawer] Allow touch events to propagate to delegate for  MDCBottomNavigationDrawer

Allow the drawer to optionally forward touch events to the delegate for handling. This enables tap thru to the underlying VC if the client needs that behavior.

An example use case would be when the client wants to present the drawer on top of a VC that has controls that they want to still be tappable. For example: A video player or a podcast player with play/pause controls. Then the client VC could still receive the tap event on the control and respond to that and close the drawer at the same time. This would allow the user to save a tap.

this is a second attempt at https://github.com/material-components/material-components-ios/pull/8486

original cl/270318683
2019-10-14 16:29:00 -04:00
Randall Li
a91bf9c2ec
[NavigationDrawer] Add delegate methods to allow the presenting VC to gain access to the transitionCoordinator used during the present/dismiss transitions. (#8566)
[NavigationDrawer] Add delegate methods to allow the presenting VC to gain access to the transitionCoordinator used during the present/dismiss transitions. Also provide callbacks for y-offset changes so that the presenting VC can animate content along with the y-offset changes.

Fixed requests from previous PR and added some tests for the callbacks.

Screen recording of the usage:
https://github.com/material-components/material-components-ios/files/3633638/navdrawer.mov.zip
2019-10-11 15:20:34 -04:00
randallli
306d52355d Revert "[NavDrawer] Allow animations alongside movement in MDCBottomNavigatio… (#8474)"
This reverts commit bf5361b55cc17600317ce4ff2f02e73f1e69e630.
2019-10-03 16:17:28 -04:00
randallli
56cf652a21 Revert "[NavDrawer] Allow touch events to propagate to delegate for MDCBottomNavigationDrawer (#8486)"
This reverts commit 8df9fcdf33d5ead19668f364c6b048ff0bf043e0.
2019-10-03 16:17:19 -04:00
Hiedi Utley
8df9fcdf33 [NavDrawer] Allow touch events to propagate to delegate for MDCBottomNavigationDrawer (#8486)
Allow the drawer to optionally forward touch events to the delegate for handling. This enables tap thru to the underlying VC if the client needs that behavior.

An example use case would be when the client wants to present the drawer on top of a VC that has controls that they want to still be tappable. For example: A video player or a podcast player with play/pause controls. Then the client VC could still receive the tap event on the control and respond to that and close the drawer at the same time. This would allow the user to save a tap.
2019-09-25 17:08:21 -04:00
Cody Weaver
0d30e34a2c
[NavigationDrawer] Allow header to expand even if content doesn't fill screen. (#8484)
Previously the MDCBottomDrawerViewController would not expand the header if the content did not reach full screen. This change makes it so that clients can have the header always expand the header regardless of the total content height. This new behavior is behind a behavioral flag so that clients can opt into this if they would prefer that. This change is so that clients can still have their content visible when the header goes into the safe area.

## Screenshots
_iPhone XS Max_

| Before | After |
| - | - |
|![beforeXSMax](https://user-images.githubusercontent.com/7131294/65453465-15dddc00-ddf8-11e9-9a72-01368a285533.gif)|![largeDeviceAfter](https://user-images.githubusercontent.com/7131294/65453424-052d6600-ddf8-11e9-9d7d-efaa4033cd46.gif)|

_iPhone 4s_

| Before | After |
| - | - |
|![4sbefore](https://user-images.githubusercontent.com/7131294/65453537-458ce400-ddf8-11e9-9725-3a4fa843d58d.gif)|![4safter](https://user-images.githubusercontent.com/7131294/65453548-4d4c8880-ddf8-11e9-9790-28f9fa32142d.gif)|

Closes #7684
2019-09-24 10:30:00 -07:00
Hiedi Utley
bf5361b55c [NavDrawer] Allow animations alongside movement in MDCBottomNavigatio… (#8474)
Add delegate methods to allow the presenting VC to gain access to the transitionCoordinator used during the present/dismiss transitions. Also provide callbacks for y-offset changes so that the presenting VC can animate content along with the y-offset changes.

Fixed requests from previous PR and added some tests for the callbacks.

Screen recording of the usage:

[navdrawer.mov.zip](https://github.com/material-components/material-components-ios/files/3633638/navdrawer.mov.zip)
2019-09-23 11:16:57 -04:00
Yarden Eitan
b8ea85d21a
[NavigationDrawer] Adding MDCElevation support (#8100)
This adds elevation conformance and support to the MDCBottomDrawerViewController.

Closes #8015
2019-07-26 17:50:48 -04:00
Yarden Eitan
7ded643143
[NavigationDrawer] Adds an elevation and shadow to Bottom Drawer. (#8095)
This adds the notion of elevation and a customizable shadow color to the Bottom Drawer.

Addition of unit tests and snapshot tests.

This now allows the Navigation Drawer to properly support MDCElevation as part of the Dark Mode work.
2019-07-26 16:22:07 -04:00
Cody Weaver
5516e8dc0a
[NavigationDrawer] Add traitCollectionDidChange block to presentation controller. (#8009)
Adds a traitCollectionDidChangeBlock to MDCBottomDrawerPresentationController, called when its trait collection changes.
2019-07-23 10:52:15 -07:00
Cody Weaver
e68ae6c57b [NavigationDrawer] Add traitCollectionDidChange block (#8008)
Adds a traitCollectionDidChangeBlock to MDCBottomDrawerViewController, called when its trait collection changes.
2019-07-23 10:51:39 -07:00
Bryan Oltman
b243d5e842
[NavigationDrawer] Update cacheLayoutCalculationsWithAddedContentHeight recursion check to factor out floating point rounding issues (#7654)
The `_contentHeaderTopInset > _contentHeightSurplus` check in `MDCBottomDrawerContainerViewController`'s `cacheLayoutCalculationsWithAddedContentHeight:` function was erroneously evaluating to `true` when presenting content:

- in full screen
- with no header
- with the content's height being equal to the available height

Because of how `_contentHeightSurplus` is calculated, it was almost (but not quite) equal to `_contentHeaderTopInset`, which was causing the function to infinitely recurse.

This PR also adds an example that demonstrates the issue. To reproduce:

1. Open MDCDragons
1. Navigate to the "Bottom Drawer No Header Less Content" example
1. Rotate the phone/simulator to landscape
1. Show the bottom navigation drawer by tapping on the menu icon

Expected:

The bottom drawer is displayed.

Actual:

The `cacheLayoutCalculationsWithAddedContentHeight:` infinitely recurses and the app crashes due to stack overflow.

Closes #7633
2019-06-19 18:27:08 -04:00
Yarden Eitan
37fbe0ba48
[NavigationDrawer] Include safe area insets in content height (#7545)
This adds a new opt-in flag for clients to tell the drawer to add the bottom safe area inset to the content height. That way the content can be seen correctly without overlapping on the bottom safe area.

This issue has been reported by an internal client and helps with bug: b/123500336 .

This is a follow up PR to https://github.com/material-components/material-components-ios/pull/7544
2019-06-06 16:11:31 -04:00
Yarden Eitan
bff29146de
update (#7544)
In some cases, clients may have their contentViewController's preferredContentSize only update later in the lifecycle. In cases like that, the _preferredContentSize property may still be 0. Before this change, it would cause the drawer to be much smaller than it should be. This resolves the problem by not updating the drawer height if the content height is still 0.

This has been reported by 2 internal clients so far.
Related bugs: b/123500336 , #7369
2019-06-06 15:59:43 -04:00
Yarden Eitan
4badd38cf5
update (#7345)
The current ShadowElevation value for NavigationDrawer is incorrect and is currently 16.0. It should be 4.0 based on [Material Guidelines](https://material.io/design/components/navigation-drawer.html#standard-drawer):
"A full-height navigation drawer is at the same elevation as a top app bar."
"When initially opened to 50% of the screen height, the drawer must be dragged to screen height before additional items are revealed. Upon scroll, the drawer's header becomes an elevated top app bar with a close affordance."

|Before|After|
|---|---|
|![Simulator Screen Shot - iPhone X - 2019-05-06 at 14 52 37](https://user-images.githubusercontent.com/4066863/57248201-cac15900-700f-11e9-92ac-03a303352918.png)|![Simulator Screen Shot - iPhone X - 2019-05-06 at 14 51 40](https://user-images.githubusercontent.com/4066863/57248208-d01ea380-700f-11e9-86be-f2034a449907.png)|
|---|---|

Resolves #7335
2019-05-06 15:50:36 -04:00
Yarden Eitan
07417dfa71
[NavigationDrawer] Added support for customizing the initial drawer height factor (#7112)
We are adding a new property for NavigationDrawer's API called `maximumInitialDrawerHeight` which allows clients to set the initial height of the drawer, rather than it always being 50% of the screen's height.

We also had to be mindful that in some cases allowing any percentage could have the offset of the scrollView be a fractional number that wasn't reasonable, and therefore UIKit would round the scrollView's contentOffset to a close (yet different) value. Therefore to not cause inconsistencies between what the scrollView content offset returns and the drawer's initial offset, we rounded the number after the initial percentage calculation.

Unit tests have been added and all examples have been tested with and without the variable.

Resolves #7080
2019-04-12 15:33:06 -04:00
Cody Weaver
7050808d62
[NavigationDrawer] Fix issue where scrim is shown below content (#6514)
## Related links
* Original PR: #5876 
* Related Bug: #5782 
## Introduction
This fixes the issue where the scrim is shown if a user scrolls too far into the content. This does **NOT** fix the issue if a user has set a `trackingScrollView`. If there is a trackingScrollView then the behavior doesn't change at all.
## The problem
When a user scrolls up passed the height of the content the scrim is shown.
## The fix
As a user scrolls we continually add additional height to the contentViewController.
## Videos
| Before | After |
| --- | --- |
|![before](https://user-images.githubusercontent.com/7131294/51933190-bd704f00-23ce-11e9-814d-f19f0668fe2a.gif)|![after](https://user-images.githubusercontent.com/7131294/51933211-c3663000-23ce-11e9-943f-01758139d9b1.gif)|
2019-01-29 14:13:11 -05:00
Cody Weaver
4a3ca45176
[NavigationDrawer] Fix issue when setting trackingScrollView (#6492)
## Related links
* Related bugs: #5804 #6305 
* Component: [NavigationDrawer](https://github.com/material-components/material-components-ios/tree/develop/components/NavigationDrawer)
## Introduction
While working on #6305 I noticed that in certain cases the NavigationDrawer would not set the `trackingScrollView` correctly in certain cases.
## The problem
There was a race condition that if a user set any one of the properties on the `presentationController` before they set the `trackingScrollView` then the `trackingScrollView` internally would be nil.
## The fix
Set the tracking scroll view on the `presentationController` instead of on the `transitionController`.
2019-01-28 16:16:23 -05:00
Cody Weaver
63c8c54ec2
[NavigationDrawer] Fix issue where drawer opens passed initialDrawerFactor (#6491)
## Related links
* Bug: #6305 
* Component: [NavigationDrawer](https://github.com/material-components/material-components-ios/tree/develop/components/NavigationDrawer)
* Related PRs: #5928 #5587 #5520 #5443
## Introduction
The navigation drawer should support resizable content. This content should be able to change and the drawer stay at the same height or not _jump_ to another height. There was a problem where the drawer would jump between heights for certain `preferredContentSize`'s of the `contentViewController`. This was thought to be addressed in #5928. Upon investigation the root cause was not that the drawer jumped when `preferredContentSize` changed but that some how the drawer was able to open passed it's `initialDrawerFactor`. Therefore when the `preferredContentSize` did change the drawer go to the correct `initialDrawerFactor` and when it changed back it would go to the incorrect value. Additionally, when the drawer got into this state it would be in an `.expanded` drawer state because the drawer thought it should open up passed the `initialDrawerFactor`.
## The problem
The drawer thought it had less content that it actually had and therefore would go into the incorrect state and override `initialDrawerFactor`.
## The fix
Upon investigation fixing the drawer's internal calculation as to how much _content_ it actually has vs how tall the `presentingViewBounds.height` multiplied by `initialDrawerFactor`.
## Tests
Tests were updated as well as comments around them to understand why they were updated.
## Code snippet
In order to test the before and after behavior edit `BottomDrawerInfiniteScrollingExample.swift` as outlined below.
```diff
let bottomDrawerViewController = MDCBottomDrawerViewController()
+ contentViewController.supportsScrollToTop = false
bottomDrawerViewController.contentViewController = contentViewController
```
Doing the above will showcase how the drawer got into it's broken state.
2019-01-28 13:07:46 -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
Yarden Eitan
5a98df2b39
[NavigationDrawer] Navigation Drawer Present at Fullscreen (#5995)
This PR closes #5600 .

The drawer now has added functionality allowing users to expand the drawer to full screen with duration and completion. 
Clients have asked for this functionality, and it is also providing the expand to full screen functionality correctly even when the content is less than the full height of the screen.
2018-12-13 11:15:43 -05:00
Cody Weaver
e2b2240618 [NavigationDrawer] Fix jump when perferredContentSize changes (#5928)
### Context
Currently `MDCBottomDrawerViewController` _jumps_ if the preferredContentSize changes. A client is asking for this _jump_ to not happen but instead the drawer will look the same but have more content. 

#### Conditional checks

1. The check to see if `_contentVCPreferredContentSizeHeightCached` is zero is because on initial layout this value is 0 until we call `cacheLayoutCalculations` which sets this value. 
2. The check to see if `percentageFullScreen > 0.5` is there to make sure we never have an initial drawer factor more than design has specified.

### The problem
`MDCBottomDrawerViewController` _jumps_ if the preferredContentSize changes

### The fix
Set initialDrawerFactor to a custom value so that change doesn't cause a jump.

### Videos
| Before | After |
| - | - |
|![before](https://user-images.githubusercontent.com/7131294/49542847-a0267500-f8a4-11e8-90c9-e5304e5da9a2.gif)|![after](https://user-images.githubusercontent.com/7131294/49542855-a4eb2900-f8a4-11e8-9db3-3b163dbe5e9b.gif)|
2018-12-05 21:26:09 -05:00
Randall Li
487a45d09b add missing imports to MaterialNavigationDrawer+ColorThemer 2018-12-05 20:54:22 -05:00
Cody Weaver
b96909eba0
[NavigationDrawer] Refactor test (#5910)
### Context
A lot of the test used the same code in the given portion of the test. All of those given statements can be summarized into a function to reduce complexity of the test.
### The problem
Similar code throughout the test.
### The fix
Pull all of that code into a function.
2018-12-04 15:40:48 -05:00
Yarden Eitan
137a3e920c
[NavigationDrawer] API to allow content to scroll to top (#5776)
**Context:**
Clients want the ability to scroll their content in the drawer to a specific content offset, most commonly to the top of the content.

**Problem:**
There is no current API that exposes a set content offset or moreover no API that exposes the internal scrollView to allow our clients to set its content offset as they will.

**Solution:**
Provide an API to set the content offset Y of the scrolled content of the drawer. Setting that offset Y to 0 essentially scrolls the user to the top. This API also allows the scrolling to be animated or not.

**Related Bugs:**
Closes #5713
2018-11-19 17:46:15 -05:00
Yarden Eitan
bccd163467
[NavigationDrawer] Improve performance for heavy preferredContentSize calls (#5744)
**Context:**
There is degraded scrolling performance for clients who have heavier calculations when providing the `contentViewController`'s `preferredContentSize`. This is pretty common for dynamically sized content.

**Problem:**
We are calling preferredContentSize more times than we should, when we can defer re-calling it unless we are receiving a `preferredContentSizeDidChangeForChildContentContainer` call.

**Solution:**
Have `preferredContentSize` only called in `cacheLayoutCalculations`. The other unneeded `preferredContentSize` calls take their value either from another class that has already calculated the `preferredContentSize`, or within its own class as a property which caches the latest `preferredContentSize`.

**Related Bugs**
Closes #5715
2018-11-19 15:03:54 -05:00
Robert Moore
372d6b24f9
No longer using -init for Color Scheme. (#5734)
{MDC iOS} No longer using `-init` for Color Scheme.

Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults.

Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
2018-11-12 12:54:47 -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
Yarden Eitan
c9f2279af9
[NavigationDrawer] Adding a top inset delegate for the drawer (#5674)
**Context:**
Clients need a way to know the content inset of the drawer to be able to lay out their content appropriately.

**The Problem:**
Because things like the status bar, safe area, and the top handle take up more space at the top of the drawer, the content that is laid out initially will be clipped if not able to move the content appropriately as the drawer is dragged.

**The Fix:**
Add an MDCBottomDrawerViewControllerDelegate that listens to topInset changes as the drawer is dragged and provides the top inset in which the content should be laid out below.

**Testing:**
Unit Test + Tested on an iPhone X and iPhone 7 on all examples, portrait and landscape.
2018-11-08 15:14:56 +02:00
Yarden Eitan
3693683b0f
[NavigationDrawer] Added Color API for the top handle. (#5592)
**Context:**
The navigation drawer's top handle should have an API to be able to customize its color.

**The Problem:**
Currently our top handle only has a default color set and can't have clients customize its color.

**The Fix:**
Provide an API to MDCBottomDrawerViewController to set the handle's background color.

**Testing:**
Unit Test + Tested on an iPhone X and iPhone 7 on all examples, portrait and landscape.

**Screenshot**
![simulator screen shot - iphone 7 - 2018-11-05 at 14 28 06](https://user-images.githubusercontent.com/4066863/47998168-07ff6980-e107-11e8-8882-d4f4cf70dc7c.png)
2018-11-08 09:46:34 +02:00
Yarden Eitan
31e3f33df3
[NavigationDrawer] Add dynamically sizing support for the drawer + performance improvements (#5587)
**Context:**
Clients need the ability to dynamically size their navigation drawer content and have the drawer work appropriately and correctly.

**The Problem:**
Currently we have no mechanism where we let the drawer know that the size of the content has changed and the internal calculations need to be re-calculated and re-applied.

Also, before we were partially listening to the `preferredContentSize` by asking if it has changed every so often using the conditional in the `contentHeightSurplus` getter. Some clients can have a very calculations heavy `preferredContentSize`, which will cause the whole drawer mechanism to lag.

**The Fix:**
Because the `contentViewController` and the `headerViewController` are child view controllers of `MDCBottomDrawerContainerViewController` , we can listen to `preferredContentSizeDidChangeForChildContentContainer` and reset the previously calculated variables and relayout the drawer.

**Testing:**
Unit Test + Tested on an iPhone X and iPhone 7 on all examples, portrait and landscape. A dragons example has been created exactly for the testing of the dynamically changing content size here: #5545 

**Related Bugs:**
Closes #5514
2018-11-08 09:46:22 +02:00
Yarden Eitan
43a996674a
[NavigationDrawer] Added a top handle to the drawer (#5591)
**Context:**
The Navigation Drawer should have an affordance to show scrollability in a shape of a top handle.

**The Problem:**
Currently we have no top handle in our drawer to show scrollability.

**The Fix:**
In this PR we are adding a top handle to our drawer. the top handle is hidden by default. when the top handle isn't hidden, it is visible when there is more scrolling to perform for the drawer, and then it fades away as the drawer reaches its full height, or when it goes to full screen.

**Testing:**
Unit Tests + Tested on an iPhone X and iPhone 7 on all examples, portrait and landscape.

**Related Bugs:**
Closes #5515 

**Screenshot**
![simulator screen shot - iphone x - 2018-11-05 at 14 22 10](https://user-images.githubusercontent.com/4066863/47997942-3e88b480-e106-11e8-9968-1e77f49014a5.png)

**Video of transition**
![2018-11-05 14-23-41 2018-11-05 14_24_27](https://user-images.githubusercontent.com/4066863/47998041-8dcee500-e106-11e8-8c64-552a149c2c7a.gif)
2018-11-07 23:30:56 +02:00
Yarden Eitan
2127004680
automatically disable scrolling (#5586)
**Context:**
Some clients were not aware that their content's scroll view needs to be disabled so the content will not start scrolling while dragging the drawer.

**The Problem:**
Clients need to explicitly set their tracking scroll view scrolling to disabled manually.

**The Fix:**
If a tracking scroll view is provided, set the scrolling to disabled automatically and therefore cause less client confusion

**Testing:**
Unit Test + Tested on an iPhone X on all examples.
2018-11-07 11:12:51 +02:00
Cody Weaver
71c4da9404
[NavigationDrawer] Add scrim color to color themer (#5570)
### Context
In #5458 we did not themer the scrim color because it wasn't a property on NavigationDrawer. The property was added in #5568. This PR themes the scrim color with the correct value. As more properties are added to navigation drawer more adjustments to the themer will need to be made.
### The problem
We aren't theming the scrim color
### The fix
Apply the correct values to the scrim color within the color themer
### Screenshots
| Before | After |
| - | - |
|![simulator screen shot - iphone xs max - 2018-11-01 at 06 47 35](https://user-images.githubusercontent.com/7131294/47847574-08fc6800-dda2-11e8-9241-8dfb33e27389.png)|![simulator screen shot - iphone xs max - 2018-11-01 at 06 46 35](https://user-images.githubusercontent.com/7131294/47847581-0dc11c00-dda2-11e8-8b07-d62cebd28c62.png)|
2018-11-01 12:05:00 -04:00
Cody Weaver
51f69ae402
[NavigationDrawer] Add support for scrimColor (#5568)
### Context
In order to support a fully themable NavigationDrawer we need to be able to set the _scrimColor_ to a custom color. These changes add a property to be able to do so. If the _scrimColor_ isn't set the the `scrimView` in the `MDCBottomNavigationPresentationController` defaults to `[UIColor colorWithWhite:0 alpha:0.32];`.

### Related bug
b/117274465


### Screenshots
| Before | After |
| - | - |
|![simulator screen shot - iphone xs max - 2018-10-31 at 10 53 16](https://user-images.githubusercontent.com/7131294/47796670-30e4c080-dcfb-11e8-9a2a-50a2de9d76dc.png)|![simulator screen shot - iphone xs max - 2018-10-31 at 10 40 39](https://user-images.githubusercontent.com/7131294/47796676-34784780-dcfb-11e8-9957-ba10e0947d54.png)|

**_Code snippet for after screenshot_**

```swift
 bottomDrawerViewController.scrimColor = UIColor.blue.withAlphaComponent(0.5)
```
2018-10-31 12:31:27 -04:00
Yarden Eitan
bc584d9e0e
[NavigationDrawer] Added a top corners radius for state API. (#5543)
Context:
This change opens up an API to the nav drawer to allow clients to round the top corners using the state system. allowing them to define what corner radius will the top corners have based on the state the drawer is in.

The Problem:
There was no way for users to customize and set the top corners' radius of the drawer.

The Fix:
We now have an API open that allows users to set the corner radius using the drawer's state system. The corner radius logic was moved to the MDCBottomDrawerViewController because that logic isn't part of the drawer scrolling mechanism and shouldn't sit in MDCBottomDrawerContainerViewController if not necessary. To achieve the desired outcome we exposed internally the bottomDrawerTopTransitionRatio:transitionRatio API to the MDCBottomDrawerViewController so it can animate the transition between corner radius shapes smoothly.

Testing:
Unit Tests + Tested on an iPhone X and iPhone 7 with smaller and bigger preferredContentSize to imitate different states. Tested on Portrait and Landscape on all examples.

Related Bugs:
Closes #5516
2018-10-30 19:38:06 +02:00