DelayedConfirmationView

public class DelayedConfirmationView
extends CircledImageView

java.lang.Object
   ↳ android.view.View
     ↳ android.support.wearable.view.CircledImageView
       ↳ android.support.wearable.view.DelayedConfirmationView


DelayedConfirmationView provides a circular countdown timer, typically used to automatically confirm an operation after a short delay has elapsed. The delay is intended to give the user a chance to cancel the operation by tapping the View.

The developer can specify a countdown interval via setTotalTimeMs(long) and a listener via setListener(DelayedConfirmationView.DelayedConfirmationListener) to be called when the View is tapped or the time has elapsed.

More information on what are required XML attributes can be found at CircledImageView.

Summary

Nested classes

interface DelayedConfirmationView.DelayedConfirmationListener

Implement this interface to receive callbacks when the timer is finished and when the user taps the View to select it. 

Inherited constants

From class android.view.View

Inherited fields

From class android.view.View

Public constructors

DelayedConfirmationView(Context context)
DelayedConfirmationView(Context context, AttributeSet attrs)
DelayedConfirmationView(Context context, AttributeSet attrs, int defStyle)

Public methods

boolean onTouchEvent(MotionEvent event)
void reset()

Resets the timer.

void setListener(DelayedConfirmationView.DelayedConfirmationListener listener)

Sets a listener to get callbacks for when the timer finishes or cancelled.

void setStartTimeMs(long time)

Artificially sets the start time in milliseconds for the Timer to countdown from.

void setTotalTimeMs(long time)

Sets the total time in milliseconds for the Timer to countdown to.

void start()

Starts the timer countdown.

Protected methods

void onDraw(Canvas canvas)

Inherited methods

From class android.support.wearable.view.CircledImageView
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public constructors

DelayedConfirmationView

DelayedConfirmationView (Context context)

Parameters
context Context

DelayedConfirmationView

DelayedConfirmationView (Context context,
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

DelayedConfirmationView

DelayedConfirmationView (Context context,
                AttributeSet attrs,
                int defStyle)

Parameters
context Context
attrs AttributeSet
defStyle int

Public methods

onTouchEvent

boolean onTouchEvent (MotionEvent event)

Parameters
event MotionEvent
Returns
boolean

reset

void reset ()

Resets the timer.

setListener

void setListener (DelayedConfirmationView.DelayedConfirmationListener listener)

Sets a listener to get callbacks for when the timer finishes or cancelled.

Parameters
listener DelayedConfirmationView.DelayedConfirmationListener: listener to register.

See also:

setStartTimeMs

void setStartTimeMs (long time)

Artificially sets the start time in milliseconds for the Timer to countdown from. This should be called after the timer is started with start().

Parameters
time long: start time in milliseconds.

setTotalTimeMs

void setTotalTimeMs (long time)

Sets the total time in milliseconds for the Timer to countdown to. Once the countdown is finished, if there is a listener registered, calls the listener.

Parameters
time long: countdown time in milliseconds.

See also:

start

void start ()

Starts the timer countdown.

Protected methods

onDraw

void onDraw (Canvas canvas)

Parameters
canvas Canvas