to top
Android APIs
public class

MediaRouteButton

extends View
java.lang.Object
   ↳ android.view.View
     ↳ android.app.MediaRouteButton

Summary

[Expand]
Inherited XML Attributes
From class android.view.View
[Expand]
Inherited Constants
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
MediaRouteButton(Context context)
MediaRouteButton(Context context, AttributeSet attrs)
MediaRouteButton(Context context, AttributeSet attrs, int defStyleAttr)
Public Methods
int getRouteTypes()
void jumpDrawablesToCurrentState()
Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.
void onAttachedToWindow()
This is called when the view is attached to a window.
void onDetachedFromWindow()
This is called when the view is detached from a window.
boolean performClick()
Call this view's OnClickListener, if it is defined.
void setExtendedSettingsClickListener(View.OnClickListener listener)
void setRouteTypes(int types)
void setVisibility(int visibility)
Set the enabled state of this view.
void showDialog()
Asynchronously show the route chooser dialog.
Protected Methods
void drawableStateChanged()
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
int[] onCreateDrawableState(int extraSpace)
Generate the new Drawable state for this view.
void onDraw(Canvas canvas)
Implement this to do your drawing.
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Measure the view and its content to determine the measured width and the measured height.

boolean verifyDrawable(Drawable who)
If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.
[Expand]
Inherited Methods
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

public MediaRouteButton (Context context)

Since: API Level 16

public MediaRouteButton (Context context, AttributeSet attrs)

Since: API Level 16

public MediaRouteButton (Context context, AttributeSet attrs, int defStyleAttr)

Since: API Level 16

Public Methods

public int getRouteTypes ()

Since: API Level 16

public void jumpDrawablesToCurrentState ()

Since: API Level 16

Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.

public void onAttachedToWindow ()

Since: API Level 16

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

public void onDetachedFromWindow ()

Since: API Level 16

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

public boolean performClick ()

Since: API Level 16

Call this view's OnClickListener, if it is defined. Performs all normal actions associated with clicking: reporting accessibility event, playing a sound, etc.

Returns
  • True there was an assigned OnClickListener that was called, false otherwise is returned.

public void setExtendedSettingsClickListener (View.OnClickListener listener)

Since: API Level 16

public void setRouteTypes (int types)

Since: API Level 16

public void setVisibility (int visibility)

Since: API Level 16

Set the enabled state of this view.

Parameters
visibility One of VISIBLE, INVISIBLE, or GONE.

public void showDialog ()

Since: API Level 16

Asynchronously show the route chooser dialog. This will attach a DialogFragment to the containing Activity.

Protected Methods

protected void drawableStateChanged ()

Since: API Level 16

This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.

Be sure to call through to the superclass when overriding this function.

protected int[] onCreateDrawableState (int extraSpace)

Since: API Level 16

Generate the new Drawable state for this view. This is called by the view system when the cached Drawable state is determined to be invalid. To retrieve the current state, you should use getDrawableState().

Parameters
extraSpace if non-zero, this is the number of extra entries you would like in the returned array in which you can place your own states.
Returns
  • Returns an array holding the current Drawable state of the view.

protected void onDraw (Canvas canvas)

Since: API Level 16

Implement this to do your drawing.

Parameters
canvas the canvas on which the background will be drawn

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

Since: API Level 16

Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents.

CONTRACT: When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by measure(int, int). Calling the superclass' onMeasure(int, int) is a valid use.

The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override onMeasure(int, int) to provide better measurements of their content.

If this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (getSuggestedMinimumHeight() and getSuggestedMinimumWidth()).

Parameters
widthMeasureSpec horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
heightMeasureSpec vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.

protected boolean verifyDrawable (Drawable who)

Since: API Level 16

If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. This allows animations for those drawables to be scheduled.

Be sure to call through to the super class when overriding this function.

Parameters
who The Drawable to verify. Return true if it is one you are displaying, else return the result of calling through to the super class.
Returns
  • boolean If true than the Drawable is being displayed in the view; else false and it is not allowed to animate.