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
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
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
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
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
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
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
- Update design demo sample
- Add test for content descriptions
Bug: 33896023
Test: Added new test to BottomNavigationViewTest
Change-Id: I80b2bcdb45d96cfe574685f22a20003b0f2a4d4d
PiperOrigin-RevId: 177085075
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
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
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
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
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
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
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
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
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
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
- 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
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
Adds an attribute for the box's stroke (outline) color. Includes a public and private attribute, setters, getters, documentation, and tests.
PiperOrigin-RevId: 170239224
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
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
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