85 Commits

Author SHA1 Message Date
David Collazo
6ab378ddc4 Remove deprecated enableRippleBehavior property from BottomNavigation component
PiperOrigin-RevId: 441893309
2022-04-14 17:19:57 -07:00
Wenyu Zhang
b457b13005 Internal change.
PiperOrigin-RevId: 417635153
2021-12-21 09:32:05 -08:00
Jeff Verkoeyen
287e4908ac [BottomNavigation] Delete the Theming library.
Also removed examples that made use of theming.

PiperOrigin-RevId: 404245848
2021-10-19 06:48:46 -07:00
Jeff Verkoeyen
676c9fcfe9 Remove all pre-iOS 12 logic.
PiperOrigin-RevId: 400786559
2021-10-04 12:31:50 -07:00
Cody Weaver
28165af3fe Internal change
PiperOrigin-RevId: 392913717
2021-08-25 09:30:48 -07:00
Jeff Verkoeyen
bf652865ce Fix build errors related to the Shadow component.
PiperOrigin-RevId: 363410431
2021-03-17 07:00:50 -07:00
Jeff Verkoeyen
b190b1c334 Annotate APIs as only supporting iOS 12+.
PiperOrigin-RevId: 358926113
2021-02-22 16:09:26 -08:00
Jeff Verkoeyen
1abdf16760 Optimizing imports
PiperOrigin-RevId: 357185990
2021-02-12 07:36:41 -08:00
Bryan Oltman
bb71d6bcbb [BottomNavigation] Add navigationBarHidden property to MDCBottomNavigationBarController.
PiperOrigin-RevId: 331145190
2020-09-11 07:40:10 -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
Bryan Oltman
d79d9a86c5 [BottomNavigation] Remove supplemental directory from examples.
PiperOrigin-RevId: 330739970
2020-09-09 09:42:44 -07:00
Wenyu Zhang
ac3c854dc4 [BottomNavigation] Align barItemsBottomAnchor with safeAreaInsets.
PiperOrigin-RevId: 328742149
2020-08-27 08:36:14 -07:00
Andrew Overton
b22eef526f [BottomNavigation] Move MDCBottomNavigationBarController to main podspec
PiperOrigin-RevId: 326698570
2020-08-14 11:48:35 -07:00
Andrew Overton
8759533368 [BottomNavigation] Replace bottom navigation README
This PR replaces the bottom navigation readme as part of b/151662303.

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

