213 Commits

Author SHA1 Message Date
Material Design Team
0801d0e05b Refactor test imports
PiperOrigin-RevId: 202796842
2018-07-02 11:28:27 -04:00
connieshi
d584f91ccc Resolve fonts asynchronously to avoid ANR.
Added flag to specify that fonts should be resolved synchronously for instrumentation tests.

PiperOrigin-RevId: 202033678
2018-07-02 09:37:14 -04:00
cketcham
8f7dc21a27 Add android:fontFamily to all text styles
This lets us support clients who can't or don't need to use AppCompatTextView. Using `android:fontFamily` will work for clients with min sdk >= 16.

PiperOrigin-RevId: 202032242
2018-07-02 09:26:47 -04:00
afohrman
1cad4007dc Roll forward box background fix.
PiperOrigin-RevId: 197041463
2018-05-17 19:45:46 -04:00
afohrman
4700966a38 Roll back box background changes.
PiperOrigin-RevId: 196762626
2018-05-16 11:49:37 -04:00
afohrman
e566a535ac Ensure box background is drawn behind other text field elements.
This commit:
- Moves the draw calls in TextInputLayout#draw to happen in a better order: now, the background is drawn first, then TextInputLayout and its children, then the hint. This prevents the box from drawing on top of other text field elements.
- Updates box background setters and getters to modify boxBackgroundColor instead of defaultBoxBackgroundColor.
- Adds a demo for filled box background color changes to the text field demo.

PiperOrigin-RevId: 196748102
2018-05-16 11:48:54 -04:00
dniz
e4c8535352 Remove backlayer and materialswitch
PiperOrigin-RevId: 195148145
2018-05-02 17:07:28 -04:00
afohrman
886853babb Use start/end for TextInputLayout attributes.
Change attributes, setters, getters, resources, and tests for corner radii and box padding to use start/end instead of left/right. The goal is to make TextInputLayout more RTL friendly; beforehand, RTL use cases would have to directly call padding and corner radii methods with RTL values. After this change, TextInputLayout will determine whether it is in RTL mode and apply the relevant attributes appropriately.

PiperOrigin-RevId: 193565849
2018-04-30 11:35:26 -04:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00
cketcham
a9180a5256 Remove reflection for CoordinatorLayout#getLastWindowInsets() as it is now public
PiperOrigin-RevId: 191601519
2018-04-17 15:51:14 -04:00
dniz
3ea78dd02b Fix CoordinatorLayout getLastWindowInsets() reflection
PiperOrigin-RevId: 191304626
2018-04-03 12:09:09 -04:00
dniz
3f6ba81d6e Remove library references to widget package
PiperOrigin-RevId: 191302154
2018-04-03 12:07:57 -04:00
dniz
910961412d Move Snackbar classes and resources from widget/internal to snackbar package
PiperOrigin-RevId: 191070265
2018-04-03 12:04:39 -04:00
dniz
0bc8f38d8a Automated g4 rollback of changelist 190996602
PiperOrigin-RevId: 191011241
2018-04-03 12:03:30 -04:00
dniz
85b2b08aec Move Snackbar classes and resources from widget/internal to snackbar package
PiperOrigin-RevId: 190996602
2018-04-03 12:02:29 -04:00
cketcham
a87d71a4ae Move components out of widget
PiperOrigin-RevId: 190828084
2018-04-03 11:55:32 -04:00
dniz
ade4df00cb Change Gradle build to output single Maven artifact
PiperOrigin-RevId: 190774454
2018-04-03 11:49:01 -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
dniz
c31ef1f1d7 Update Gradle and Maven configurations
PiperOrigin-RevId: 183872033
2018-03-02 14:58:51 -05:00
afohrman
ec18befe2d Delete shifting mode in favor of label visibility mode.
PiperOrigin-RevId: 182431135
2018-01-25 18:10:56 -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
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
afohrman
2f8eadd7af Remove default label visibility mode for Widget.MaterialComponents style.
PiperOrigin-RevId: 178019794
2018-01-11 10:43:41 -05:00
travisc
3bb26c2161 Automated g4 rollback of changelist 177665816
PiperOrigin-RevId: 177887460
2018-01-11 10:41:13 -05:00
travisc
ffebec0320 Automated g4 rollback of changelist 177662721
PiperOrigin-RevId: 177665816
2018-01-11 10:39:44 -05:00
travisc
34e29ecd1f Remove field prefixes from MDC code.
PiperOrigin-RevId: 177662721
2018-01-11 10:32:13 -05:00
Alper Gundogdu
f78b88b070 Added sizing api to FAB
Added a demo for custom size

Bug: 35406827
Fixes: 35406827
Test: ./gradlew design:connectedAndroidTest
-Pandroid.testInstrumentationRunnerArguments.class=android.support.design.widget.FloatingActionButtonTest
Change-Id: I2dd1548885a302a5e9e40333e33da0c0a3d8a538
PiperOrigin-RevId: 177657643
2018-01-11 10:29:25 -05:00
travisc
5d3098956c Update gradle to 4.1 and Android gradle plugin to 3.0.
This changes all our dependencies to use the 3.0-style dep types (api and implementation). Generally it just makes everything api unless known otherwise, but moving to implementation where possible in the future would be desirable.

