FabOption

class FabOption : FloatingActionButton

The design and behavior of a single option within an ExpandableFab.

Developer Notes:

  1. Layout_width and layout_height should be set to wrap_content, unless you're setting custom dimensions.

  2. FabOptions must be defined within an ExpandableFabLayout to function properly.

  3. label.labelText must be non-null for the optional label to show and other label properties to take effect.

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

FabOption
Link copied to clipboard
fun FabOption(context: Context, orientation: Orientation? = Orientation.PORTRAIT)

Used to create a FabOption programmatically (do not use the other constructor FabOption(context, attributeSet) - it is for use by the Android framework when inflating a FabOption via XML). This constructor keeps all optional properties of a FabOption at their default values, though you can always change these values after instantiation by using the appropriate setter methods (with the exception of orientation, which cannot be changed after instantiation).

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

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

Functions

setOnClickListener
Link copied to clipboard
open override fun setOnClickListener(onClickListener: View.OnClickListener?)

Registers a callback to be invoked when this FabOption or its label is clicked. The default behavior the FabOption will be executed before this custom callback.

setSize
Link copied to clipboard
open override fun setSize(size: Int)

Sets the size of the FabOption. Overridden to ensure we never set the size to be FabSize.CUSTOM.

Properties

closingAnimationDurationMs
Link copied to clipboard
var closingAnimationDurationMs: Long = 75L

The duration (in milliseconds as a positive long) of the animations that will be played when this FabOption is being hidden from a visible state (when the ExpandableFab is closing). Set to 0L if you don't want closing animations played. Default value is 75L.

fabOptionColor
Link copied to clipboard
var fabOptionColor: Int

The color of the FabOption, as an integer in the form 0xAARRGGBB.

fabOptionEnabled
Link copied to clipboard
var fabOptionEnabled: Boolean = true

The enabled state of this FabOption and its label. Disabled FabOptions and labels will be visually distinct and unclickable. Default value is true (enabled).

fabOptionIcon
Link copied to clipboard
var fabOptionIcon: Drawable? = null

The drawable to show as the FabOption's icon. Default value is null (no icon shown).

label
Link copied to clipboard
val label: Label

The optional label attached to this FabOption. The label will only be shown when its labelText is not null. Default values for the label are as follows:

openingAnimationDurationMs
Link copied to clipboard
var openingAnimationDurationMs: Long = 125L

The duration (in milliseconds as a positive long) of the animations that will be played when this FabOption is being shown from a hidden state (when the ExpandableFab is opening). Set to 0L if you don't want opening animations played. Default value is 125L.

openingOvershootTension
Link copied to clipboard
var openingOvershootTension: Float = 3.5f

The tension (as a positive float) in an OvershootInterpolator applied on the FabOption when it's playing its animations for being shown from a hidden state (when the ExpandableFab is opening). The OvershootInterpolator allows us to have an animation where the FabOption will grow past its regular size when initially appearing, before smoothly shrinking down to regular size. Larger values will exaggerate the effort more. Default value is 3.5f.

orientation
Link copied to clipboard
var orientation: Orientation

The Orientation this FabOption is viewable in. Default value is Orientation.PORTRAIT.