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
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
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
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
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+
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
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
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 #6275Closes#7839
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
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
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