# ConfirmationOverlay

Summary:[Nested Classes](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay#nestedclasses)\|[Constants](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay#constants)\|[Ctors](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay#pubctors)\|[Methods](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay#inhmethods)  

# ConfirmationOverlay

`
public


class
ConfirmationOverlay
`  
`

extends `[Object](http://developer.android.com/reference/java/lang/Object.html)`


``


implements

`[View.OnTouchListener](http://developer.android.com/reference/android/view/View.OnTouchListener.html)`


`

|---|---------------------------------------------------|
| [java.lang.Object](http://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.wearable.view.ConfirmationOverlay |

<br />

*** ** * ** ***

<br />

**This class is deprecated.**   
use`androidx.wear.widget.ConfirmationOverlay`provided by the[Jetpack Wear](https://developer.android.com/jetpack/androidx/releases/wear)library instead.

Displays a full-screen confirmation animation with optional text and then hides it.

This is a lighter-weight version of[ConfirmationActivity](https://developer.android.com/reference/android/support/wearable/activity/ConfirmationActivity.html)and should be preferred when constructed from an[Activity](http://developer.android.com/reference/android/app/Activity.html).

Sample usage:  

       // Defaults to SUCCESS_ANIMATION
       new ConfirmationOverlay().showOn(myActivity);

       new ConfirmationOverlay()
          .setType(ConfirmationOverlay.OPEN_ON_PHONE_ANIMATION)
          .setDuration(3000)
          .setMessage("Opening...")
          .setFinishedAnimationListener(new ConfirmationOverlay.FinishedAnimationListener() {
              @Override
              public void onAnimationFinished() {
                  // Finished animating and the content view has been removed from myActivity.
              }
          }).showOn(myActivity);

       // Default duration is https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#DEFAULT_ANIMATION_DURATION_MS
       new ConfirmationOverlay()
          .setType(ConfirmationOverlay.FAILURE_ANIMATION)
          .setMessage("Failed")
          .setFinishedAnimationListener(new ConfirmationOverlay.FinishedAnimationListener() {
              @Override
              public void onAnimationFinished() {
                  // Finished animating and the view has been removed from myView.getRootView().
              }
          }).showAbove(myView);
     
<br />

## Summary

|                                                                                                                                                                                ### Nested classes                                                                                                                                                                                 ||
|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` interface`  | [ConfirmationOverlay.FinishedAnimationListener](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.FinishedAnimationListener.html) *This interface is deprecated. use`androidx.wear.widget.ConfirmationOverlay`provided by the[Jetpack Wear](https://developer.android.com/jetpack/androidx/releases/wear)library instead.* |
| ` @interface` | [ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html) *This @interface is deprecated. use`androidx.wear.widget.ConfirmationOverlay`provided by the[Jetpack Wear](https://developer.android.com/jetpack/androidx/releases/wear)library instead.*                            |

|                                                                                                                                                                                ### Constants                                                                                                                                                                                ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [DEFAULT_ANIMATION_DURATION_MS](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#DEFAULT_ANIMATION_DURATION_MS) <br />                                                                                                                                                                                                 |
| `int` | [FAILURE_ANIMATION](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#FAILURE_ANIMATION) [ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html)indicating the failure overlay should be shown.                                   |
| `int` | [OPEN_ON_PHONE_ANIMATION](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#OPEN_ON_PHONE_ANIMATION) [ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html)indicating the "Open on Phone" animation overlay should be displayed. |
| `int` | [SUCCESS_ANIMATION](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#SUCCESS_ANIMATION) [ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html)indicating the success animation overlay should be displayed.                     |

|                                                                ### Public constructors                                                                 ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#ConfirmationOverlay())`() ` |

|                                                                                                                                                                                                                                                                                                                                                                                              ### Public methods                                                                                                                                                                                                                                                                                                                                                                                              ||
|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`                                                                                                               | ` `[onTouch](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#onTouch(android.view.View,%20android.view.MotionEvent))`(`[View](http://developer.android.com/reference/android/view/View.html)` v, `[MotionEvent](http://developer.android.com/reference/android/view/MotionEvent.html)` event) `                                                                                                                                                                                                                                                                                                                                     |
| ` `[ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html) | ` `[setDuration](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#setDuration(int))`(int millis) ` Sets the duration in milliseconds which controls how long the animation will be displayed.                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` `[ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html) | ` `[setFinishedAnimationListener](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#setFinishedAnimationListener(android.support.wearable.view.ConfirmationOverlay.FinishedAnimationListener))`(`[ConfirmationOverlay.FinishedAnimationListener](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.FinishedAnimationListener.html)` listener) ` Sets the[ConfirmationOverlay.FinishedAnimationListener](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.FinishedAnimationListener.html)which will be invoked once the overlay is no longer visible. |
| ` `[ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html) | ` `[setMessage](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#setMessage(java.lang.String))`(`[String](http://developer.android.com/reference/java/lang/String.html)` message) ` Sets a message which will be displayed at the same time as the animation.                                                                                                                                                                                                                                                                                                                                                                        |
| ` `[ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html) | ` `[setType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#setType(int))`(int type) ` Sets the[ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html)which controls which animation is displayed.                                                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                                                  | ` `[showAbove](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#showAbove(android.view.View))`(`[View](http://developer.android.com/reference/android/view/View.html)` view) ` Adds the overlay as a child of`view.getRootView()`, removing it when complete.                                                                                                                                                                                                                                                                                                                                                                        |
| ` void`                                                                                                                  | ` `[showOn](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#showOn(android.app.Activity))`(`[Activity](http://developer.android.com/reference/android/app/Activity.html)` activity) ` Adds the overlay as a content view to the`activity`, removing it when complete.                                                                                                                                                                                                                                                                                                                                                               |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](http://developer.android.com/reference/java/lang/Object.html)` ` |------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| | ` `[Object](http://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                               | | ` boolean`                                                                         | ` equals(`[Object](http://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                            | ` finalize() `                                                                            | | ` final `[Class](http://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                            | | ` int`                                                                             | ` hashCode() `                                                                            | | ` final void`                                                                      | ` notify() `                                                                              | | ` final void`                                                                      | ` notifyAll() `                                                                           | | ` `[String](http://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                            | | ` final void`                                                                      | ` wait(long arg0, int arg1) `                                                             | | ` final void`                                                                      | ` wait(long arg0) `                                                                       | | ` final void`                                                                      | ` wait() `                                                                                | ||
| From interface` `[android.view.View.OnTouchListener](http://developer.android.com/reference/android/view/View.OnTouchListener.html)` ` |---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` onTouch(`[View](http://developer.android.com/reference/android/view/View.html)` arg0, `[MotionEvent](http://developer.android.com/reference/android/view/MotionEvent.html)` arg1) ` | ||

## Constants

### DEFAULT_ANIMATION_DURATION_MS

```
public static final int DEFAULT_ANIMATION_DURATION_MS
```

<br />

<br />

Constant Value: 1000 (0x000003e8)  

### FAILURE_ANIMATION

```
public static final int FAILURE_ANIMATION
```

[ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html)indicating the failure overlay should be shown. The icon associated with this type, unlike the others, does not animate.

<br />

Constant Value: 1 (0x00000001)  

### OPEN_ON_PHONE_ANIMATION

```
public static final int OPEN_ON_PHONE_ANIMATION
```

[ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html)indicating the "Open on Phone" animation overlay should be displayed.

<br />

Constant Value: 2 (0x00000002)  

### SUCCESS_ANIMATION

```
public static final int SUCCESS_ANIMATION
```

[ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html)indicating the success animation overlay should be displayed.

<br />

Constant Value: 0 (0x00000000)

## Public constructors

### ConfirmationOverlay

```
public ConfirmationOverlay ()
```

<br />

<br />

## Public methods

### onTouch

```
public boolean onTouch (View v, 
                MotionEvent event)
```

<br />

<br />

|          Parameters           ||
|---------|----------------------|
| `v`     | `View` <br />        |
| `event` | `MotionEvent` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### setDuration

```
public ConfirmationOverlay setDuration (int millis)
```

Sets the duration in milliseconds which controls how long the animation will be displayed. Default duration is[DEFAULT_ANIMATION_DURATION_MS](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html#DEFAULT_ANIMATION_DURATION_MS).

<br />

|       Parameters       ||
|----------|--------------|
| `millis` | `int` <br /> |

|                                                                             Returns                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html) | `this`object for method chaining. <br /> |

### setFinishedAnimationListener

```
public ConfirmationOverlay setFinishedAnimationListener (ConfirmationOverlay.FinishedAnimationListener listener)
```

Sets the[ConfirmationOverlay.FinishedAnimationListener](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.FinishedAnimationListener.html)which will be invoked once the overlay is no longer visible.

<br />

|                             Parameters                             ||
|------------|--------------------------------------------------------|
| `listener` | `ConfirmationOverlay.FinishedAnimationListener` <br /> |

|                                                                             Returns                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html) | `this`object for method chaining. <br /> |

### setMessage

```
public ConfirmationOverlay setMessage (String message)
```

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

<br />

|         Parameters         ||
|-----------|-----------------|
| `message` | `String` <br /> |

|                                                                             Returns                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html) | `this`object for method chaining. <br /> |

### setType

```
public ConfirmationOverlay setType (int type)
```

Sets the[ConfirmationOverlay.OverlayType](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.OverlayType.html)which controls which animation is displayed.

<br />

|      Parameters      ||
|--------|--------------|
| `type` | `int` <br /> |

|                                                                             Returns                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------|------------------------------------------|
| [ConfirmationOverlay](https://developer.android.com/reference/android/support/wearable/view/ConfirmationOverlay.html) | `this`object for method chaining. <br /> |

### showAbove

```
public void showAbove (View view)
```

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.

<br />

|      Parameters       ||
|--------|---------------|
| `view` | `View` <br /> |

### showOn

```
public void showOn (Activity activity)
```

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.

<br />

|          Parameters           ||
|------------|-------------------|
| `activity` | `Activity` <br /> |