android.support.wearable.view
Class DelayedConfirmationView

java.lang.Object
  extended by FrameLayout
      extended by android.support.wearable.view.CircledImageView
          extended by android.support.wearable.view.DelayedConfirmationView

public class DelayedConfirmationView
extends CircledImageView

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(android.support.wearable.view.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.


Nested Class Summary
static interface DelayedConfirmationView.DelayedConfirmationListener
          Implement this interface to receive callbacks when the timer is finished and when the user taps the View to select it.
 
Field Summary
 
Fields inherited from class android.support.wearable.view.CircledImageView
mProgress
 
Constructor Summary
DelayedConfirmationView(Context context)
           
DelayedConfirmationView(Context context, AttributeSet attrs)
           
DelayedConfirmationView(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
protected  void onDraw(Canvas canvas)
           
 boolean onTouchEvent(MotionEvent event)
           
 void setListener(DelayedConfirmationView.DelayedConfirmationListener handler)
          Sets a listener to get callbacks for when the timer finishes or cancelled.
 void setTotalTimeMs(long time)
          Sets the total time in milliseconds for the Timer to countdown to.
 void start()
          Starts the timer countdown.
 
Methods inherited from class android.support.wearable.view.CircledImageView
drawableStateChanged, getCircleRadius, getInitialCircleRadius, onMeasure, setCircleBorderColor, setCircleColor, setCircleColorStateList, setCircleHidden, setCircleRadius, setCircleRadiusPressed, setImageDrawable, setImageResource, setPressed, setProgress, setShadowVisibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelayedConfirmationView

public DelayedConfirmationView(Context context)

DelayedConfirmationView

public DelayedConfirmationView(Context context,
                               AttributeSet attrs)

DelayedConfirmationView

public DelayedConfirmationView(Context context,
                               AttributeSet attrs,
                               int defStyle)
Method Detail

setTotalTimeMs

public 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. DelayedConfirmationViewListener

Parameters:
time - countdown time in milliseconds.

setListener

public void setListener(DelayedConfirmationView.DelayedConfirmationListener handler)
Sets a listener to get callbacks for when the timer finishes or cancelled. DelayedConfirmationViewListener

Parameters:
listener - listener to register.

start

public void start()
Starts the timer countdown.


onDraw

protected void onDraw(Canvas canvas)
Overrides:
onDraw in class CircledImageView

onTouchEvent

public boolean onTouchEvent(MotionEvent event)