7 Commits

Author SHA1 Message Date
markwei
659b5d16bc Roll forward separating ExpandableWidget/TransformationWidget and ExpandableBehavior/ExpandableTransformationBehavior.
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
2017-09-21 14:20:30 -04:00
markwei
f61171a94b Roll back ExpandableTransformation separation.
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
2017-09-21 14:19:37 -04:00
markwei
64f930f2a7 Separate ExpandableWidget and ExpandableTransformationWidget.
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
2017-09-21 14:18:58 -04:00
markwei
9cabd53c7f Fix for missing BaseSavedState(Parcel, ClassLoader) on APIs < 24.
Inherit from support-lib AbsSavedState instead of the framework BaseSavedState.

PiperOrigin-RevId: 162500649
2017-09-21 12:10:22 -04:00
travisc
329cc2d267 Roll forward. Fixes the crash on Parcelable restoration.
PiperOrigin-RevId: 161999957
2017-09-21 11:58:17 -04:00
travisc
680e3c3a25 Roll back FAB expand/collapse state due to crash it introduces.
PiperOrigin-RevId: 161864354
2017-09-21 11:57:01 -04:00
markwei
8571cd7386 Add expand/collapse state to FloatingActionButton.
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
2017-09-21 11:32:17 -04:00