PiperOrigin-RevId: 177391618
2018-01-11 10:19:47 -05:00
Aurimas Liutikas
acbacb2142 Fix CoordinatorLayout edge building process.
There was a bug in the way the dependency graph was filled on the first
measure/layout pass. We iterated over all child views and for each child
A we iterated every other child and for each other child B we checked if
B depends on A and if so, we added an edge A->B to the dependency graph.
For anchors, on the first run, each child's LayoutParams only have info
about its anchorId and not the anchor view itself. This is resolved by
calling LayoutParams.findAnchorView(). Until this call, checking
LayoutParams.dependsOn() returns false. In current implementation we
only called findAnchorView() for child A, but then we checked
dependsOn() for child B.

This fixes this issue with inverting the check, so we check if A depends
on B and if it does, we add an edge B->A to the dependency graph.

Bug: 31622224
Test: Added CoordinatorLayoutTest.testAnchorDependencyGraph() test case
that fails without this fix.
Change-Id: Idcdf82031cce02340b2733aad1e30feb6f9359bb
PiperOrigin-RevId: 177204145
2018-01-10 21:03:24 -05:00
Kirill Grouchnikov
68c77f0a8a Persist password visibility state
Also refactor one of the existing tests to use activity
recreation instead of orientation change (which is not as
reliable)

Bug: 37930078
Bug: 35368213
Test: ./gradlew support-design:connectedCheck --info --daemon
-Pandroid.testInstrumentationRunnerArguments.package=android.support.design.widget
Change-Id: I1b9165fb11e03b9c855e118f31dee27e7dac8149
PiperOrigin-RevId: 177198734
2018-01-10 21:02:19 -05:00
Jonathan Koren
2b77f89b00 BottomNavigationView: contentDescription updates
- Update design demo sample
- Add test for content descriptions

Bug: 33896023
Test: Added new test to BottomNavigationViewTest
Change-Id: I80b2bcdb45d96cfe574685f22a20003b0f2a4d4d
PiperOrigin-RevId: 177085075
2018-01-10 21:00:06 -05:00
travisc
9a2fde4aa3 Update MDC manifests to target 27.
PiperOrigin-RevId: 177064785
2018-01-03 14:47:15 -05:00
Felipe Leme
9e03b87ea1 Fix ViewStructure.getHint() for autofill on child of TextInputLayout.
TextInputLayout resets its child's hint; this change saves the original value
and temporary restores it on dispatchProvideAutofillStructure() so the child's
ViewStructure is properly set.

Fixes: 38324864
Test: ./gradlew support-design:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=android.support.design.widget.TextInputLayoutTest#testDispatchProvideAutofillStructure

Change-Id: I13a1652ac9320b86c44af669ab8e40040dea0845
PiperOrigin-RevId: 176529771
2017-12-20 13:43:04 -05:00
dniz
e4eced630d Fix MDC Gradle build issues related to animation and backlayer
PiperOrigin-RevId: 175875992
2017-11-15 17:00:04 -05:00
hazelton
3d03a448a4 Add new mode to BottomSheetBehavior that supports half and full expansion of its contents.
Original mode (default and preserved for current clients --- mFitSheetToContents == true)
- Supports hidden, collapsed, and expanded settings
- "Expanded" setting grows the sheet to the height of its contents

New mode (mFitSheetToContents == false)
- Supports hidden, collapsed, half-expanded, and expanded settings
- "Half-expanded" setting grows the sheet to half the parent height
- "Expanded" setting grows the sheet to the parent height
- Dragging up and releasing snaps sheet to closest setting
- Dragging down collapses sheet

PiperOrigin-RevId: 174735925
2017-11-14 14:44:26 -05:00
markwei
6b81b3863e Allow MotionSpec inflation to return null.
Components must now handle null MotionSpecs.

PiperOrigin-RevId: 174252640
2017-11-14 14:43:12 -05:00
Kirill Grouchnikov
a1cda05d81 Tweak what happens when event interception is disallowed in CoL
Instead of sending a ACTION_CANCEL event only to the last child
that returned true from its Behavior.onTouchEvent / onInterceptTouchEvent,
send that to all the child views so that they can cancel whatever
tracking logic they might have.

Add a test that covers the specific case of HorizontalScrollView
in AppBarLayout that starts intercepting a horizontal swipe. Also
fix behavior for bottom sheet that wasn't "ready" to get cancel
events during the window attach phase.

Test: ./gradlew design:connectedCheck --info --daemon
-Pandroid.testInstrumentationRunnerArguments.class=android.support.design.widget.AppBarHorizontalScrollingTest
Test: ./gradlew design:connectedCheck --info --daemon
-Pandroid.testInstrumentationRunnerArguments.class=android.support.design.widget.AppBarWithCollapsingToolbarTest
Test: ./gradlew design:connectedCheck --info --daemon
-Pandroid.testInstrumentationRunnerArguments.package=android.support.design.widget
Bug: 33824951
Change-Id: Ida605ab53cc156c44d9cc8b14fb8ce7a024b18c5
PiperOrigin-RevId: 174240782
2017-11-14 14:41:59 -05:00
afohrman
eaee8cf2bf Add helper text attribute.
Also update the demo text fields so that their helper text is set via the attribute, instead of programmatically.

