100 Commits

Author SHA1 Message Date
Nobody
e7a6b602b4 Add new item layout to align image and text to top with padding in between, and a new property to manage which image-and-text item layout to use.
PiperOrigin-RevId: 735890394
2025-03-11 14:27:52 -07:00
Janette James
ac53ebbc14 Delete Tabs TypographyThemer
PiperOrigin-RevId: 714995832
2025-01-13 09:23:36 -08:00
Janette James
3f82e5f3b0 Delete TabBarViewTheming
PiperOrigin-RevId: 714301345
2025-01-10 18:48:24 -08:00
Wenyu Zhang
fdfeaf6de1 Delete TabBar Theming.
PiperOrigin-RevId: 618287193
2024-03-22 14:26:05 -07:00
Nobody
58f6375b10 Internal change
PiperOrigin-RevId: 565513516
2023-09-14 16:45:39 -07:00
Nobody
4052eb4373 Fixed up imports for Tabs
PiperOrigin-RevId: 472482951
2022-09-06 09:47:41 -07:00
Nobody
5583bb006b Fix text color when reseting items while maintaining the selected tab.
If tab bar items are updated while there is already a selected item the early exit path in `setSelectedItem:` will be taken. This will bypass styling for the selected item (which will have a corresponding newly constructed MDCTabBarViewItemView that needs styling). This results in the MDCTabBarViewItemView's textColor being incorrect.

The fix proposed in this CL resets the selectedItem to nil so that the early exit check fails and allows the tab to be themed.

PiperOrigin-RevId: 440864525
2022-04-11 05:50:48 -07:00
Cody Weaver
272781fd85 [MDFInternationalziation] Remove mdf_semanticContentAttribute in favor of system API semanticContentAttribute.
PiperOrigin-RevId: 392680954
2021-08-24 09:29:08 -07:00
Cody Weaver
08d01596df [MultipleComponents] Remove mdf_effectiveUserInterfaceLayoutDirection in favor of the system API effectiveUserInterfaceLayoutDirection that was added in iOS 10.
PiperOrigin-RevId: 391307973
2021-08-17 09:30:47 -07:00
Jeff Verkoeyen
a8e4831fd0 Flattening all unit tests into single directories as per convention.
PiperOrigin-RevId: 367426300
2021-04-08 07:33:29 -07:00
Alyssa Weiss
924c49e43b Remove all iOS 10 availability checks from material_components_ios now that only iOS 10+ is supported.
PiperOrigin-RevId: 366437050
2021-04-02 06:33:16 -07:00
Jeff Verkoeyen
8ce743ce8a Optimizing imports
PiperOrigin-RevId: 357185751
2021-02-12 07:33:30 -08:00
Alyssa Weiss
0807c24b05 Add call to update fonts from setItems to make sure tabBarView fonts are applied to new items.
PiperOrigin-RevId: 346230736
2020-12-07 19:24:57 -08:00
Alyssa Weiss
a07df1ee5a Create and expose a minItemWidth property for MDCTabBarView to set the min width of items on the tab bar. This is done by adding a MDCTabBarViewItemViewDelegate protocol that MDCTabBarView conforms to.
PiperOrigin-RevId: 344269393
2020-11-25 09:48:26 -08:00
Alyssa Weiss
b8dccb0965 Update handling of ripple so that, for non scroll layout styles, it shows ripple on touch down rather than touch up.
PiperOrigin-RevId: 339909928
2020-10-30 11:43:32 -07:00
Alyssa Weiss
a60852c53f Remove notion of max item width from TabBarView and MDCTabBarViewItemView
PiperOrigin-RevId: 339340417
2020-10-27 15:19:59 -07:00
Yarden Eitan
89b43fd8ff [TabBarView] Scroll to selected item when there is an orientation/size change.
We do not update needsScrollToSelectedItem to YES in every setBounds or just remove the flag and have it scroll to the selected item in every layoutSubviews because this is a UIScrollView so every scroll updates the contentOffset which then triggers these methods. We want to only trigger this code path in orientation/size changes.

