18 Commits

Author SHA1 Message Date
Cody Weaver
f9eb3494e3 #NavigationDrawer Disable failing tests
PiperOrigin-RevId: 555627853
2023-08-10 13:26:58 -07:00
Nobody
4f1010ffd1 Fixed up imports for NavigationDrawer
PiperOrigin-RevId: 478778261
2022-10-04 07:25:05 -07:00
Jeff Verkoeyen
9a49fd96f9 Internal change.
PiperOrigin-RevId: 366342462
2021-04-01 15:26:22 -07:00
Yarden Eitan
1e8dcc273e [NavDrawer] Increase code coverage by adding more tests.
PiperOrigin-RevId: 358039838
2021-02-17 15:00:27 -08:00
Nobody
6b4b0290a9 [Manage People/Links] Rotation UI Bug Fix
This change is a slight alteration to the change introduced in cl/347036858 this moves the added code to the bottom of the method so as to not interfere with the recursive call.

BEGIN_PUBLIC
Made a slight change to move adding `presentingViewYOffset' to `_contentHeightSurplus` to the end of the method. This was added in a previous change but didn't take into account the possibility of an infinite recursive loop. This movement should prevent that while also updating `_contentHeightSurplus` to the proper value. This should also fix the bug brought up in b/176122058
END_PUBLIC

PiperOrigin-RevId: 351455638
2021-01-12 14:58:26 -08:00
Nobody
8ce4ebebd6 [Manage People/Links] Added presentingViewYOffset to contentHeightSurplus in MDCBottomDrawerContainerViewController
BEGIN_PUBLIC
Updated the `contentHeightSurplus` method to add in an additional value of `presentingViewYOffset'. In the current iteration the `presentingViewYOffset' gets cancelled out by being included in both `scrollingDistance` and `containerHeight`. This change will take that offset back in to account and resolves a UX bug that we're currently seeing devices with smaller screen sizes using the PageSheet presentation style (b/173830907).
END_PUBLIC

PiperOrigin-RevId: 347036858
2020-12-11 11:18:30 -08:00
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
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
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
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
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
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
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
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
Cody Weaver
596f72b395
[NavigationDrawer] Add Fakes files for tests (#5453)
### Context
In #5423 my thinking was that we would need to test MDCBottomDrawerViewController but majority of the test are going to be related to MDCBottomDrawerContainerViewController. We may still want to test MDCBottomDrawerViewController so that is why I haven't completely removed that file for tests. But, we need fakes in a couple places so this adds _Fakes_ files so that code can be shared.

### The problem
We need fakes for test in MaterialNavigationDrawer because we can't present and that code should be shared.

### The fix
Add a `MDCNavigationDrawerFakes` files so we can have fakes and they can be shared across test files.

### Related bugs
#4911
2018-10-19 12:31:27 -04:00
Cody Weaver
b18f9987b6
[NavigationDrawer] Setup for tests (#5423)
Context
Set up the everything to start work on unit test for Navigation Drawer. In order to make small changes that are easier to review this sets up the files to get ready for test. This will allow us to work in tandem on unit test for this component once the files are in place.

The problem
MDCNavigationDrawer doesn't have any unit test

The fix
This adds the files to the build file and basic setup to add tests

Related bug
b/117175875
2018-10-15 20:25:44 -04:00