android.support.wearable.view
Class WatchViewStub

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

public class WatchViewStub
extends FrameLayout

A WatchViewStub allows for the use of different sub-layouts depending on the shape of the device screen as reported by onApplyWindowInsets. If the call is not delivered by initial measurement the container will be assumed rectangular.


Nested Class Summary
static interface WatchViewStub.OnLayoutInflatedListener
          Listener for detecting when internal layout inflation has completed.
 
Constructor Summary
WatchViewStub(Context context)
           
WatchViewStub(Context context, AttributeSet attrs)
           
WatchViewStub(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
 void inflate()
          Inflate the appropriate child layout for the last known container.
 WindowInsets onApplyWindowInsets(WindowInsets insets)
           
protected  void onAttachedToWindow()
           
 void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           
 void setOnLayoutInflatedListener(WatchViewStub.OnLayoutInflatedListener listener)
          Set a listener to be notified when one of the specified sub-layouts is inflated into this stub container.
 void setRectLayout(int resId)
          Set a layout resource to be inflated when this stub is within a rectangular container.
 void setRoundLayout(int resId)
          Set a layout resource to be inflated when this stub is within a round container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WatchViewStub

public WatchViewStub(Context context)

WatchViewStub

public WatchViewStub(Context context,
                     AttributeSet attrs)

WatchViewStub

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

setOnLayoutInflatedListener

public void setOnLayoutInflatedListener(WatchViewStub.OnLayoutInflatedListener listener)
Set a listener to be notified when one of the specified sub-layouts is inflated into this stub container.

If your app needs to perform a series of findViewById lookups on the final inflated layout this callback is a great time to do so.

Parameters:
listener - Listener to notify

setRectLayout

public void setRectLayout(int resId)
Set a layout resource to be inflated when this stub is within a rectangular container.

Parameters:
resId - Resource id of a child layout to inflate

setRoundLayout

public void setRoundLayout(int resId)
Set a layout resource to be inflated when this stub is within a round container.

Parameters:
resId - Resource id of a child layout to inflate

onAttachedToWindow

protected void onAttachedToWindow()

onApplyWindowInsets

public WindowInsets onApplyWindowInsets(WindowInsets insets)

inflate

public void inflate()
Inflate the appropriate child layout for the last known container.


onMeasure

public void onMeasure(int widthMeasureSpec,
                      int heightMeasureSpec)