PiperOrigin-RevId: 333731208
2020-09-25 07:46:14 -07:00
Alyssa Weiss
6e127557eb Remove pre-iOS 10 handling for voiceover now that components support iOS 10+
PiperOrigin-RevId: 330576000
2020-09-08 13:36:36 -07:00
Yarden Eitan
eb13147f83 [TabBarView] Adds Large Content Viewer support to MDCTabBarView.
PiperOrigin-RevId: 327056620
2020-08-17 11:07:16 -07:00
Alyssa Weiss
6f3b23dfb8 Adding theming extension for TabBarView
PiperOrigin-RevId: 322433982
2020-07-21 13:51:56 -07:00
Wenyu Zhang
7c4dab62cf [Tabs] Add explicit cast in MDCTabBarViewTests.
PiperOrigin-RevId: 316096871
2020-06-12 06:55:41 -07:00
Yarden Eitan
7335fb5ca9 [MDCTabBar] Add support for custom accessibility labels for tab bar items.
PiperOrigin-RevId: 311098316
2020-05-13 14:39:09 +00:00
Nobody
28c20ee11c [Tabs] Adds large content viewer support to MDCItemBar.
PiperOrigin-RevId: 306584813
2020-04-14 23:00:22 -07:00
Eric Lee
b387c367d8 [Tabs] Adds large content viewer support to MDCItemBar.
PiperOrigin-RevId: 306571331
2020-04-14 20:59:45 -07:00
Cody Weaver
f1a125544b [MDC/Tabs] Stop ripple in MDCTabBar from showing up on scroll
When scrolling MDCTabBar, the Ripple should be disabled but when a user taps the cell it should show up. To achieve this effect in MDCRipple this flag should be set to NO, as outlined in the original PR #6487.

