81 Commits

Author SHA1 Message Date
leticiars
8ba4383e2c Adding tests for the Exposed Dropdown Menu.
PiperOrigin-RevId: 246509842
2019-05-03 11:07:49 -04:00
ldjesper
8349219be3 Allow limiting of MaterialCalendar to a start and end month. Allow setting of an opening month.
PiperOrigin-RevId: 245269687
2019-04-29 15:41:49 -07:00
connieshi
7d8b2117a0 Automated g4 rollback of changelist 242675939
PiperOrigin-RevId: 242751222
2019-04-19 13:26:30 -04:00
connieshi
00ffe5eea8 Begin integrating BadgeDrawable into BottomNavigationView.
TODO:
- update javadocs to provide guidance on how to call Badging API.
- Save badge states.
- Support displaying badges when bottom navigation item doesn't show an icon.
PiperOrigin-RevId: 242675939
2019-04-19 13:21:35 -04:00
gauthams
b3793edd2c Add initial support for reading values in MotionSpec
PiperOrigin-RevId: 239298785
2019-03-22 17:00:03 -04:00
leticiars
2642ff2697 Adding support for TextInputLayout start icon. It can be set to be just a drawable or, if a OnClickListener is set to it, a button.
For that reason, users should opt to use the start icon API instead of setting a start/left compound drawable on the text field's edit text.

PiperOrigin-RevId: 238984066
2019-03-22 16:19:36 -04:00
Chris Banes
78054fe4ea AppBarLayout + WindowInset handling fixes
When AppBarLayout is used with a CollapsingToolbarLayout
child, it currently does not handle WindowInsets
very well. This commit fixes that by properly handling
insets.

The primary issue is when an AppBarLayout is used
with a single Toolbar (very common use case), where
the Toolbar will currently be displayed behind the status bar.

Another issue is with HeaderScrollingViewBehavior.
To workaround CoordinatorLayout using its 'compatible measuring'
for insets, the behavior manually sets the scrolling view to fit
system windows. This has other issues though because
that view will get padded in. Fixed by manually adding the insets
back into the measured dimensions.

Also updated the catalog layouts to make use of
android:fitsSystemWindows=true

Resolves https://github.com/material-components/material-components-android/pull/299

PiperOrigin-RevId: 238396626
2019-03-22 16:08:28 -04:00
leticiars
5236a03fc4 Refactoring text field unit tests to test icons separately. Also adding tests for the custom end icon.
PiperOrigin-RevId: 235002414
2019-02-24 14:28:36 -05:00
leticiars
4882a4f131 Adding clear text button end icon to TextInputLayout.
PiperOrigin-RevId: 234141273
2019-02-24 14:15:28 -05:00
leticiars
4c2e9c4004 Changing the TextInputLayout's password toggle implementation into a generic API implementation, which will allow for easier support of future end icons. Also deprecating current password toggle end icon methods and attributes.
This change doesn't include support of a custom end icon yet.

PiperOrigin-RevId: 233645798
2019-02-24 14:07:11 -05:00
dniz
11df79f95c Clean up Gradle build shorthands for appcompat/androidx libraries
PiperOrigin-RevId: 229369959
2019-01-18 14:13:26 -05:00
cketcham
dc72aaeed4 Migrate Gradle build and sources to androidx
PiperOrigin-RevId: 225551505
2018-12-21 11:07:45 -05:00
leticiars
7169461605 Initial support for color subsystem in MDC text fields.
PiperOrigin-RevId: 218608066
2018-10-28 19:14:20 -04:00
connieshi
3c712cbe37 Add build target for MaterialComponentsViewInflater without depending on unused MDC components.
PiperOrigin-RevId: 216542656
2018-10-11 18:20:07 -04:00
ldjesper
8a3856922f Style Material RadioButton
PiperOrigin-RevId: 211998722
2018-09-14 10:50:38 -04:00
dniz
7cd55d872b Add Toolbar styles that use themed text appearances based on type scale
PiperOrigin-RevId: 202636817
2018-07-02 09:50:23 -04:00
afohrman
f2ebf56e21 Rename text field outlined style from "Outline" to "Outlined".
This commit updates the style names for the outlined text field box from "Outline" to "Outlined.

Widget.MaterialComponents.TextInputLayout.OutlineBox -> Widget.MaterialComponents.TextInputLayout.OutlinedBox, and
Widget.MaterialComponents.TextInputEditText.OutlineBox -> Widget.MaterialComponents.TextInputEditText.OutlinedBox.

This name matches spec and is closer to what is used on the other platforms.

PiperOrigin-RevId: 198768731
2018-05-31 16:39:44 -04:00
dniz
e4c8535352 Remove backlayer and materialswitch
PiperOrigin-RevId: 195148145
2018-05-02 17:07:28 -04:00
dniz
9ca33544ac Update package name to com.google.android.material
PiperOrigin-RevId: 193236235
2018-04-30 11:24:23 -04:00
dniz
3f6ba81d6e Remove library references to widget package
PiperOrigin-RevId: 191302154
2018-04-03 12:07:57 -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
dniz
ade4df00cb Change Gradle build to output single Maven artifact
PiperOrigin-RevId: 190774454
2018-04-03 11:49:01 -04: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
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
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
dniz
e4eced630d Fix MDC Gradle build issues related to animation and backlayer
PiperOrigin-RevId: 175875992
2017-11-15 17:00:04 -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
1b0a1f6165 Use Widget.MaterialComponents for text field box's styles.
This move paves the way for a dense vs. standard height parameter, which will be implemented with styles (*Box.Dense suffix will be introduced for the filled/outline box's dense version).

PiperOrigin-RevId: 172952022
2017-11-14 13:58:16 -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
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
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
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
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
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
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
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