ConfirmationOverlay
public
class
ConfirmationOverlay
extends Object
implements
View.OnTouchListener
java.lang.Object | |
↳ | android.support.wearable.view.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...")
.setFinishedAnimationListener(new ConfirmationOverlay.FinishedAnimationListener() {
@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")
.setFinishedAnimationListener(new ConfirmationOverlay.FinishedAnimationListener() {
@Override
public void onAnimationFinished() {
// Finished animating and the view has been removed from myView.getRootView().
}
}).showAbove(myView);
Summary
Nested classes | |
---|---|
interface |
ConfirmationOverlay.FinishedAnimationListener
Interface for listeners to be notified when the |
@interface |
ConfirmationOverlay.OverlayType
Types of animations to display in the overlay. |
Constants | |
---|---|
int |
DEFAULT_ANIMATION_DURATION_MS
|
int |
FAILURE_ANIMATION
|
int |
OPEN_ON_PHONE_ANIMATION
|
int |
SUCCESS_ANIMATION
|
Public constructors | |
---|---|
ConfirmationOverlay()
|
Public methods | |
---|---|
boolean
|
onTouch(View v, MotionEvent event)
|
ConfirmationOverlay
|
setDuration(int millis)
Sets the duration in milliseconds which controls how long the animation will be displayed. |
ConfirmationOverlay
|
setFinishedAnimationListener(ConfirmationOverlay.FinishedAnimationListener listener)
Sets the |
ConfirmationOverlay
|
setMessage(String message)
Sets a message which will be displayed at the same time as the animation. |
ConfirmationOverlay
|
setType(int type)
Sets the |
void
|
showAbove(View view)
Adds the overlay as a child of |
void
|
showOn(Activity activity)
Adds the overlay as a content view to the |
Inherited methods | |
---|---|
![]()
java.lang.Object
| |
![]()
android.view.View.OnTouchListener
|
Constants
DEFAULT_ANIMATION_DURATION_MS
int DEFAULT_ANIMATION_DURATION_MS
Constant Value: 1000 (0x000003e8)
FAILURE_ANIMATION
int FAILURE_ANIMATION
ConfirmationOverlay.OverlayType
indicating the failure overlay should be shown. The icon associated with
this type, unlike the others, does not animate.
Constant Value: 1 (0x00000001)
OPEN_ON_PHONE_ANIMATION
int OPEN_ON_PHONE_ANIMATION
ConfirmationOverlay.OverlayType
indicating the "Open on Phone" animation overlay should be displayed.
Constant Value: 2 (0x00000002)
SUCCESS_ANIMATION
int SUCCESS_ANIMATION
ConfirmationOverlay.OverlayType
indicating the success animation overlay should be displayed.
Constant Value: 0 (0x00000000)
Public constructors
ConfirmationOverlay
ConfirmationOverlay ()
Public methods
onTouch
boolean onTouch (View v, MotionEvent event)
Parameters | |
---|---|
v |
View |
event |
MotionEvent |
Returns | |
---|---|
boolean |
setDuration
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
.
Parameters | |
---|---|
millis |
int |
Returns | |
---|---|
ConfirmationOverlay |
this object for method chaining.
|
setFinishedAnimationListener
ConfirmationOverlay setFinishedAnimationListener (ConfirmationOverlay.FinishedAnimationListener listener)
Sets the ConfirmationOverlay.FinishedAnimationListener
which will be invoked once the overlay is no longer
visible.
Parameters | |
---|---|
listener |
ConfirmationOverlay.FinishedAnimationListener |
Returns | |
---|---|
ConfirmationOverlay |
this object for method chaining.
|
setMessage
ConfirmationOverlay setMessage (String message)
Sets a message which will be displayed at the same time as the animation.
Parameters | |
---|---|
message |
String |
Returns | |
---|---|
ConfirmationOverlay |
this object for method chaining.
|
setType
ConfirmationOverlay setType (int type)
Sets the ConfirmationOverlay.OverlayType
which controls which animation is displayed.
Parameters | |
---|---|
type |
int |
Returns | |
---|---|
ConfirmationOverlay |
this object for method chaining.
|
showAbove
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.
Parameters | |
---|---|
view |
View |
showOn
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.
Parameters | |
---|---|
activity |
Activity |
Annotations
Interfaces
- ActionChooserView.ActionChooserListener
- ConfirmationOverlay.FinishedAnimationListener
- DelayedConfirmationView.DelayedConfirmationListener
- GridPageOptions
- GridPageOptions.BackgroundListener
- GridViewPager.OnAdapterChangeListener
- GridViewPager.OnPageChangeListener
- WatchViewStub.OnLayoutInflatedListener
- WearableListView.ClickListener
- WearableListView.OnCenterProximityListener
- WearableListView.OnCentralPositionChangedListener
- WearableListView.OnScrollListener
Classes
- ActionChooserView
- ActionLabel
- ActionPage
- BoxInsetLayout
- BoxInsetLayout.LayoutParams
- CardFragment
- CardFrame
- CardScrollView
- CircledImageView
- CircularButton
- ConfirmationOverlay
- CrossfadeDrawable
- CurvedChildLayoutManager
- DefaultOffsettingHelper
- DelayedConfirmationView
- DismissOverlayView
- DotsPageIndicator
- FragmentGridPagerAdapter
- GridPagerAdapter
- GridViewPager
- GridViewPager.LayoutParams
- ProgressSpinner
- SimpleAnimatorListener
- SwipeDismissFrameLayout
- SwipeDismissFrameLayout.Callback
- WatchViewStub
- WearableFrameLayout
- WearableFrameLayout.LayoutParams
- WearableListView
- WearableListView.Adapter
- WearableListView.GenericAdapter
- WearableListView.ViewHolder
- WearableRecyclerView
- WearableRecyclerView.ChildLayoutManager
- WearableRecyclerView.OffsettingHelper
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-06-11 UTC.