Wrapping and mutating a given drawable which is supposed to be tinted is a standard practice across the Material library. This CL applies the same logic to Tab's selected indicator drawables and also refactoring the relevant logic a bit to make it cleaner.
Resolves https://github.com/material-components/material-components-android/issues/2794
PiperOrigin-RevId: 460765659
If somehow scroll position is set to -1 with and position offset greater than 0.5, we will decide it's a valid scroll position which causes NPE for selected child not found.
Fixes this by checking if position is valid regardless the offset and falling back to 0 if a negative position is given.
Resolves https://github.com/material-components/material-components-android/issues/2464
PiperOrigin-RevId: 408894188
1. When a new tab indicator drawable is set, we didn't correctly restore the previous set indicator height to the new drawable, or set the drawing bound to the intrinsic height of the drawable, if the indicator height was not specified. This result in a 0-height drawing bound after setting the tab indicator, which makes it disappear and can never go back if the tab indicator gravity is not "stretch" (which will recalculate the height after moving the indicator). Fixes this by correctly set the drawing bounds after a new tab indicator drawable is set.
2. After we set full-width flag of tab indicator, the width won't be updated until we move the tab indicator. Fixes this by explicitly triggering the recalculation of tab indicator's drawing bound after changing the flag.
Resolves: https://github.com/material-components/material-components-android/issues/2354
PiperOrigin-RevId: 397823617
On SDK < 23 if the icon is not a TintAwareDrawable, DrawableCompat.wrap() will return a new drawable which wraps the original drawable. However in the original logic after we set the tint to the icon, we didn't really set the tinted icon back to the tab or the image view, therefore the tint is not showing.
Moves the tint logic to updateTextAndIcon() to ensure tinted icons will be used in the image view.
Resolves https://github.com/material-components/material-components-android/issues/785
PiperOrigin-RevId: 391368322
*** Reason for rollback ***
[TabLayout] Roll forward with dot indicator fix
*** Original change description ***
Automated g4 rollback of changelist 337092676
PiperOrigin-RevId: 337484043
*** Reason for rollback ***
Roll forward with fix
*** Original change description ***
Automated g4 rollback of changelist 336704515
PiperOrigin-RevId: 337092676
In <API18, BadgeDrawable will dynamically 1) wrap the anchor in a FrameLayout and 2) replace the anchor with the FrameLayout in the anchor' view hierarchy. BadgeDrawable will set itself as foreground on the FrameLayout.
If the user does not want BadgeDrawable to manipulate its view hierarchy, the user can pass in an instance of FrameLayout `customBadgeParent` in #attachBadgeDrawable instead.
Labeled BadgeUtils as experimental and removed the RestrictedTo(Scope.Library) annotation.
Updated TopAppBar main demo to show a badge on a toolbar menu item.
PiperOrigin-RevId: 336306885
Add TabGravity.GRAVITY_START to maintain existing (default) MODE_SCROLLABLE behavior.
MODE_SCROLLABLE currently supports GRAVITY_CENTER and GRAVITY_START
MODE_FIXED does not support GRAVITY_START.
PiperOrigin-RevId: 289910847