45 Commits

Author SHA1 Message Date
afohrman
deb50914cb Support RTL for cutout.
Make the CutoutDrawable draw itself in the correct bounds when in RTL mode. This involves changing CollapsingTextHelper#getCollapsedTextActualBounds to return bounds that account for RTL.

PiperOrigin-RevId: 185916657
2018-03-12 12:41:31 -04:00
afohrman
73338efbe0 Set CutoutDrawable bounds before the first draw.
Set cutout bounds in onLayout to make sure that they're set by the time the first draw happens.  This fixes an issue where the CutoutDrawable was drawn with incorrect bounds if setText was called on the TextInputEditText before it was laid out, by ensuring that the cutout bounds are set before the first draw pass.

PiperOrigin-RevId: 185877643
2018-03-12 12:41:13 -04:00
cketcham
f9e2f23b3c Add BottomDrawer component which allows for easily showing content from the bottom of the screen.
PiperOrigin-RevId: 185863597
2018-03-12 12:40:54 -04:00
Material Design Team
c9e56c9959 Create a new default style for NavigationView and move the existing Design style to new package.
PiperOrigin-RevId: 185658659
2018-03-12 12:39:42 -04:00
afohrman
613eaea7be Add icon size attribute and demo to bottom nav.
Adds an itemIconSize attribute, setters, getters, and tests to BottomNavigationView, as well as a Catalog demo for icon size with a slider.

PiperOrigin-RevId: 185609075
2018-03-12 12:39:06 -04:00
afohrman
f3d9a07b1f Add default bottom nav component style attribute in BottomNavigationView constructor.
PiperOrigin-RevId: 185562589
2018-03-12 12:38:48 -04:00
afohrman
490f7f9595 Automated g4 rollback of changelist 185533755
PiperOrigin-RevId: 185543163
2018-03-12 12:38:33 -04:00
afohrman
85952c42a3 Use default style in TIL and bottom nav constructors.
PiperOrigin-RevId: 185533755
2018-03-12 12:38:16 -04:00
markwei
84fd72dc03 Rollback changes to BaseTransientBottomBar.
PiperOrigin-RevId: 184595279
2018-03-12 12:33:16 -04:00
dniz
a20a281ffe Revert expandable dependency in widget to be implementation again
PiperOrigin-RevId: 184529100
2018-03-12 12:32:56 -04:00
gauthams
d1c2b6249b Add tabStyle theme attribute for tab layout style
PiperOrigin-RevId: 184359499
2018-03-12 12:32:38 -04:00
dniz
c84e325c0d Make expandable dependency api instead of implementation in widget
PiperOrigin-RevId: 184289220
2018-03-12 12:27:56 -04:00
afohrman
ff91999cd8 Create public_attrs for textfield.
And move attributes from widget's public_attrs to it. Also add some attributes that weren't in public_attrs yet.

PiperOrigin-RevId: 184201597
2018-03-02 15:40:11 -05:00
afohrman
677f4abe84 Invalidate after applying box attributes instead of after assigning them.
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
2018-03-02 15:38:18 -05:00
markwei
2e2c348e6f Add new enforceMaterialTheme attribute that you can set in any style to denote that the style uses a new attribute that must exist in the app theme.
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
2018-03-02 15:36:20 -05:00
gauthams
caab267a86 Add all new tabs attributes to public_attrs.xml
PiperOrigin-RevId: 184055361
2018-03-02 15:34:17 -05:00
gauthams
809bf757a5 Workaround for tab indicator tinting on API 21
PiperOrigin-RevId: 183910609
2018-03-02 15:32:45 -05:00
gauthams
3c05304f4e Create package for tabs resources.
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
2018-03-02 15:04:21 -05:00
dniz
c31ef1f1d7 Update Gradle and Maven configurations
PiperOrigin-RevId: 183872033
2018-03-02 14:58:51 -05:00
afohrman
8ce02fd5ef Move bottom nav resources to bottomnavigation package.
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
2018-03-02 14:55:43 -05:00
Yuichi Araki
a9717cf6b8 Fix uses of deprecated API in BottomSheetBehavior
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
2018-01-25 18:25:54 -05:00
afohrman
ed039479e5 Create package for text field resources.
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
2018-01-25 18:23:54 -05:00
travisc
04bf0a7c42 Move themes into theme package, invert dependency structures around components.
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
2018-01-25 18:12:31 -05:00
gauthams
d0431c72df Add unbounded ripple attribute to TabLayout
PiperOrigin-RevId: 182458105
2018-01-25 18:12:07 -05:00
afohrman
ec18befe2d Delete shifting mode in favor of label visibility mode.
PiperOrigin-RevId: 182431135
2018-01-25 18:10:56 -05:00
afohrman
f909ab4d9e Rename text input resource prefixes from design -> mtrl.
These dimensions were added before we changed the naming scheme for new resources.

