-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback
,android.view.KeyEvent.Callback
,android.view.ViewManager
,android.view.ViewParent
,android.view.accessibility.AccessibilityEventSource
public final class Overlay extends FrameLayout
An overlay that will show when an ExpandableFab is clicked in order to partially or fully obscure the screen's content, allowing the ExpandableFab and FabOptions to become more apparent.
Developer Notes:
If you would like the Overlay to cover the entire screen, layout_width and layout_height must both be set to match_parent (assuming the parent ExpandableFabLayout has no size restrictions).
Overlays must be defined within an ExpandableFabLayout to function properly.
To ensure that Overlays cover screen content but NOT the ExpandableFab widget itself, ensure the Overlay is the first child of ExpandableFabLayout via XML, or the first view passed to ExpandableFabLayout's addView/addViews methods via code.
Implementation Notes:
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.
-
-
Field Summary
Fields Modifier and Type Field Description private Orientation
orientation
private Integer
overlayColor
private Float
overlayAlpha
private Long
openingAnimationDurationMs
private Long
closingAnimationDurationMs
-
Constructor Summary
Constructors Constructor Description Overlay(Context context, Orientation orientation)
Used to create an Overlay programmatically (do not use the other constructor Overlay(context, attributeSet) - it is for use by the Android framework when inflating an Overlay via XML). Overlay(Context context, AttributeSet attributeSet)
Called by the system when creating an Overlay via XML (don't call this directly).
-
Method Summary
Modifier and Type Method Description final Orientation
getOrientation()
The Orientation this Overlay is viewable in. final Unit
setOrientation(Orientation orientation)
final Integer
getOverlayColor()
The color of the overlay. final Unit
setOverlayColor(Integer overlayColor)
final Float
getOverlayAlpha()
The opacity of the overlay as a positive float, where 0 is completely transparent and 1 is completely opaque. final Unit
setOverlayAlpha(Float overlayAlpha)
final Long
getOpeningAnimationDurationMs()
The duration (in milliseconds as a positive long) of the animations that will be played when this Overlay is being shown from a hidden state (when the ExpandableFab is opening). final Unit
setOpeningAnimationDurationMs(Long openingAnimationDurationMs)
final Long
getClosingAnimationDurationMs()
The duration (in milliseconds as a positive long) of the animations that will be played when this Overlay is being hidden from a visible state (when the ExpandableFab is closing). final Unit
setClosingAnimationDurationMs(Long closingAnimationDurationMs)
Unit
setOnClickListener(View.OnClickListener onClickListener)
Registers a callback to be invoked when this Overlay is clicked. -
-
Constructor Detail
-
Overlay
Overlay(Context context, Orientation orientation)
Used to create an Overlay programmatically (do not use the other constructor Overlay(context, attributeSet) - it is for use by the Android framework when inflating an Overlay via XML).
-
Overlay
Overlay(Context context, AttributeSet attributeSet)
Called by the system when creating an Overlay via XML (don't call this directly).
-
-
Method Detail
-
getOrientation
final Orientation getOrientation()
The Orientation this Overlay is viewable in. Default value is Orientation.PORTRAIT.
-
setOrientation
final Unit setOrientation(Orientation orientation)
-
getOverlayColor
final Integer getOverlayColor()
The color of the overlay. Default value is white.
Usage of this property is preferred over the inherited setBackgroundColor method.
-
setOverlayColor
final Unit setOverlayColor(Integer overlayColor)
-
getOverlayAlpha
final Float getOverlayAlpha()
The opacity of the overlay as a positive float, where 0 is completely transparent and 1 is completely opaque. Default value is 0.78431f.
Usage of this property is preferred over the inherited set/getAlpha methods.
-
setOverlayAlpha
final Unit setOverlayAlpha(Float overlayAlpha)
-
getOpeningAnimationDurationMs
final Long getOpeningAnimationDurationMs()
The duration (in milliseconds as a positive long) of the animations that will be played when this Overlay 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 300L.
-
setOpeningAnimationDurationMs
final Unit setOpeningAnimationDurationMs(Long openingAnimationDurationMs)
-
getClosingAnimationDurationMs
final Long getClosingAnimationDurationMs()
The duration (in milliseconds as a positive long) of the animations that will be played when this Overlay 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 300L.
-
setClosingAnimationDurationMs
final Unit setClosingAnimationDurationMs(Long closingAnimationDurationMs)
-
setOnClickListener
Unit setOnClickListener(View.OnClickListener onClickListener)
Registers a callback to be invoked when this Overlay is clicked. The default behavior the Overlay will be executed before this custom callback.
-
-
-
-