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
Open an itemTextAppearance attribute and two attributes for active and inactive label sizes to allow customizing the label text sizes.
The Widget.MaterialComponents.BottomNavigationView styles now defaults to AppCompat's Caption sizing (12sp) for both the active and inactive label sizes.
PiperOrigin-RevId: 181399525
This is a first step in reversing the dependency flow around the `theme`
package in MDC. In a future commit, I'll make theme contain all the various
MaterialComponents theme definitions, and it will thus depend on the various
packages containing our components (widget, button, toggle, etc.).
The theme package will be empty as of this commit, but since I plan to use it
in the next one I've left the build infrastructure in place.
PiperOrigin-RevId: 180737806
This also moves expandable and transformation into their own packages, as was originally intended (but they had resources, which was problematic at that time). CoordinatorLayout has been moved out of the typical source root to ease its later deletion (when it has made it into core-ui).
PiperOrigin-RevId: 180728823
We cannot use 'switch' as a package name in java but would like to keep naming
conventions inline with sysUi - SwitchCompat. This feels clumsy to me as we now
have items such as <android.support.design.materialswitch.MaterialSwitch but I
am not sure how else to get around this.
PiperOrigin-RevId: 180649420
This gives internal its own res directory, and pushes the build files down into
the source directory (as it is with all our other non-widget packages). Ideally
new things don't really get added to this package (instead they can be added to
feature/component-specific packages as package private). A few new packages had
to be created in order to break circular dependencies between widget and
internal.
This commit also fixes a number of problems with the Gradle build, as they were
mostly related to dependency issues or things not being included in
settings.gradle.
The next step here is to do the same for the widget package, and turn the lib
build files into something that just exports the other library packages.
PiperOrigin-RevId: 179866428
This is still a WIP but breaking this down into smaller pieces for review purposes. There are a number of items still outstanding due to technical complexity that need to be addressed. I have included TODOs for each of these. These will need to be completed before moving this component into the main catalog.
The main items:
Finalise the base values from the red lines
Change the GradientDrawable for thumb and track to something that can have elevation
Fix the padding issue with the track - remove the workaround onDraw due to concerns over the solution being 'hacky'
TrackTintMode & ThumbTintMode needs adding
Ripple radius is smaller due to drawable which I will address once we have resolved the drawable solution
Video of toggle in current state:
https://drive.google.com/open?id=1pWFGuud3k3Wpay0CUKXZu8gbbxuCtG8d
PiperOrigin-RevId: 179551097
New singleSelection attribute to control whether the ChipGroup has a multiple-exclusion scope for its chips.
When set to true, the ChipGroup acts as a RadioGroup.
ChipGroup can be used purely for layout purposes when singleSelection is set to false.
PiperOrigin-RevId: 178466966