ConfirmationOverlay
class ConfirmationOverlay
Displays a full-screen confirmation animation with optional text and then hides it.
This is a lighter-weight version of ConfirmationActivity and should be preferred when constructed from an Activity.
Sample usage:
// Defaults to SUCCESS_ANIMATION
new ConfirmationOverlay().showOn(myActivity);
new ConfirmationOverlay()
.setType(ConfirmationOverlay.OPEN_ON_PHONE_ANIMATION)
.setDuration(3000)
.setMessage("Opening...")
.setOnAnimationFinishedListener(new ConfirmationOverlay.OnAnimationFinishedListener() {
@Override
public void onAnimationFinished() {
// Finished animating and the content view has been removed from myActivity.
}
}).showOn(myActivity);
// Default duration is DEFAULT_ANIMATION_DURATION_MS
new ConfirmationOverlay()
.setType(ConfirmationOverlay.FAILURE_ANIMATION)
.setMessage("Failed")
.setOnAnimationFinishedListener(new ConfirmationOverlay.OnAnimationFinishedListener() {
@Override
public void onAnimationFinished() {
// Finished animating and the view has been removed from myView.getRootView().
}
}).showAbove(myView);Summary
Nested types |
|---|
|
Interface for listeners to be notified when the |
@Retention(value = RetentionPolicy.SOURCE)Types of animations to display in the overlay. |
Constants |
|
|---|---|
const Int |
Default animation duration in ms. |
const Int |
|
const Int |
|
const Int |
|
Public constructors |
|---|
Public functions |
|
|---|---|
ConfirmationOverlay |
setDuration(millis: Int)Sets the duration in milliseconds which controls how long the animation will be displayed. |
ConfirmationOverlay |
This function is deprecated. Use |
ConfirmationOverlay |
setMessage(message: CharSequence)Sets a message which will be displayed at the same time as the animation. |
ConfirmationOverlay |
This function is deprecated. Use |
ConfirmationOverlay |
Sets the |
ConfirmationOverlay |
Sets the |
Unit |
@MainThreadAdds the overlay as a child of |
Unit |
@MainThreadAdds the overlay as a content view to the |
Constants
DEFAULT_ANIMATION_DURATION_MS
const val DEFAULT_ANIMATION_DURATION_MS = 1000: Int
Default animation duration in ms.
FAILURE_ANIMATION
const val FAILURE_ANIMATION = 1: Int
OverlayType indicating the failure overlay should be shown. The icon associated with this type, unlike the others, does not animate.
OPEN_ON_PHONE_ANIMATION
const val OPEN_ON_PHONE_ANIMATION = 2: Int
OverlayType indicating the "Open on Phone" animation overlay should be displayed.
SUCCESS_ANIMATION
const val SUCCESS_ANIMATION = 0: Int
OverlayType indicating the success animation overlay should be displayed.
Public constructors
Public functions
setDuration
fun setDuration(millis: Int): ConfirmationOverlay
Sets the duration in milliseconds which controls how long the animation will be displayed. Default duration is DEFAULT_ANIMATION_DURATION_MS.
| Returns | |
|---|---|
ConfirmationOverlay |
|
funsetFinishedAnimationListener(
listener: ConfirmationOverlay.OnAnimationFinishedListener?
): ConfirmationOverlay
Sets the OnAnimationFinishedListener which will be invoked once the overlay is no longer visible.
| Returns | |
|---|---|
ConfirmationOverlay |
|
setMessage
fun setMessage(message: CharSequence): ConfirmationOverlay
Sets a message which will be displayed at the same time as the animation.
| Returns | |
|---|---|
ConfirmationOverlay |
|
funsetMessage(message: String): ConfirmationOverlay
Sets a message which will be displayed at the same time as the animation.
| Returns | |
|---|---|
ConfirmationOverlay |
|
setOnAnimationFinishedListener
fun setOnAnimationFinishedListener(
listener: ConfirmationOverlay.OnAnimationFinishedListener?
): ConfirmationOverlay
Sets the OnAnimationFinishedListener which will be invoked once the overlay is no longer visible.
| Returns | |
|---|---|
ConfirmationOverlay |
|
setType
fun setType(@ConfirmationOverlay.OverlayType type: Int): ConfirmationOverlay
Sets the OverlayType which controls which animation is displayed.
| Returns | |
|---|---|
ConfirmationOverlay |
|
showAbove
@MainThread
fun showAbove(view: View): Unit
Adds the overlay as a child of view.getRootView(), removing it when complete. While it is shown, all touches will be intercepted to prevent accidental taps on obscured views.
showOn
@MainThread
fun showOn(activity: Activity): Unit
Adds the overlay as a content view to the activity, removing it when complete. While it is shown, all touches will be intercepted to prevent accidental taps on obscured views.