_Note:_ The MDCRippleTouchController is moved to the public surface of the cell in order to allow for better testing, the cell is in a private directory.
PiperOrigin-RevId: 306227910
2020-04-13 07:19:55 -07:00
Bryan Oltman
cc82257e5c [Tabs] Add UIPointerInteraction support to MDCTabBar.
PiperOrigin-RevId: 305105741
2020-04-06 13:36:35 -07:00
Bryan Oltman
3165207b57 [Tabs] Add UIPointerInteraction support to MDCTabBarView.
PiperOrigin-RevId: 305072636
2020-04-06 11:13:54 -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
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
Andrew Overton
6049a8c970
Revert "revert of commit ca2f2ad64046b4a2583abbe7cb705e42ed5f0ae7" (#9271)
This PR brings back https://github.com/material-components/material-components-ios/pull/9200. It was reverted because there were some remaining references to MDCTabBarColorThemer. [cl/284979182](http://cl/284979182) addresses those remaining references. This PR should be merged after the CL is approved and submitted.
2019-12-16 10:07:30 -05:00
Randall Li
010fb0ec68 revert of commit ca2f2ad64046b4a2583abbe7cb705e42ed5f0ae7 2019-12-11 11:11:23 -05:00
Andrew Overton
da280903dd
[Tabs] Delete MDCTabBarFontThemer (#9201)
Closes #9106
2019-12-09 16:01:45 -05:00
Andrew Overton
ca2f2ad640
Remove MDCTabBarColorThemer (#9200)
Closes #9061
2019-12-09 15:31:37 -05:00
Robert Moore
a4a17a58da [Tabs] Use built-in "tabs" behavior on iOS 10+ (#8812)
Although not available on iOS 9, on iOS 10 the MDCTabBar can use the
UIAccessibilityTraitTabBar so that its accessibility elements will be
decorated using the "tab, 1 of 3" information automatically. This change also
improves interaction with Voice Control because that relies on matching the
`accessibilityLabel`.

Improves #6757 for iOS 10+
2019-11-15 08:10:30 -08:00
Robert Moore
ed8acbbc71 [Tabs] Mark TabBarView as accessibility tab bar. (#8811)
Marks the `MDCTabBarView` class a tab bar for UIAccessibility. This
supplements the accessibility information provided to users by including the
element's index and total number of items. In VoiceOver, this is vocalized as
something similar to "{title}, tab, 1 of 3".

Closes #8495
2019-11-14 17:15:30 -05:00
Robert Moore
993eea2e9e
[Tabs] Add TabBarView API to set content padding (#8529)
Provides a new API to customize the content padding for MDCTabBarView. The content padding is extra spacing around the Tabs and within the `contentSize` of the UIScrollView. It is distinct from `contentInset` and works independently.

Closes #8490
2019-10-02 21:49:02 -04:00
Robert Moore
7718df1037
[Tabs] Use Starlark macros in BUILD file. (#8196)
Use more Starlark macros in the BUILD file. Also gets rid of the `include`
path extension.

Part of #8150
2019-08-02 16:34:01 -04:00
Cody Weaver
a9a0fcadd0
[Tabs] Add MaterialElevation support (#8116)
Adds conformance to MDCElevatable and MDCElevationOverriding to
MDCTabBar.

Closes #8012
2019-07-29 20:48:34 -07:00
Cody Weaver
0d624ace58
[TabBarView] Add traitCollectionDidChange block (#8060)
Adds a traitCollectionDidChangeBlock to MDCTabBarView, called when its trait collection changes.

Closes #8040
2019-07-23 20:47:06 -07:00
Cody Weaver
7bd0bdf14d
[Tabs] Add traitCollectionDidChange block (#8056)
Adds a traitCollectionDidChangeBlock to MDCTabBar and MDCTabBarViewController, called when its trait collection changes.

Closes #8041
2019-07-23 20:46:27 -07:00
Robert Moore
3913e29f52
[Tabs] Drop iOS 9 guards. (#7999)
Part of #2651
2019-07-23 12:22:42 -04:00
Robert Moore
be5bd6e9c7
[Tabs] Expose selection change animation properties. (#7944)
When a custom item view changes its intrinsic content size, it will need to
trigger a layout on the `MDCTabBarView` to adjust to the new size. Because the
layout should generally be animated, the TabBarView should expose its animation
duration value for use by the custom view (or its view controller) in the
animation block.

|Using UIView animation defaults|With This PR|
|---|---|
|![tabbar-animation-develop](https://user-images.githubusercontent.com/1753199/61412161-f6c54a00-a89c-11e9-9368-41ca6e4a4919.gif)|![tabbar-animation-changed](https://user-images.githubusercontent.com/1753199/61412165-fc229480-a89c-11e9-9934-5e83b19ecf5b.gif)|

Closes #7943
Closes #7942
2019-07-19 20:22:52 -07:00
Robert Moore
3a0c1ee2e8
[Tabs] Allow clients to calculate when a view appears/disappears. (#7841)
A new API, `- rectForItem:inCoordinateSpace:` provides the item's corresponding
view's frame in the provided coordinate space. Clients can use this API to
calculate which views are "shown" at any given time. A simple use of this API
for that purpose is added to the example view controller.

Alternative solution to #6275
Closes #7839
2019-07-12 20:35:29 -04:00
Robert Moore
7c7208fb50
[Tabs] Adjust sizeThatFits: behavior for TabBarView. (#7846)
The `sizeThatFits:` beahvior of `MDCTabBarView` previously would return a size
large enough for Fixed tabs in a justified layout. If the provided `size` was
wider than necessary, that value would be returned.

A solution that works better for inclusion in MDCHeaderStackView, which uses
`sizeThatFits:` to determine the view's frame size.

Closes #7845
2019-07-10 13:25:47 -04:00
Robert Moore
bc008a2ae6
[Tabs] Combine "default" unit tests. (#7822)
Combining several independent tests into one that tests "default" values.

Follow-up to #7742
2019-07-09 10:24:26 -04:00
Robert Moore
09a7df6530
[Tabs] Add bottom divider. (#7817)
Adds the bottom divider and an API to make it visible and customize its color.

## TabBarView Example View Controller
|Before|After|
|---|---|
|![Simulator Screen Shot - iPhone 7 - 2019-07-08 at 23 39 56](https://user-images.githubusercontent.com/1753199/60857758-b64d3880-a1d9-11e9-90de-fa4c4ebc942a.png)|![Simulator Screen Shot - iPhone 7 - 2019-07-08 at 23 34 30](https://user-images.githubusercontent.com/1753199/60857771-c36a2780-a1d9-11e9-830a-53e0074788ac.png)|


Closes #7742
2019-07-09 09:30:11 -04:00
Robert Moore
4ed8860b20
[Tabs] Add accessibilityElementForItem: API. (#7818)
This API is used by multiple internal clients so that they can target the
accessibility element for notifications.

Closes #7797
2019-07-09 08:52:18 -04:00
Robert Moore
9e8165694e
[Tabs] Add setSelected:animated: API for custom views. (#7810)
Adds a new required protocol method for setting a custom view to be selected. This makes it easier for custom views to respond to selection events.

Closes #7801
2019-07-08 15:47:35 -04:00
Robert Moore
fffcb4a5a0
[Tabs] Fix crash when assigning nil for KVO'd title. (#7806)
When setting the title to `nil` in KVO, the returned value in the dictionary is actually `NSNull`. When assigned to the NSString property for title, that resulted in a `doesNotRespondToSelector` exception.

Identified as part of #7748
2019-07-08 15:29:18 -04:00