104 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
Alyssa Weiss
ef9fd05593 Remove all checks for iOS 10 availability now that components support iOS 10+
PiperOrigin-RevId: 331076636
2020-09-10 21:02:06 -07:00
Yarden Eitan
5d3662f0a2 [BottomNavigation] Provide an API to set the bar's height.
PiperOrigin-RevId: 330937608
2020-09-10 08:05:49 -07:00
Alyssa Weiss
01b1cbaa66 Remove pre-iOS 10 handling for voiceover now that components support iOS 10+
PiperOrigin-RevId: 329963061
2020-09-03 11:54:09 -07:00
Wenyu Zhang
f854548b97 [BottomNavigation] Delete deprecated sizeThatFitsIncludesSafeArea property.
PiperOrigin-RevId: 328623723
2020-08-26 15:44:01 -07:00
Alyssa Weiss
fb9eec8ba0 Set default horizontal item padding to 0
PiperOrigin-RevId: 328352160
2020-08-25 10:09:48 -07:00
Andrew Overton
b22eef526f [BottomNavigation] Move MDCBottomNavigationBarController to main podspec
PiperOrigin-RevId: 326698570
2020-08-14 11:48:35 -07:00
Alyssa Weiss
4a3058d591 [BottomNavigation] modify layouts with division to use floor(), as not using this was causing some non integer pixel values, which then resulted in a blurry layout
PiperOrigin-RevId: 326527243
2020-08-13 14:45:00 -07:00
Bryan Oltman
ef1cc6dfd7 [BottomNavigation] Shrink UIPointerEffect frame size to fit content of navigation item views.
This brings BottomNavigation more in-line with UITabBar - see the Photos app for reference.

