ExpandableFabLayout

class ExpandableFabLayout : CoordinatorLayout

The container and controller for all children views of the ExpandableFab widget (Overlay, ExpandableFab, FabOption, Label). The ExpandableFabLayout handles the bulk of the functionality for the ExpandableFab widget as a whole (from coordinating opening and closing animations to screen orientation changes, etc). See below for an example on how to easily set up the ExpandableFab widget using the ExpandableFabLayout as the containing ViewGroup.

Protip: If you only set a single ExpandableFab widget, it will automatically be used for both portrait and landscape orientations. No need to set duplicate views if you would like the same widget in both orientations. If you would like two different widgets for portrait and landscape however, you can do so by explicitly defining different orientations for the different sets of widget views. In the example below we don't set orientation for any of the views, so they default to 'portrait'. However, since we didn't explicitly set landscape views, the widget will actually be used for both portrait and landscape.

ExpandableFab widget Example via XML:

Developer Notes:

  1. The ExpandableFabLayout should be given a layout_width and layout_height of match_parent, and it should be a child of a ViewGroup that has access to draw over the full screen as well. This is necessary as some views of the widget (like the Overlay) may need the ability to draw over the full screen. Setting the dimensions as such will not impede the viewability, clickability or focusability of any other views in your layout.

Implementation Notes:

  1. Since the Kotlin 'internal' modifier translates to 'public' in Java, the JvmSynthetic annotation is used on those functions and properties to hide them from the published API for Java clients. A proper solution to this issue would be a package-private visibility modifier, but Kotlin has yet to implement it (https://youtrack.jetbrains.com/issue/KT-29227). Until then, the JvmSynthetic annotations should remain in order to present the proper published API to both Java & Kotlin clients.

Since

1.0.0

Constructors

ExpandableFabLayout
Link copied to clipboard
fun ExpandableFabLayout(context: Context)

Used to create an ExpandableFabLayout programmatically (do not use the other constructor ExpandableFabLayout(context, attributeSet) - it is for use by the Android framework when inflating an ExpandableFabLayout via XML).

ExpandableFabLayout
Link copied to clipboard
fun ExpandableFabLayout(context: Context, attributeSet: AttributeSet)

Called by the system when creating an ExpandableFabLayout via XML (don't call this directly). To create an ExpandableFabLayout programmatically, use the ExpandableFabLayout(context) constructor.

Functions

addView
Link copied to clipboard
open override fun addView(child: View?, index: Int, params: ViewGroup.LayoutParams?)

Adds a child view with the specified layout parameters to the ExpandableFabLayout.

addViews
Link copied to clipboard
fun addViews(vararg children: View?)

Convenience method for adding multiple children views to the ExpandableFabLayout at once, programmatically. Ensure your children views are of type Overlay, ExpandableFab or FabOption only.

close
Link copied to clipboard
fun close()

Attempts to close the ExpandableFab, playing the appropriate animations in the process. If the ExpandableFab is not in a position to close (it's still playing its opening animations), it will remind itself to close once it is able.

getCurrentConfiguration
Link copied to clipboard
fun getCurrentConfiguration(): OrientationConfiguration

Returns the OrientationConfiguration showing for the current screen orientation. An OrientationConfiguration is just a holder for all the views of an ExpandableFab widget in a specific Orientation.

isOpen
Link copied to clipboard
fun isOpen(): Boolean

Returns true if the ExpandableFab is currently open (any attached Overlay, FabOption and Labels are visible and all animations are done).

removeAllViews
Link copied to clipboard
open override fun removeAllViews()

Removes all child views in both portrait and landscape orientation from the ExpandableFabLayout.

Properties

expandableFabClosingAnimationDurationMs
Link copied to clipboard
var expandableFabClosingAnimationDurationMs: Long? = null

The duration (in milliseconds as a positive long) of the closing animations for ALL the ExpandableFabs inside of this ExpandableFabLayout. A convenience method so that clients don't have to set the same value for every ExpandableFab within a single ExpandableFabLayout.

expandableFabOpeningAnimationDurationMs
Link copied to clipboard
var expandableFabOpeningAnimationDurationMs: Long? = null

The duration (in milliseconds as a positive long) of the opening animations for ALL the ExpandableFabs inside of this ExpandableFabLayout. A convenience method so that clients don't have to set the same value for every ExpandableFab within a single ExpandableFabLayout.

fabOptionClosingAnimationDurationMs
Link copied to clipboard
var fabOptionClosingAnimationDurationMs: Long? = null

The duration (in milliseconds as a positive long) of the closing animations for ALL the FabOptions inside of this ExpandableFabLayout. A convenience method so that clients don't have to set the same value for every FabOption within a single ExpandableFabLayout.

fabOptionOpeningAnimationDurationMs
Link copied to clipboard
var fabOptionOpeningAnimationDurationMs: Long? = null

The duration (in milliseconds as a positive long) of the opening animations for ALL the FabOptions inside of this ExpandableFabLayout. A convenience method so that clients don't have to set the same value for every FabOption within a single ExpandableFabLayout.

labelHiddenToVisibleAnimationDurationMs
Link copied to clipboard
var labelHiddenToVisibleAnimationDurationMs: Long? = null

The duration (in milliseconds as a positive long) of the hidden to visible state animations for ALL the Labels inside of this ExpandableFabLayout. A convenience method so that clients don't have to set the same value for every Label within a single ExpandableFabLayout. This property will affect Labels on ExpandableFabs AND FabOptions.

labelVisibleToHiddenAnimationDurationMs
Link copied to clipboard
var labelVisibleToHiddenAnimationDurationMs: Long? = null

The duration (in milliseconds as a positive long) of the visible to hidden state animations for ALL the Labels inside of this ExpandableFabLayout. A convenience method so that clients don't have to set the same value for every Label within a single ExpandableFabLayout. This property will affect Labels on ExpandableFabs AND FabOptions.

landscapeConfiguration
Link copied to clipboard
var landscapeConfiguration: OrientationConfiguration

A holder for all the views of the ExpandableFab widget declared in the landscape screen orientation. Values for the views will only be populated after they are added through calls to ExpandableFabLayout's addView methods (or after they're defined via XML).

overlayClosingAnimationDurationMs
Link copied to clipboard
var overlayClosingAnimationDurationMs: Long? = null

The duration (in milliseconds as a positive long) of the closing animations for ALL the Overlays inside of this ExpandableFabLayout. A convenience method so that clients don't have to set the same value for every Overlay within a single ExpandableFabLayout.

overlayOpeningAnimationDurationMs
Link copied to clipboard
var overlayOpeningAnimationDurationMs: Long? = null

The duration (in milliseconds as a positive long) of the opening animations for ALL the Overlays inside of this ExpandableFabLayout. A convenience method so that clients don't have to set the same value for every Overlay within a single ExpandableFabLayout.

portraitConfiguration
Link copied to clipboard
var portraitConfiguration: OrientationConfiguration

A holder for all the views of the ExpandableFab widget declared in the portrait screen orientation. Values for the views will only be populated after they are added through calls to ExpandableFabLayout's addView methods (or after they're defined via XML).