PiperOrigin-RevId: 182426105
2018-01-25 18:09:39 -05:00
afohrman
1967141098 Add active text appearances to bottom nav.
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
2018-01-16 16:15:01 -05:00
markwei
e26a690572 Add letter spacing to typographic styles.
PiperOrigin-RevId: 181810134
2018-01-16 16:13:58 -05:00
Material Design Team
5643af73b3 Automated g4 rollback of changelist 181541883
PiperOrigin-RevId: 181544129
2018-01-11 11:26:20 -05:00
dcarlsson
4c1f422765 Update how MaterialCardView handles background color.
PiperOrigin-RevId: 181541883
2018-01-11 11:26:00 -05:00
markwei
977f529a4d Add typography style TextAppearances and demo.
PiperOrigin-RevId: 181534940
2018-01-11 11:25:33 -05:00
cketcham
3056e3772e Added mode attribute to BottomAppBar
PiperOrigin-RevId: 181520200
2018-01-11 11:25:00 -05:00
afohrman
b12f4dee49 Add text sizing capabilities to bottom nav.
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
2018-01-11 11:24:31 -05:00
gauthams
43a96f559a Add flag to TabLayout to limit indicator width to the width of its content, rather than the width of the entire tab item
PiperOrigin-RevId: 181358392
2018-01-11 11:14:17 -05:00
Material Design Team
9c11d3531a Prevent potential NPE. It's reported in live AGSA bugs and the root cause could be the same with cl/152195381.
PiperOrigin-RevId: 181238092
2018-01-11 11:13:47 -05:00
afohrman
2885fc7ad8 Remove field prefixes from bottom nav code in the widget package.
This is part 2 of a change that removes field prefixes from code related to bottom nav.

PiperOrigin-RevId: 181229750
2018-01-11 11:13:30 -05:00
cketcham
4d80d2f76d Separate attached and detached state from the mode.
The FAB should float above the BottomAppBar when it is detached.

PiperOrigin-RevId: 181165130
2018-01-11 11:12:30 -05:00
dcarlsson
b864c352a1 Add class for MaterialCard.
Add foundation for styles and theme support.

PiperOrigin-RevId: 181045762
2018-01-11 11:11:35 -05:00
travisc
1ef167edc2 Move ThemeUtils to internal package and rename to ThemeEnforcement.
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
2018-01-11 11:09:46 -05:00
travisc
0f29cbf042 Make widget its own package, change lib into a pure export package.
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
2018-01-11 11:08:30 -05:00
travisc
b7fb904d18 Make internal its own package.
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
2018-01-11 10:58:06 -05:00
gauthams
2aa0405d03 Fix issue where setting indicator height to 0dp would not hide the indicator
PiperOrigin-RevId: 178756271
2018-01-11 10:56:13 -05:00
gauthams
f6769a509c Add tab selection indicator gravity attribute to TabLayout. Also renames SlidingTabStrip to SlidingTabIndicator.
PiperOrigin-RevId: 178626652
2018-01-11 10:55:49 -05:00
cketcham
72d0370a1c Fix bouncy behavior with nested scrolling v2
Adds condition to only snap the CoordinatorLayout if a fling is ending, or a fling won't be started

PiperOrigin-RevId: 178374659
2018-01-11 10:54:52 -05:00
travisc
ab2fec6da4 Move lib/src/ to lib/java/, and lib/jvmtests/javatests/ to lib/javatests/.
Bazel is happier if Java/Java test roots are named 'java' and 'javatests', and
this will mean that once we create a BUILD file for
android/support/design/{widget,internal}/ we'll no longer need a custom package
specified in our build (which tends to cause build problems that manifest quite
weirdly). This commit doesn't attempt to refactor the build at all yet, and is
just a pure move.

PiperOrigin-RevId: 178060739
2018-01-11 10:50:18 -05:00