PiperOrigin-RevId: 305129590
2020-04-06 15:23:49 -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
Andrew Overton
c068063cad
[BottomNavigation] Add horizontal padding property to MDCBottomNavigationBar (#9765)
This PR makes what was a hard coded horizontal padding value a configurable property on MDCBottomNavigationBar.

Closes #9307
2020-02-21 14:46:43 -05:00
Randall Li
02efdd1889
[Material][Availability] Migrates Bottom Navigation to MDCAvailability. (#9717)
[Material][Availability] Migrates Bottom Navigation to MDCAvailability.
2020-02-14 14:59:36 -05:00
Randall Li
fa62718bc5
add deps on availability for a bunch of components (#9679)
* add Availability build file

* add Button deps on availability

* added elevation

* corrected include statements to use import of the umbrella files

* revert unwanted changes

* spaces

* clangformat

* add availability dep

* added buttom nav deps on availibility

* Add FeatureHighlight build dep for Availability

* Add Availability build dep to FeatureHighlight private

* Add missing =

* fixed tabs spacing

Co-authored-by: Bryan Oltman <bryanoltman@gmail.com>
2020-02-11 13:14:09 -05:00
Nobody
770095c612 Adds availability macro for conditionally compiling OS sensitive code.
PiperOrigin-RevId: 293067907
2020-02-03 20:55:35 -08:00
Eric Lee
69d39caeb9 [BottomNavigation] Adds large content viewer support (#9451)
Introduces support for `UILargeContentViewer` and its associated classes and protocols on iOS 13 and later. 

*   On iOS 13 and later, `MDCBottomNavigationBar` will present a large content view when the platform's requirements are met.
    *   Larger Text is enabled with an `Accessibility...` size selected.
    *   User long-presses on a Bar Item.
*   On iOS 9-12, this behavior will remain associated with the `MDCBottomNavigationBarController` only, and the view will not have this behavior built-in.

Closes #8343
2020-01-25 22:26:36 -05:00
Robert Moore
e51a83afeb
[BottomNavigation] Fix bug in delegate method call (#9489)
[BottomNavigation] Fix bug in delegate method call

The MDCBottomNavigationBarController checks the wrong delegate method before calling `-bottomNavigationBarController:shouldSelectViewController:`. This can lead to crashes in clients that do not implement this method, but implement `-bottomNavigationBarController:didSelectViewController:`.

Fixes #9483
2020-01-24 15:01:19 -05:00
Wenyu Zhang
ab901f7654
Revert "[ColorScheme] deprecate init method and update documentation to reflect its purpose. (#9391)" (#9396)
This reverts commit 5fc6ec2f96e69f1e4c579ca69344557ad83329f2.
2020-01-09 13:54:20 -05:00
Wenyu Zhang
5fc6ec2f96
[ColorScheme] deprecate init method and update documentation to reflect its purpose. (#9391)
closes https://github.com/material-components/material-components-ios/issues/9390
2020-01-08 18:07:01 -05:00
Robert Moore
19c810d61d
[BottomNavigation] Use NotoNastaliq for Arabic/RTL tests. (#9260)
NotoNastaliq is a font with a greater line height than most other fonts. Using
it for Arabic/RTL fonts results in greater exercise of the view's layout.

Part of #6552
2019-12-13 10:26:25 -05:00
Andrew Overton
d89eb249aa
delete-MDCBottomNavigationBarTypographyThemer (#9234)
delete MDCBottomNavigationBarTypographyThemer. Closes #9158.
2019-12-11 10:52:08 -05:00
Bryan Oltman
1ae1e4cbbb
[BottomNavigation] Delete MDCBottomNavigationBarColorThemer (#9198)
Deletes MDCBottomNavigationBarColorThemer. MDCBottomNavigationBarColorThemer has been deprecated and has no internal usage.

Fixes #9130
Fixes #9161
2019-12-09 14:17:42 -05:00
Bryan Oltman
3b0bc4fda3
[BottomNavigation] Migrate MDCBottomNavigationBarColorThemer use to theming extension (#9142)
Migrate `MDCBottomNavigationBarColorThemer` logic to theming extensions to prepare for the eventual deletion of `MDCBottomNavigationBarColorThemer`.

Part of #9130
2019-12-06 12:43:55 -05:00
Robert Moore
d19d388292
[BottomNavigation] Add support for custom badge and text colors. (#8518)
Allows clients to set a custom badge background and text colors for all
badges. On iOS 10+, the `UITabBarItem badgeColor` API allows customizing
individual items' badge background colors as well. Setting the badge
background and text color will allow clients using badges on Bottom Navigation
to better-support Dark Mode.

Closes #2833
2019-09-27 22:04:57 -04:00
Eric Lee
815d3745eb [BottomNavigation] Adds state restoration support to the bottom navigation bar controller. (#8117)
Enables clients to opt-in to state restoration by providing `restorationIdentifier` values for the Bottom Navigation controller's child view controllers.

Closes #8265
2019-08-09 12:36:19 -04:00
Robert Moore
30de3a8756
[BottomNavigation] Propagate accessibilityHint to the accessibility element. (#8241)
The UIButton subview of the Bottom Navigation bar should be the
one receiving the `accessibilityHint` value from the UITabBarItem. There's no
ill effect if the itemView also receives the hint, and preserving that
behavior is less likely to break clients.
    
In the long term, it's reasonable to remove the `accessibilityHint` from the
item view directly, since it's not an accessibility element and doesn't need
the hint to be set.
    
Closes #7290
2019-08-08 11:51:36 -04:00
Robert Moore
e50b9be8bc
[BottomNavigation] Don't assign accessibilityIdentifier to the item view (#8240)
Creates an explicit assignment of `UITabBarItem`'s `accessibilityIdentifier`
to the actual accessibility element of the item view.

The item views should not have accessibility identifiers because they are not
accessibility elements. Reusing the same identifier for both the button and
the view makes it harder to perform automated UI tests.

Closes #8137
2019-08-08 09:58:10 -04:00
Eric Lee
3b54f2c6ea [BottomNavigation] Renames functions and fixes comments. (#8133) 2019-08-03 07:48:12 -04:00
Robert Moore
3c03bd05d6
[BottomNavigation] Use Starlark macros. (#8159)
Adds more Starlark marcro use and drops the need for `includes` in the private
headers target. Reusing these macros makes it easier for weekly releases.

Part of #8150
2019-08-01 15:30:02 -04:00
Robert Moore
9e936bfb62
[BottomNavigation] Test for additionalSafeAreaInsets behavior. (#8113)
This test ensures that the `additionalSafeAreaInsets` property of child VCs is
correctly set to account for the bottom navigation bar.

Confirmation of #8112
2019-07-31 08:30:53 -04:00
Robert Moore
bce0f4937b
[BottomNavigation] Test for mdc_overrideBaseElevation (#8075)
Adds a test for the default value.

Part of #8026
2019-07-25 09:23:57 -04:00
Robert Moore
eed4679d88
[BottomNavigation] Make KVO safe for nil. (#8083)
For most of the `UITabBarItem` `NSString` properties, setting them to `nil` after assigning the item to the Bottom Navigation bar resulted in a raised exception that can crash an app. The KVO code is being updated to match the style in MDCButtonBar to make it safe for `nil` values.

Closes #8082
2019-07-25 06:52:55 -04:00
Robert Moore
9ed52651c4
[BottomNavigation] Store child VCs in childViewControllers. (#7992)
The `MDCBottomNavigationBarController` was incorrectly only adding its child
view controllers as "proper" child view controllers when they became the
selected view controller. This resulted in difficulties when attempting to
perform state restoration within apps with the controller as the root view
controller.

Closes #7984
2019-07-24 13:30:49 -04:00
Robert Moore
4768e610a8
[BottomNavigation] Add MDCElevation support. (#8038)
Adds support for the `MDCElevatable` and `MDCElevationOverriding` protocols.

Closes #8026
2019-07-24 13:30:21 -04:00
Robert Moore
25a9312012
[BottomNavigation] Remove iOS 9 guards. (#7997)
Part of #2651
2019-07-22 20:56:40 -07:00
Robert Moore
3b32d0c29c
[BottomNavigation] Add snapshot tests for Bottom Navigation controller. (#7963)
Adds snapshot tests to render child view controllers. Also updates the example
to demonstrate scrolling behavior.

## Dragons Example View Controller

|Before|After|
|---|---|
|![Simulator Screen Shot - iPhone X - 2019-07-18 at 17 22 05](https://user-images.githubusercontent.com/1753199/61500639-03bb6980-a981-11e9-97fc-b1f5df9106d9.png)|![Simulator Screen Shot - iPhone X - 2019-07-19 at 06 26 49](https://user-images.githubusercontent.com/1753199/61538460-49624b80-a9ee-11e9-9954-b5092b372d76.png)|

Prework for #6835
2019-07-19 07:02:32 -07:00
Cody Weaver
3d62ea7a29
[BottomNavigation] Add shadowColor API. (#7910)
This change adds a shadowColor API so that clients can customize the color of their shadow within bottom navigation. Unit test have been added for a custom shadow color and the default shadow color as well as iOS 13 test to make sure it responds to dynamic colors.

Closes #7882
2019-07-15 08:21:15 -07:00
Robert Moore
fcf9b24138
[BottomNavigation] Add traitCollectionDidChangeBlock API. (#7893)
Provides a new API to allow a block of code to be executed when the Bottom
Navigation bar receives a `-traitCollectionDidChange:` call.

Closes #7892
2019-07-11 21:16:24 -04:00
Cody Weaver
f7ac1dbbbb
[BottomNavigation] Add theming extension (#7691)
Adds a theming extension to the bottom navigation component. This follows the guidelines outlined in the design doc.

Design doc: go/mdc-ios-theming-extensions.

Closes #7565
2019-06-24 13:21:38 -04:00
Yarden Eitan
9246b77e5e
[BottomNavigation] Adds the Ripple behavior to BottomNavigation. (#7589)
## Related links
* Bug: Closes #7377  
* Ripple: [MDCRippleTouchController](https://github.com/material-components/material-components-ios/tree/develop/components/Ripple)

## Introduction
This PR integrates [`MDCRippleTouchController`](https://github.com/material-components/material-components-ios/blob/develop/components/Ripple/src/MDCRippleTouchController.h) into [`MDCBottomNavigationBar`](https://github.com/material-components/material-components-ios/tree/develop/components/BottomNavigation). This behavior is an opt in flag property added to MDCBottomNavigationBar, `enableRippleBehavior`.  This improves the visual touch feedback for our users as MDCInkView didn't support our current motion guidelines.

## Videos
| Before | After |
| - | - |
|![oldRipple](https://user-images.githubusercontent.com/4066863/59464465-81c2a880-8df6-11e9-82a1-be6b2e4b3840.gif)|![newRipple](https://user-images.githubusercontent.com/4066863/59464470-82f3d580-8df6-11e9-8df3-9fcd9d36d1f6.gif)|
2019-06-15 18:10:32 -04:00
Robert Moore
3d6549c941
[BottomNavigation] Default sizeThatFitsIncludesSafeArea to NO. (#7554)
Flipping the default value of the flag to `NO` as part of the
migration/deprecation process. Internal clients were migrated
previously, but a few new instances might have appeared.

Part of #6716

## Release note

This should have no impact on the release. All client teams were migrated previously. Any breakage in the release could be mitigated by:

```
self.bottomNavigationBar.sizeThatFitsIncludesSafeArea = YES;
```
2019-06-11 08:43:11 -04:00
Robert Moore
c360a7db77
[BottomNavigation] Log accessibility string failure values in tests. (#7326)
Unit tests for some accessibility value strings were not logging the values
during failures. Using the recommended XCTest APIs provides automatic logging
and is preferable to manual equality checking.

Fixes #7325
2019-05-06 12:57:32 -04:00
Eric Lee
9e7848c625 [BottomNavigation] Adds a large item dialog view (#7146)
Adds a view for displaying a large icon and title when the user has dynamic type enabled.

This is part of a larger effort to add dynamic type support to `MDCBottomNavigationBarController`.

Closes #7122
2019-04-17 21:20:07 -04:00
Eric Lee
b8d1456ec6 [BottomNavigation] Adds private method to retrieve tab bar item for point (#7086)
This is part of a larger effort to implement the dynamic type long press accessibility feature. 

Closes #7123
2019-04-16 08:51:03 -04:00
Robert Moore
1e5f957ed7
[BottomNavigation] Add multi-line title support. (#6999)
Adding support for multi-line titles when the icon and text are vertically stacked.

Closes #6955
2019-04-01 09:59:34 -04:00
Robert Moore
ec75b7c871
[BottomNavigation] Extract common Snapshot consts. (#7004)
Pulling out reusable constants for Snapshot tests into a dedicated file.
This reduces boilerplate code needed in each of the test classes.

Closes #6844
2019-03-30 21:25:05 -04:00
Robert Moore
a0d0c1d046
[BottomNavigation] Split snapshot tests. (#6997)
Separating the title layout-related snapshot tests and blur effect tests
to trim down the main tests file.

Part of #6844
2019-03-27 18:47:22 -04:00
Robert Moore
b9151ecb2b
[BottomNavigation] Use new test icons. (#6898)
Improving snapshot tests cases by using the newly-available test icons. The
helps verify the order of items under RTL and to help distinguish the
different items.
2019-03-14 08:25:04 -04:00
Robert Moore
8c5be9ded2
[Snapshot] Adding 4 more test image styles. (#6897)
Adding multiple test image styles so snapshot tests can use different
image patterns rather than image sizes to determine if a rendered image
has changed.
2019-03-14 08:02:26 -04:00
Robert Moore
7e5c5eec22
[BottomNavigation] Split alignment snapshot tests. (#6856)
Separating snapshot tests focused on the `alignment` property into their
own class. This improves the reusability of `setUp` and makes the tests
easier to read.

Also separates two Test Fakes - a `UITraitCollection` and `MDCBottomNavigationBar` - into the `supplemental` directory for use across both files.

No tests were added or removed, only moved and renamed. All snapshot images were simply renamed for the new class and test methods.

Part of #6844
2019-03-13 09:49:35 -04:00
Robert Moore
5d699448d1
[BottomNavigation] Fix image updates in ItemView (#6847)
When the `selectedImage` or `image` values were changed on
MDCBottomNavigationItemView, it was accidentally updating the view's
UIImageView regardless of its current selection state. By checking the
current state and only updating as-needed, changes to the icons don't
show up incorrectly.

Fixes #6846
2019-03-13 08:46:24 -04:00