android.support.wearable.view
Class DismissOverlayView

java.lang.Object
  extended by FrameLayout
      extended by android.support.wearable.view.DismissOverlayView

public class DismissOverlayView
extends FrameLayout

A view for implementing long-press-to-dismiss in an app.

DismissOverlayView should be added to your layout such that it draws full-screen and over all other views. To use it, set the intro text using setIntroText(CharSequence) and call showIntroIfNecessary() in your activity's onCreate (or your fragment's onCreateView). Then, use a GestureDetector in your activity to detect long press gestures; when one is found, call show() on your DismissOverlayView. DismissOverlayView takes care of all of the hiding, showing, and dismissal logic for you; setting its visibility or alpha may lead to unintended behavior.


Constructor Summary
DismissOverlayView(Context context)
           
DismissOverlayView(Context context, AttributeSet attrs)
           
DismissOverlayView(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 boolean performClick()
           
 void setIntroText(java.lang.CharSequence str)
          Set the intro text.
 void setIntroText(int textResId)
          Set the intro text.
 void show()
          Show the exit button.
 void showIntroIfNecessary()
          Displays the intro overlay over your app if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DismissOverlayView

public DismissOverlayView(Context context)

DismissOverlayView

public DismissOverlayView(Context context,
                          AttributeSet attrs)

DismissOverlayView

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

setIntroText

public void setIntroText(java.lang.CharSequence str)
Set the intro text. The intro text is the text displayed when the app is run for the first time, as an overlay on the rest of your app's content.


setIntroText

public void setIntroText(int textResId)
Set the intro text. The intro text is the text displayed when the app is run for the first time, as an overlay on the rest of your app's content.


showIntroIfNecessary

public void showIntroIfNecessary()
Displays the intro overlay over your app if necessary. This does nothing if no intro text has been set, or if this is not the first time showIntroIfNecessary is called for your app.


show

public void show()
Show the exit button. This should be called from a long-press listener.


performClick

public boolean performClick()