203 Commits

Author SHA1 Message Date
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
Material Design Team
7f6fe75b9f Automated g4 rollback of changelist 170569077
PiperOrigin-RevId: 170569328
2017-11-10 15:54:24 -05:00
markwei
d48039b988 Parameterize FAB showMotionSpec and hideMotionSpec.
- FAB show/hide animations are now using MotionSpec API.
- New motion specs for FAB show/hide has been created and should behave
identical to before.
- FAB now supports a new iconScale animation that animates the image matrix of
the icon to scale it. The new motion specs are crafted so that iconScale
animations do not play, but jump immediately to the desired scale (1f or 0f) for show/hide.

PiperOrigin-RevId: 170569077
2017-11-10 15:52:59 -05:00
markwei
c89dfef597 New MotionSpec API.
Support inflating a MotionSpec from a R.animator resource.
Create a few backwards compatible R.interpolator resources that clients can use for this API.

PiperOrigin-RevId: 170567793
2017-11-10 15:50:23 -05:00
afohrman
8003f22530 Add color parameter for outline box.
Adds an attribute for the box's stroke (outline) color. Includes a public and private attribute, setters, getters, documentation, and tests.

PiperOrigin-RevId: 170239224
2017-11-10 15:47:23 -05:00
markwei
1f90669495 Actually change FAB elevation on API 21.
Listen for onDrawableStateChanged() and manually set the correct elevation without animation.

PiperOrigin-RevId: 170127224
2017-11-10 15:43:53 -05:00
miguely
289ccd7577 Add explicit exclusions to "**/build/**" in gradle files.
Since our source roots are the project's root directory, generated output falls inside it, unless properly excluded, all intermediate output such as R classes gets recompiled with each gradle pass.

This causes failures because of duplicate R classes.

PiperOrigin-RevId: 169588457
2017-09-21 16:13:59 -04:00
miguely
befb1996a6 Fix NewApi Lint error on backlayer test project
PiperOrigin-RevId: 169587243
2017-09-21 16:13:42 -04:00
miguely
713ac062ad Update Gradle build to fit our new code structure.
We have subprojects of :lib: because our internal builds are bazel-based. Gradle does not support more than one project at any level with the same name, which is a staple of bazel-based builds, so gradle projects have to be renamed in runtime to include their whole path (see settings.gradle).

Furthermore since every node includes the path up until that node in its name, writing dependencies can get tedious, for this purpose there is a new method in build.gradle called getTransformedProjectPath which takes /-separated project path and turns it into the correct project path, after the rename.

This also updates versions for TargetSdk and SupportLibrary to 26, which is required by the newer code.

PiperOrigin-RevId: 169457686
2017-09-21 15:09:52 -04:00
miguely
461430fb89 Fix lack of final qualifier for inner class
PiperOrigin-RevId: 169447663
2017-09-21 15:09:29 -04:00
markwei
8e866cc7da FAB to sheet transformation part 1.
ExpandableBehavior:
onExpandedStateChange() is now guaranteed to be called after the dependency and child have both been laid out.
The first-layout case does this by using a pre draw listener.

ExpandableTransformationBehavior:
onCreateExpandedStateChangeAnimation() now has a currentlyAnimating hint,
which when false can be used by subclasses to initialize the sheet during expansion.

FabTransformationBehavior:
Contains translation and expansion, with scaffolding for other motion components.

FabTransformationSheetBehavior:
Contains the MotionTiming for each motion component for FAB to sheet transformation.

Demo in catalog is now draggable.
You can reposition the FAB and the sheet to see how it affects the transformation.

PiperOrigin-RevId: 167796529
2017-09-21 14:48:57 -04:00