Removes onSaveInstanceState() and onRestoreInstanceState() from the ExpandableWidget interface. Those methods required all descendent subclass Views to declare those methods to be public, which is not ideal given how many FAB subclasses there are.
Those interface methods were mostly used for their javadoc, which is now moved into the interface javadoc.
PiperOrigin-RevId: 163440160
BackLayerLayout.
This change also adds details on why all of these could not be consolidated
into less attributes and generally improves the usage guide.
PiperOrigin-RevId: 163094493
This broke clients that subclassed ExpandableFloatingActionButton and overrode onSaveInstanceState(). Because those subclasses declared the methods as protected, it conflicts with this commit which makes them public.
Will roll-forward with client fixes.
PiperOrigin-RevId: 162844548
Separate ExpandableBehavior and ExpandableTransformationBehavior.
ExpandableWidget - for widgets that have expanded state, like BackLayerLayout:
{g,s}etExpanded()
on{Save,Restore}InstanceState()
ExpandableBehavior - for behaviors that want to react to expanded state change, like BackLayerSiblingBehavior:
onLayoutChild() // Layouts the content, and animates the content to a new expanded position when BLL's expanded children change size.
onExpandedStateChange() // Animates the content position when expanded state changes.
ExpandableTransformationWidget - for widgets that transform during expansion, like FAB:
{g,s}etExpandedComponentIdHint()
Will also include these in the future:
getBackgroundDrawable() // Shape drawable includes color, bounds, shape, elevation
getForegroundDrawable()
etc
ExpandableTransformationBehavior - for behaviors that want to react to expanded state change by transforming, like FabTransformationSheetBehavior:
onCreateExpandedStateChangeAnimation() // Animates the FAB and sheet when expanded state changes.
PiperOrigin-RevId: 162809090
Most of the layout files were not following our code style and followed an attribute ordering scheme that didn't make very much sense (ex: putting an attribute's format before its name).
Reformatting these files in a separate commit will help prevent formatting changes distracting from the main point of commits.
PiperOrigin-RevId: 162670506
This change adds all the foundation code needed:
+ demo in the Catalog,
+ persistentsheet package with 2 classes:
* PersistentSheet,
* PersistentSheetTransformationBehavior
Instead of a proper expansion animation, a placeholder animation copied from FAB transformations is added. Proper animations to be added later.
PiperOrigin-RevId: 162641104
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
The typeface comparisons in CollapsingTextHelper were triggering a ReferenceEquality warning. Changing to an Objects.equals comparison did not fix the problem, because Objects is not available down to API level 15. I added a SuppressWarnings annotation to match the way this already is addressed in TextInputLayout.
PiperOrigin-RevId: 162399064
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
FabTransformationSheetBehavior and FabTransformationScrimBehavior implement
specific variations of an ExpandableTransformationBehavior.
These Behavior currently just does a simple fade of the FAB, sheet, and scrim.
PiperOrigin-RevId: 161758301
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
Motion additions/updates in this change:
- Added animation for error text's translation down
- Updated durations and interpolators for the opacity in and out animations
These changes roll forward changes that were previously rolled back because they broke screenshot tests.
PiperOrigin-RevId: 158881906
The implementation in ics/ was the only remaining implementation of that class,
so it made sense to move it directly into src/. Most of the implementations in
base/ were the only remaining implementations, and thus also made sense to move
into src/.
The remaining classes were already post-fixed with Lollipop, so I see very
little value in maintaining separate source directories for them (and I know
these separate directories have also been flagged as confusing). They've all
been moved into src/ as well now. I also renamed FloatingActionButtonLollipop
to FloatingActionButtonImplLollipop here, as that better describes what it is
a version of.
PiperOrigin-RevId: 158187999
Motion additions/updates in this change:
- Added animation for error text's translation down
- Updated durations and interpolators for the opacity in and out animations
PiperOrigin-RevId: 157220100
Also setting shifting mode before initializing view in BottomNavigationMenuView's updateMenu(), for consistency with buildMenu().
PiperOrigin-RevId: 156800545
Motion updates in this change:
- Shortened the duration for the label scale
- Changed the interpolators from linear to FastOutSlowIn
PiperOrigin-RevId: 156553820
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
- Update page title for each piece of documentation to use the vernacular concept rather
than the class name for the component.
- Treat all instances of class names as proper nouns and mark them as code names.
PiperOrigin-RevId: 155705022
The link to a method on Android's doc site had slashes in it, so it linked to the right documentation page, but not the specific method.
PiperOrigin-RevId: 155658544
Uses the correct CSS classes, and names each of the steps. The last two steps were merged, and we added in a click handler.
PiperOrigin-RevId: 155561692