This commit also introduces some new methods in IndicatorViewController to provide symmetry with error text and abstract out some code that could be used for both error and helper text.

PiperOrigin-RevId: 174038374
2017-11-14 14:22:32 -05:00
afohrman
54b7b1b582 Add box corner radius parameter.
Add support for a box corner radius parameter via 4 new attributes, one for each corner. TextInputLayout now supports setting a corner radius with an attribute or programmatically.

PiperOrigin-RevId: 173965263
2017-11-14 14:20:10 -05:00
afohrman
e5b1f499b9 Add box background color parameter to text field box.
Adds a box background parameter to the text field box. This is useful for the filled box background, and also potentially for some new developments to the outline box.

The filled box now takes on a 4% black background by default. This adds support for changing the background later on, either to support other colors, or to support other states (such as hovered, pressed, etc.)

PiperOrigin-RevId: 173600532
2017-11-14 14:10:01 -05:00
markwei
75dbb6bccc Create compatibility() and project(fromPath()) dep targets for consistent dependencies.
Add missing dependencies.

PiperOrigin-RevId: 172164225
2017-11-14 13:43:18 -05:00
afohrman
8a72126daa Use color int instead of ColorStateList for box stroke color.
This is the first step in adding states to the outline text box. The states implementation plan is to handle the box's states similar to how TextInputLayout already handles states, and moving the box stroke color to be a color int sets the stage for that change.

In a nutshell, the states implementation plan is to add an updateBoxState() method in TextInputLayout's overridden drawableStateChanged(), and change the parameters affected by state in that method. Since updateBoxState() will handle changing the colors, and since GradientDrawable doesn't have support for ColorStateLists pre-21, it makes more sense for mBoxStrokeColor to be a color int. That way, TextInputLayout can handle all of the states the same way, instead of flagging different versions and essentially building states twice.

This commit changes the mBoxStrokeColor reference to point to a color int resource, and updates the getters, setters, documentation, the catalog demo entry, and the relevant tests to reflect the new variable type.

PiperOrigin-RevId: 171831287
2017-11-14 13:38:36 -05:00
Kirill Grouchnikov
559d400937 Fix dodge constants for CoordinatorLayout
Use consistent values for right dodging + add test coverage

Bug: 65976973
Test: ./gradlew design:connectedCheck --info --daemon
-Pandroid.testInstrumentationRunnerArguments.class=android.support.design.widget.AppBarWithDodgingTest
Change-Id: I48b5f4ec9b8e5d5484fcd846fd2f305d1987a5ef
PiperOrigin-RevId: 171615802
2017-11-14 13:38:08 -05:00
Material Design Team
a317be9150 Update Espresso package name
PiperOrigin-RevId: 171415474
2017-11-14 13:35:17 -05:00
markwei
1f3fb664cc MotionSpec API change.
Now it contains two static factory methods: loadFromAttribute() and loadFromResource().

PiperOrigin-RevId: 171216945
2017-11-13 14:23:49 -05:00
markwei
5edfba0242 BackLayerLayout cleanup.
BackLayerLayout:
- Expanded state is saved and restored via ExpandableWidgetHelper across configuration changes.
- BackLayerLayout and BackLayerSiblingBehavior no longer keep references to each other, minimizing stale state.
- All state changes now go through CoordinatorLayout.dispatchDependentViewsChanged(), mirroring other MDC-Android components like FAB Transformation and dynamic persistent sheet.

BackLayerSiblingBehavior:
- The behavior is now an ExpandableBehavior, mirroring other MDC-Android components like FAB Transformation and dynamic persistent sheet.
- Animates state changes using both position and translation, better separating its semantic meanings:
 - BLL's collapsed size determines the sibling's position, which never changes.
 - BLL's expanded size determines its translation, which is animated.
PiperOrigin-RevId: 171064071
2017-11-13 14:19:07 -05:00
afohrman
e97e947173 Create label cutout for outline box.
Use PorterDuff modes to create a cutout for the label when using the outline box version of TextInputLayout.

This commit focuses on creating the cutout functionality. The padding and bounds aren't the focus of this commit, and they aren't quite right yet. Measurements will be addressed in a future commit.

PiperOrigin-RevId: 170855509
2017-11-13 14:18:15 -05:00
afohrman
78ec4eb97d Fix screenshot test failures.
The screenshot tests showed a diff because of a change in the way the collapsed height was being measured. It used to be measured as -ascent, but it was changed to measure the text using the more traditional descent - ascent. This commit changes the collapsed text measurement back to -ascent, and should result in no diff.

PiperOrigin-RevId: 170737363
2017-11-10 15:55:42 -05:00
markwei
57b25026ca Automated g4 rollback of changelist 170569328
PiperOrigin-RevId: 170730468
2017-11-10 15:55:14 -05:00