ConfirmationOverlay

Added in 1.1.0

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 ConfirmationOverlay animation has finished and its View has been removed.

@Retention(value = RetentionPolicy.SOURCE)
@IntDef(value = )
annotation ConfirmationOverlay.OverlayType

Types of animations to display in the overlay.

Constants

const Int

Default animation duration in ms.

const Int

OverlayType indicating the failure overlay should be shown.

const Int

OverlayType indicating the "Open on Phone" animation overlay should be displayed.

const Int

OverlayType indicating the success animation overlay should be displayed.

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 setOnAnimationFinishedListener instead.

ConfirmationOverlay

Sets a message which will be displayed at the same time as the animation.

ConfirmationOverlay
setMessage(message: String)

This function is deprecated.

Use setMessage instead.

ConfirmationOverlay

Sets the OnAnimationFinishedListener which will be invoked once the overlay is no longer visible.

ConfirmationOverlay

Sets the OverlayType which controls which animation is displayed.

Unit

Adds the overlay as a child of view.getRootView(), removing it when complete.

Unit

Adds the overlay as a content view to the activity, removing it when complete.

Constants

DEFAULT_ANIMATION_DURATION_MS

Added in 1.1.0
const val DEFAULT_ANIMATION_DURATION_MS = 1000: Int

Default animation duration in ms.

FAILURE_ANIMATION

Added in 1.1.0
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

Added in 1.1.0
const val OPEN_ON_PHONE_ANIMATION = 2: Int

OverlayType indicating the "Open on Phone" animation overlay should be displayed.

SUCCESS_ANIMATION

Added in 1.1.0
const val SUCCESS_ANIMATION = 0: Int

OverlayType indicating the success animation overlay should be displayed.

Public constructors

ConfirmationOverlay

Added in 1.1.0
ConfirmationOverlay()

Public functions

setDuration

Added in 1.1.0
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

this object for method chaining.

setFinishedAnimationListener

Added in 1.1.0
Deprecated in 1.1.0
fun setFinishedAnimationListener(
    listener: ConfirmationOverlay.OnAnimationFinishedListener?
): ConfirmationOverlay

Sets the OnAnimationFinishedListener which will be invoked once the overlay is no longer visible.

Returns
ConfirmationOverlay

this object for method chaining.

setMessage

Added in 1.1.0
fun setMessage(message: CharSequence): ConfirmationOverlay

Sets a message which will be displayed at the same time as the animation.

Returns
ConfirmationOverlay

this object for method chaining.

setMessage

Added in 1.1.0
Deprecated in 1.1.0
fun setMessage(message: String): ConfirmationOverlay

Sets a message which will be displayed at the same time as the animation.

Returns
ConfirmationOverlay

this object for method chaining.

setOnAnimationFinishedListener

Added in 1.1.0
fun setOnAnimationFinishedListener(
    listener: ConfirmationOverlay.OnAnimationFinishedListener?
): ConfirmationOverlay

Sets the OnAnimationFinishedListener which will be invoked once the overlay is no longer visible.

Returns
ConfirmationOverlay

this object for method chaining.

setType

Added in 1.1.0
fun setType(@ConfirmationOverlay.OverlayType type: Int): ConfirmationOverlay

Sets the OverlayType which controls which animation is displayed.

Returns
ConfirmationOverlay

this object for method chaining.

showAbove

Added in 1.1.0
@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

Added in 1.1.0
@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.