Separate attributes allows components to directly reference a color in the tonal palette in its resources.
Otherwise, the implications of these attributes is the same as the previous color arrays.
PiperOrigin-RevId: 184764971
And add attributes to it.
None of these attributes were in widget's public_attrs, with the exception of menu. I'm not removing menu from widget's public_attrs, since NavigationView also uses that attribute.
Related side note: Before the package migration for bottomnavigation, BottomNavigationView used attributes declared by NavigationView, but for the package move, I made them standalone attributes to avoid creating circular dependencies. After cl/183574402 goes in, I'm going to consider making bottomnavigation depend on navigationview, and using NavigationView's attrs for BottomNavigationView.
PiperOrigin-RevId: 184201928
Move the call to invalidate() to happen after the box attributes are applied to the text box instead of once the attribute value is assigned to its field. This also required moving the call to applyBoxAttributes() from draw() for performance reasons, since applyBoxAttributes() was asking to be redrawn from inside the draw method.
This fixes the broken change color button in the text fields demo. Before, it only changed the color once drawableStateChanged() was called - now, it changes immediately.
PiperOrigin-RevId: 184138044
Update ThemeEnforcement to read this new attribute, and check for Material theme.
Change the ThemeEnforcement API to replace Context#obtainStyledAttributes().
See followup CL for how this attribute is used.
PiperOrigin-RevId: 184074635
This commit creates a tabs package for resources related to tabs. It does not move TabLayout to this package, since that would break current users.
PiperOrigin-RevId: 183893754
Previously, Theme.Design inherited from Theme.MaterialComponents, which would have resulted in an automatic update to Theme.MaterialComponents. Now, users will have to opt in to Theme.MaterialComponents to get the new theme.
Also add in DesignTheme attributes that were deleted and attributes that were set in Theme.Design*.
PiperOrigin-RevId: 183716471
And update bottomnavigation/build.gradle.
Also removes attribute dependencies on NavigationView, in order to avoid circular dependencies and/or creating a new package for NavigationView.
This is in preparation for adding a component style attr for bottom nav.
PiperOrigin-RevId: 183435857
This fixes BottomSheetBehavior implementation and remove uses of
deprecated APIs. The APIs are mainly about nested scrolling related to
inertia scrolling by nested fling.
This CL does not change the behavior. The inertia scrolling by nested
fling is not enabled. For that, we will have to change the way we use
ViewDragHelper, and let nested fling handle the inertia scrolling.
Bug: 70912761
Test: Existing tests (BottomSheetBehaviorTest, BottomSheetDialogTest)
Change-Id: Iaea50056ed253131c7920f703136d30e73918756
PiperOrigin-RevId: 183276945
That way, users will have to depend on one of the box styles directly. Before, anyone that used Widget.MaterialComponents.TextInputLayout would have gotten an outline text field, which is not implied by the style name.
This commit also includes a slight reformat to make sure that style items that don't fit on one line are properly formatted.
PiperOrigin-RevId: 183130385
And assign it to the right defaults in the theme.
Since text fields is in the widget package, . I put the attr declaration in widget/../attrs.xml right on top of the theme. If text fields is ever pulled into its own package, this attribute will be moved along with the rest of TextInputLayout's attributes.
PiperOrigin-RevId: 183125979
This commit creates a textfield package for resources related to text fields. It does not move TextInputLayout to this package, since that would break current users.
There's a small unrelated change included in this move: drawable-v21/design_bottom_navigation_item.xml was not moved along with its compat counterpart when it was moved recently, so I moved it while I was moving things around.
PiperOrigin-RevId: 183101110
Previously [most of] the components were either in `widget` or depended on it,
and all theme-related resources (attributes, styles, etc.) were placed there.
This structure doesn't really work for our goals, and makes it harder to split
components by functional area. In this commit, I move all the theme definitions
to `theme` (as well as `dialog` and `bottomsheet` since they also have relevant
themes, and splitting them into separate packages is the only way to make the
dep tree non-circular). Component packages declare their own theme attributes
(e.g. `chip` declares all the theme attributes necessary for chips), as well as
styles, colors, dimens, drawables, etc.
This move isn't entirely complete in this commit, but it is enough to get
things building with this setup. I'll move the rest of the components' resources
in follow-up commits.
PiperOrigin-RevId: 182611275
To support different font weights and other text attributes for active and inactive TextViews, the bottom nav now takes two separate text appearances, one for the active TextView, and one for the inactive TextView. This creates more complexity for how the ColorStateList for textColor is handled, and there were a couple of alternatives considered, but this seems to be the most elegant solution to a unique set of requirements.
The text size attributes introduced in the last commit are deleted. They were only necessary as an interim solution for text sizes, to keep the active and inactive labels from jumping to the wrong sizes.
PiperOrigin-RevId: 182054036