PiperOrigin-RevId: 314605625
2020-06-03 14:35:12 -07:00
Nobody
70716800b8 Internal change
PiperOrigin-RevId: 312085611
2020-05-18 16:41:12 +00:00
Jeff Verkoeyen
92254ea119 Rename all icons to an ic_<#name#> convention.
PiperOrigin-RevId: 308232277
2020-04-24 04:33:51 -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
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
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
Bryan Oltman
352a110b81
[BottomNavigation] Deprecate MDCBottomNavigationBarColorThemer (#9126)
* [BottomNavigation] Deprecate MDCBottomNavigationBarColorThemer

* clang
2019-12-05 15:20:02 -05:00
Cody Weaver
ba3bc2b15a
[BottomNavigation] Add accessibility value for badge (#8920)
This updates the `Badge Value Test` example to have an accessibility label for the tab with a badge.

Closes #8837
2019-11-15 11:32:28 -08:00
Cody Weaver
98ec8abdbf [BottomNavigation] Clean up badge value test example (#8921)
This cleans up the bottom navigation `Badge Value Test` example to have the correct imports, use our modern theming, and removes semicolons.

## Screenshots

| Before | After |
| --- | --- | 
|![Simulator Screen Shot - iPhone 11 Pro Max - 2019-11-15 at 08 29 50](https://user-images.githubusercontent.com/7131294/68959206-7a774080-0782-11ea-9edf-6bab766b3c4c.png)|![Simulator Screen Shot - iPhone 11 Pro Max - 2019-11-15 at 08 31 40](https://user-images.githubusercontent.com/7131294/68959214-7fd48b00-0782-11ea-84ec-0b6087e40bfd.png)|



NO_BUG=This is cleanup I found while working on #8837
2019-11-15 12:12:11 -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
48e95bbf0e
[BottomNavigation] Don't set sizeThatFitsIncludesSafeArea. (#8065)
The default value is false, so setting it to `false`/`NO` is unnecessary.

Part of #6783
2019-07-24 00:43:11 -04:00
Robert Moore
da95087650
[BottomNavigation] Update example to demonstrate lazy loading. (#7991)
Updates the example to exercise lazy loading and some of the child VC appearance methods.

Part of #7984
2019-07-22 19:59:50 -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
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
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
Robert Moore
0c51470c5b
[BottomNavigation] Restore examples titles. (#6869)
Examples titles were incorrectly removed in #6718.  Restoring those
titles. These mistakes weren't found because the original PR only
checked the Dragons app and not the Catalog.
2019-03-13 14:28:34 -04:00
Robert Moore
10ed6188a5
[BottomNavigation] Examples clean-up. (#6718)
This is a collection of internal clean-ups that were overdue on Bottom Navigation examples.  Nearly all examples (8 of 9) were updated. The majority of the improvements focused on visual layout and appearance, but some code clean-up took place as well.

* Making sure buttons/labels remain on-screen after rotations.
* Correctly positioning the BottomNavigationBar with respect to the safe
  area.
* Not adding subviews or configuring views in `-init`
* Allow Catalog/Dragons to inject an App Bar.
* Stop overriding titles.
* Use property access.

## Before/After Screenshots

Not all examples visibly changed as a result of the code clean-up (e.g., "Bottom Navigation" and "Blur Effect"), but the before and after images are present to make it easier to review.

|Example|Before|After|
|---|---|---|
|Badge Value Test|![bn-badgevalue-develop](https://user-images.githubusercontent.com/1753199/53541471-fe4fa680-3ae7-11e9-96f6-7a57bfcc418b.png)|![bn-badgevalue-after](https://user-images.githubusercontent.com/1753199/53541474-027bc400-3ae8-11e9-80d8-3332c2f016bb.png)|
|Blur Effect|![bn-blur-develop](https://user-images.githubusercontent.com/1753199/53541485-0f98b300-3ae8-11e9-9072-8afebb379448.png)|![bn-blur-after](https://user-images.githubusercontent.com/1753199/53541486-11fb0d00-3ae8-11e9-9d07-853091e51a0c.png)|
|Bottom Navigation|![bn-typical-develop](https://user-images.githubusercontent.com/1753199/53541495-1de6cf00-3ae8-11e9-922d-6f981a94b007.png)|![bn-typical-after](https://user-images.githubusercontent.com/1753199/53541498-2212ec80-3ae8-11e9-9aa4-7bfa39573cb0.png)|
|Bottom Navigation (Swift)|![bn-swift-develop](https://user-images.githubusercontent.com/1753199/53541507-2b9c5480-3ae8-11e9-9460-f91c46e2a4fd.png)|![bn-swift-after](https://user-images.githubusercontent.com/1753199/53541509-2e974500-3ae8-11e9-99f6-4df133de640a.png)|
|Bottom Navigation Reorder (Swift)|![bn-reorder-develop](https://user-images.githubusercontent.com/1753199/53541558-6d2cff80-3ae8-11e9-92e0-ba99e48f9e34.png)|![bn-reorder-after](https://user-images.githubusercontent.com/1753199/53541560-7027f000-3ae8-11e9-982a-80ca04587f4d.png)|
|Bottom Navigation Selected|![bn-selected-develop](https://user-images.githubusercontent.com/1753199/53541575-7ddd7580-3ae8-11e9-83ff-def8334a2874.png)|![bn-selected-after](https://user-images.githubusercontent.com/1753199/53541577-803fcf80-3ae8-11e9-8789-0088ab3a9449.png)|
|Bottom Navigation Set Color (Swift)|![bn-setcolor-develop](https://user-images.githubusercontent.com/1753199/53541598-93529f80-3ae8-11e9-9fc9-e71b8530c398.png)|![bn-setcolor-after](https://user-images.githubusercontent.com/1753199/53541602-95b4f980-3ae8-11e9-95cb-eb463ba449e9.png)|
|Bottom Navigation Title Visibility (Swift)|![bn-titlevis-develop](https://user-images.githubusercontent.com/1753199/53541611-a36a7f00-3ae8-11e9-86ca-02aa2a7afc5e.png)|![bn-titlevis-after](https://user-images.githubusercontent.com/1753199/53541619-a9606000-3ae8-11e9-8e9c-3655d77f1d6b.png)|
2019-03-06 08:52:54 -05:00
Robert Moore
5ca3f34742
[BottomNavigationBar] Add autolayout support (#6612)
Adds support to BottomNavigationBar to more easily work with Autolayout.  

* `intrinsicContentSize` returns the correct size of the bar items as content.
* `barItemsBottomAnchor` allows anchoring the Bottom Navigation bar to the safe area layout guide.

Updates the `MDCBottomNavigationBarController` to use the new layout anchor and eliminates the need to respond to safe area changes in the view controller.

Fixes #4520
2019-03-01 12:56:59 -05:00
Robert Moore
e553272885
[BottomNavigation] Make Controller available on iOS 8. (#6719)
Adds constraints safe for use on iOS 8. This removes the availability
checks previously set on the MDCBottomNavigationBarController class that
may have been causing CocoaPods lint errors.

Related to #6608
2019-02-27 20:47:43 -05:00
Robert Moore
cbac7a9a48
[BottomNavigation] Add blur example (#6589)
Adds a new Dragons example to demonstrate the blur effect available for
Bottom Navigation Bar.

![dragons-bn-blur-example](https://user-images.githubusercontent.com/1753199/52529080-52b9f000-2cb9-11e9-9a7a-fc486612f889.png)

Follow-up to #6587
Part of #5217
2019-02-11 15:26:40 -05:00
Robert Moore
e1fe168b73
[BottomNavigation] Use chrome_reader in example. (#6551)
The typical use example for Bottom Navigation should use the icon
`chrome_reader_mode` to make it easier to compare the implementation to
[the Material.io guidelines article for Bottom Navigation](https://material.io/design/components/bottom-navigation.html#behavior).

|Before|After|
|---|---|
|![bn-typical-search-before](https://user-images.githubusercontent.com/1753199/52225282-07967c00-2878-11e9-8278-a32b8b0b4fc9.png)|![bn-typical-reader-after](https://user-images.githubusercontent.com/1753199/52225293-0b2a0300-2878-11e9-84b9-d951f545ab6d.png)|

Preparation for #6520
2019-02-04 13:54:14 -05:00
Robert Moore
b1e9182aaf
[BottomNavigation] Simplify and improve badge view. (#6544)
## Visual Improvements
Improves the badge view to better match the [Material.io guidelines article for Bottom Navigation](https://material.io/design/components/bottom-navigation.html#behavior).  It decreases the horizontal margins on either side of the text to provide a more circular shape when few numerals are present. It also adds support for a dedicated empty badge where no text is provided instead of relying on a string of spaces. 

<img width="728" alt="material-bottomnav-badge-example" src="https://user-images.githubusercontent.com/1753199/52158868-bc5b4e00-266a-11e9-8bad-a5d7bc7567d4.png">

Here is the typical use example bar in the Dragons catalog as it appears after this change:

|State|Image|
|---|---|
|Before|![badge-layout-develop](https://user-images.githubusercontent.com/1753199/52159942-6b068b00-2679-11e9-974a-e813aa211d09.png)|
|After|![badge-layout-trig](https://user-images.githubusercontent.com/1753199/52160891-41565f80-268b-11e9-9d4d-94cad201cb4a.png)|

And an overlay of the Material guidelines version and this PR for an empty badge:
<img width="530" alt="material-mdcios-comparison" src="https://user-images.githubusercontent.com/1753199/52159041-0fce9b80-266d-11e9-8458-80487a90672c.png">

Test rendering using Japanese kanji indicates that the new margin values are sufficient for characters extending to the corners of the label. (The text was chosen because the characters use much of the glyph space.)

|Before|After|
|---|---|
|![badge-layout-japanese-double-develop](https://user-images.githubusercontent.com/1753199/52160215-2ed62900-267f-11e9-80f9-4ec014c663b8.png)|![badge-layout-trig-japanese-double](https://user-images.githubusercontent.com/1753199/52160890-38fe2480-268b-11e9-862b-27d17bb688f8.png)|

Calculating the horizontal padding needs careful consideration because some scripts can place glyphs right at the edge of the UILabel's bounds. For example, the RTL/Arabic tests in #6543 use a *lorem ipsum* in Arabic script that includes glyphs bumping right up against the edge of the badge.
<img width="60" alt="badge-layout-arabic-script" src="https://user-images.githubusercontent.com/1753199/52160919-af9b2200-268b-11e9-9d99-0ee7df2de054.png">


A follow-up PR for MDCBottomNavigationItemView will improve the positioning of the badge.

## Technical refactoring and simplification
As part of the visual improvement the badge will respect its bounds during layout and no longer changes its own frame. The addition of `sizeToFit` and `sizeThatFits:` makes layout in the Bottom Navigation bar simpler. The badge no longer requires a layout pass to determine its size.  Several superfluous properties were removed and internal constants were adjusted to improve the design.

Part of #6520 

Internal tests performed in cl/232081379
2019-02-04 09:18:14 -05:00
Robert Moore
7f959bec01
[BottomNavigation] Stop excluding VC example. (#6515)
The Bottom Navigation swift examples were excluding the
BottomNavigationController example.

Closes #4160
2019-01-29 14:43:02 -05:00
Robert Moore
62c5097a7a
[BottomNavigation] Example is self-contained. (#6480)
The BottomNavigationController example was depending on other components'
example classes. Instead, it should use self-contained (or at least within
BottomNavigation) classes.

|Before|After|
|---|---|
|![simulator screen shot - iphone 7 - 2019-01-25 at 14 52 58](https://user-images.githubusercontent.com/1753199/51769399-ec29b500-20b0-11e9-8a35-cceda7ede773.png)|![simulator screen shot - iphone 7 - 2019-01-25 at 14 52 16](https://user-images.githubusercontent.com/1753199/51769373-e0d68980-20b0-11e9-807a-c5aecf8b9719.png)|

Part of #4160
2019-01-28 10:48:43 -05:00
Eric Lee
d8fed59535 [BottomNavigation] Elevates the BottomNavigationBarController to beta status and re-adds its unit tests. (#6311)
Contributes to #4160
2019-01-24 07:47:40 -05:00
Bartholomew Furrow
a9c8fab43d [BottomNavigation] Lays out the bar when titleVisibility is changed (#6152)
Closes #6151.
2019-01-24 07:43:56 -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
Eric Lee
f119f22226 [BottomNavigation] Sets the selected view controller to the first view controller in the given array when the bottom navigation controller's view controllers are set. (#6284)
This is to mimic the behavior of UITabBarController.

Contributes to: #4160
2019-01-13 15:24:12 -05:00
Matias Radzinski
a635f99d28 [BottomNavigation] Fix MDCBottomNavigationBar elevation on MDCBottomNavigationBarController (#6051)
Inverted the order the subviews are added to the `MDCBottomNavigationBarController`. This fixes the elevation of `MDCBottomNavigationBar` not being shown due to its z-index.

Follow-up for #5886
Part of #4160
2018-12-21 08:31:14 -05:00
Eric Lee
9e7b8eed76 [BottomNavigation] Added an example for MDCBottomNavigationBarController (#6082) 2018-12-20 16:36:42 -05:00
Robert Moore
430e37b0d1
Revert "[BottomNavigation]Adds Initial tests for MDCBottomNavigationBarController" (#6039)
Reverts material-components/material-components-ios#6012

The dependency on the `examples` directory in the `test_spec` target resulted in the removal of examples from the MaterialComponentsExamples development pod in Xcode.

![screen shot 2018-12-18 at 10 01 52 am](https://user-images.githubusercontent.com/1753199/50162384-377bc700-02ac-11e9-982d-8b2dcfa3b37f.png)
2018-12-18 10:32:23 -05:00
Eric Lee
0f1a7c7fad [BottomNavigation]Adds Initial tests for MDCBottomNavigationBarController (#6012)
Some basic tests for the Bottom Navigation controller, focusing on view controller selection and indices.

Part of #4160
2018-12-18 09:26:35 -05:00
Eric Lee
2bddd177f3 [BottomNavigation] Initial implementation of the Bottom Navigation Controller (#5886)
Initial implementation of MDCBottomNavigationBarController. 

Closes #4160
2018-12-12 12:38:27 -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