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
Specific attributes used in AppBarLayout's theme will cause
the super constructor to call onCreateDrawableState before
class-level fields are initialized. Move the creation of temp
array to be on-demand.
Bug: 37460722
Test: ./gradlew support-design:connectedCheck --info --daemon
-Pandroid.testInstrumentationRunnerArguments.class=android.support.design.widget.AppBarWithScrollbarsTest
Change-Id: I086f25c676201876fd76cd3684afcab7e09436d0
PiperOrigin-RevId: 165010107
This CL also changes the API from a explicit expand()/collapse() method duo to a single setExpanded(boolean) to match other expandable widgets in MDC, for consistency.
This is a breaking change but there has been no release of MDC that contains BackLayerLayout in a usable state, so this is the right time to do this kind of change.
PiperOrigin-RevId: 164664813
Adds functionality to turn the floating label, or "hint", to the error color when the error is set. The error color for the label will match whatever the error color is set to via app:errorTextAppearance. In the case where no custom errorTextAppearance is set, the label gets set to the error color's default color, which is red/dark pink, depending on whether the text field is used in a dark or light theme.
PiperOrigin-RevId: 162553182
This commit adds functionality to TextInputLayout to support helper text, as outlined in spec: https://material.io/guidelines/components/text-fields.html#text-fields-layout.
This is an initial implementation of helper text. It is a large commit, and in order to avoid making it any larger, it does not include the following things:
- Setting helper text via XML attribute
PiperOrigin-RevId: 162390341
The content for the backlayer should be able to change in runtime to allow for multiple experiences in the backlayer. Furthermore, changing to a different experience should not imply collapsing and re-expanding the backlayer, it should happen in-place with the content layer sliding to accommodate the size of the new content.
If expand is called when the backlayer is already expanded then the backlayer
animates a possible size change.
If there is no need to change the size then the duration for the animation is
zero.
On the side, this changes BackLayer to be a LinearLayout.
PiperOrigin-RevId: 162277051
Espresso does not need the uiController.loopMainThreadUntilIdle() calls, so I removed them. Verified that removing these calls didn't add flakiness by running them with --runs_per_test=100.
PiperOrigin-RevId: 161989235
After this CL, FAB is able to keep an `expanded` state. When the state changes,
it dispatches an event to dependent Behaviors.
This change does not include any XML attributes.
PiperOrigin-RevId: 161757314
In previous code reviews there was a concern over the performance hit of
RelativeLayout's double measurement, and BackLayerLayout's own double measurement.
As a compromise we chose to use LinearLayout instead. Furthermore after
switching to LinearLayout, the EndBackLayerLayoutTest works, so this commit
also commits that new test.
PiperOrigin-RevId: 161720799
Adds concrete tests for Start, Top and Bottom backlayers.
Note: EndBackLayerLayoutTest has not been added in this CL because it is
failing over layout issues. These issues are not related directly to the core
functionality of the BackLayerLayout, but it still has to be fixed. Punting
this to a separate CL.
PiperOrigin-RevId: 161667143
BottomSheetBehaviorTest#testNestedScroll was failing on tablet.
Test: This is the test
Bug: 36855751
Change-Id: I1ea95d66aa3a3d8b85964428688c29839d067fb7
PiperOrigin-RevId: 160471346
-The exposure and hide actions are animated, and have before/after callbacks.
-Clicks on the content layer when the backlayer is exposed are hijacked to close the back layer.
-The animations do not relayout, by simply sliding the boundaries (bottom/left/right/top).
PiperOrigin-RevId: 160315361
Previously, the character counter and label overflow color ended up as Color.MAGENTA, which actually is a sickly pink color. This appears to have been happening when the theme doesn't extend from Theme.Design, and therefore doesn't have textErrorColor. On API 23 and above, it gets set to MAGENTA instead of throwing an exception. The only reason this pink color was being used for the character counter and not the error text is because there already a fix for the error text - it just wasn't applied to the character counter.
I pulled the logic for the fix out to make this graceful degradation code reusable for both error and character text, and for future situations like this.
PiperOrigin-RevId: 159229718
These are the foundation for the back layer functionality. The behavior
does the heavy lifting to measure the adjacent content view.
As of now this only lays out the views correctly in the hidden state, it doesn't support exposing the back layer at all, yet. Full of TODOs, this is just a skeleton.
PiperOrigin-RevId: 156334640
- AppBarWithCollapsingToolbarStateRestoreTest needed a variable used inside a closure to be marked as final (No idea why Bazel was okay with this)
- BottomNavigationViewTest/TabLayoutTest needed TargetApi annotations for tests that run on N+
- Every Shrine build.gradle file needs to specify values for Java includes and srcDirs, regardless of whether they contain Java. If they don't they get the default library values (which includes every subdirectory recursively), and result in duplicate classes being generated.
- Various styles.xml files in Shrine were using attributes only available in v17 or v21+
This also updates the main build.gradle file to print lint errors on stdout, so they're easier to look at in TravisCI.
PiperOrigin-RevId: 153389041
If there is a top window inset we need to make sure
that we expand our height to allow the Toolbar
to be offset.
BUG: 36126318
Test: included
Change-Id: I179fc6764166d80d92a8a995c93d54650365c2bf
PiperOrigin-RevId: 152452065
Bug: 30701044
Test: I was unable to repro this locally, but this should fix the flakiness
Change-Id: I58b143c5aeec13941b28bac6136f28215a8efbab
PiperOrigin-RevId: 152432632
AppBarWithCollapsingToolbarStateRestoreTest has been rotating the activity
without rotating it back causing tests that follow it to flake due to
unexpected
orientation change back to original orientation.
Bug: 36130096
Test: Test still passes locally
Change-Id: I642a72d8a90ae5c16df4ef3710a4fd3057bd3043
PiperOrigin-RevId: 152411001
We bumped our minSdk to 14 and now most of MotionEventCompat methods and
constants are no longer needed.
Bug: 32794064
Test: ./gradlew assemble assembleAndroidTest
Change-Id: I5fc698fc8243107cd969743b7500163818f8c258
PiperOrigin-RevId: 152201817
SmallTests are supposed to complete in <200ms, Medium in <1s, and Large in
<30s.
This CL updates the size of all the SmallTest based on excecution times from
presubmit test runners.
Test: None
Bug: 34854821
Change-Id: Iec73f7b6ef63b27cd3d8b19a8e8c7a9b91ff6729
PiperOrigin-RevId: 152174653
Modification of findScrollingChild() that only returns a view if
it has nested scrolling enabled (instead of just implementing
NestedScrollingChild). As to prevent an incorrect view being
referrenced, leading to incorrect behavior when scrolling.
Test: added BottomSheetBehaviorTest.testFindScrollingChildEnabled()
that tests that an enabled NestedScrollView contained within a disabled
NestedScrollView parent is returned by findScrollingChild(parent)
Change-Id: I9841db9c67520f858913a5109dc08ffed9e53568
PiperOrigin-RevId: 151889793
ValueAnimator can now be used directly given that our minSdk is 14.
Bug: 32794064
Test: ./gradlew clean assemble still works
Change-Id: Ibf0111b104eaea10acf33c8d54a3275fdfa0c1a4
PiperOrigin-RevId: 151641145
First step in moving minSdkVersion to API 14 for design library.
Bug: 32794064
Test: gradlew clean assemble assembleAndroidTest still works
Change-Id: I113834cc6e3c088cdf606a86fe7a35faa192b801
PiperOrigin-RevId: 151608161