MediaRouteControllerDialog


public class MediaRouteControllerDialog extends AlertDialog


This class implements the route controller dialog for MediaRouter.

This dialog allows the user to control or disconnect from the currently selected route.

Summary

Public constructors

Public methods

@Nullable View

Gets the media control view that was created by onCreateMediaControlView.

@Nullable MediaSessionCompat.Token

Gets the session to use for metadata and transport controls.

@NonNull MediaRouter.RouteInfo

Gets the route that this dialog is controlling.

boolean

Returns whether to enable the volume slider and volume control using the volume keys when the route supports it.

void
@Nullable View

Provides the subclass an opportunity to create a view that will replace the default media controls for the currently playing content.

void
boolean
onKeyDown(int keyCode, @NonNull KeyEvent event)
boolean
onKeyUp(int keyCode, @NonNull KeyEvent event)
void
setVolumeControlEnabled(boolean enable)

Sets whether to enable the volume slider and volume control using the volume keys when the route supports it.

Protected methods

void
onCreate(@Nullable Bundle savedInstanceState)

Inherited Constants

From android.content.DialogInterface
static final int
BUTTON1 = -1

This field is deprecated.

static final int
BUTTON2 = -2

This field is deprecated.

static final int
BUTTON3 = -3

This field is deprecated.

static final int
static final int
static final int

Inherited fields

From androidx.activity.ComponentDialog
final OnBackPressedDispatcher

The OnBackPressedDispatcher that should handle the system back button.

Inherited methods

From androidx.appcompat.app.AlertDialog
Button
getButton(int whichButton)

Gets one of the buttons used in the dialog.

ListView

Gets the list view used in the dialog.

void
setButton(
    int whichButton,
    CharSequence text,
    DialogInterface.OnClickListener listener
)

Sets a listener to be invoked when the positive button of the dialog is pressed.

void
setButton(int whichButton, CharSequence text, Message msg)

Sets a message to be sent when a button is pressed.

void
setButton(
    int whichButton,
    CharSequence text,
    Drawable icon,
    DialogInterface.OnClickListener listener
)

Sets an icon to be displayed along with the button text and a listener to be invoked when the positive button of the dialog is pressed.

void
setCustomTitle(View customTitleView)

This method has no effect if called after show.

void

Set the Drawable to be used in the title.

void
setIcon(int resId)

Set resId to 0 if you don't want an icon.

void
setIconAttribute(int attrId)

Sets an icon as supplied by a theme attribute. e.g. android.R.attr.alertDialogIcon

void

Sets the message to display.

void
void
setView(View view)

Set the view to display in the dialog.

void
setView(
    View view,
    int viewSpacingLeft,
    int viewSpacingTop,
    int viewSpacingRight,
    int viewSpacingBottom
)

Set the view to display in the dialog, specifying the spacing to appear around that view.

From androidx.appcompat.app.AppCompatDialog
void
void
boolean
@Nullable T
<T extends View> findViewById(@IdRes int id)
@NonNull AppCompatDelegate
ActionBar

Support library version of getActionBar.

void
void

Called when a support action mode has finished.

void

Called when a support action mode has been started.

@Nullable ActionMode

Called when a support action mode is being started for this window.

void
setContentView(@LayoutRes int layoutResID)
void
void
void
setTitle(int titleId)
boolean

Enable extended support library window features.

From androidx.activity.ComponentDialog
void
Lifecycle
final OnBackPressedDispatcher

The OnBackPressedDispatcher that should handle the system back button.

SavedStateRegistry
void

Sets the view tree owners before setting the content view so that the inflation process and attach listeners will see them already present.

void

This method is deprecated.

void
onCreate(Bundle savedInstanceState)
Bundle
void
void
void
setContentView(int layoutResID)
From android.app.Dialog
void
void
void
boolean
boolean
boolean
boolean
boolean
boolean
T
<T extends View> findViewById(int id)
ActionBar
final Context
View
LayoutInflater
OnBackInvokedDispatcher
final Activity
final SearchEvent
final int
Window
void
void
boolean
void
void
void

This method is deprecated.

void
boolean
void
void
onCreate(Bundle savedInstanceState)
void
onCreateContextMenu(
    ContextMenu menu,
    View v,
    ContextMenu.ContextMenuInfo menuInfo
)
boolean
boolean
onCreatePanelMenu(int featureId, Menu menu)
View
onCreatePanelView(int featureId)
boolean
boolean
onKeyDown(int keyCode, KeyEvent event)
boolean
onKeyLongPress(int keyCode, KeyEvent event)
boolean
onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
boolean
onKeyShortcut(int keyCode, KeyEvent event)
boolean
onKeyUp(int keyCode, KeyEvent event)
boolean
onMenuItemSelected(int featureId, MenuItem item)
boolean
onMenuOpened(int featureId, Menu menu)
boolean
void
void
onPanelClosed(int featureId, Menu menu)
boolean
boolean
onPreparePanel(int featureId, View view, Menu menu)
void
onRestoreInstanceState(Bundle savedInstanceState)
Bundle
boolean
void
void
boolean
boolean
void
void
onWindowFocusChanged(boolean hasFocus)
ActionMode
void
void
void
final boolean
requestWindowFeature(int featureId)
final T
<T extends View> requireViewById(int id)
void
void
setCancelable(boolean flag)
void
setCanceledOnTouchOutside(boolean cancel)
void
setContentView(int layoutResID)
void
final void
setFeatureDrawable(int featureId, Drawable drawable)
final void
setFeatureDrawableAlpha(int featureId, int alpha)
final void
setFeatureDrawableResource(int featureId, int resId)
final void
setFeatureDrawableUri(int featureId, Uri uri)
void
void
void
void
final void
void
final void
setVolumeControlStream(int streamType)
void
void
takeKeyEvents(boolean get)
void
From android.content.DialogInterface
abstract void
abstract void
From androidx.lifecycle.LifecycleOwner
abstract Lifecycle
From androidx.savedstate.SavedStateRegistryOwner
From android.view.Window.Callback
void
onPointerCaptureChanged(boolean hasCapture)
void
onProvideKeyboardShortcuts(
    List<KeyboardShortcutGroup> data,
    Menu menu,
    int deviceId
)

Public constructors

MediaRouteControllerDialog

Added in 1.1.0
public MediaRouteControllerDialog(@NonNull Context context)

MediaRouteControllerDialog

Added in 1.1.0
public MediaRouteControllerDialog(@NonNull Context context, int theme)

Public methods

getMediaControlView

Added in 1.1.0
public @Nullable View getMediaControlView()

Gets the media control view that was created by onCreateMediaControlView.

Returns
@Nullable View

The media control view, or null if none.

getMediaSession

Added in 1.1.0
public @Nullable MediaSessionCompat.Token getMediaSession()

Gets the session to use for metadata and transport controls.

Returns
@Nullable MediaSessionCompat.Token

The token for the session to use or null if none.

getRoute

Added in 1.1.0
public @NonNull MediaRouter.RouteInfo getRoute()

Gets the route that this dialog is controlling.

isVolumeControlEnabled

Added in 1.1.0
public boolean isVolumeControlEnabled()

Returns whether to enable the volume slider and volume control using the volume keys when the route supports it.

onAttachedToWindow

public void onAttachedToWindow()

onCreateMediaControlView

Added in 1.1.0
public @Nullable View onCreateMediaControlView(@Nullable Bundle savedInstanceState)

Provides the subclass an opportunity to create a view that will replace the default media controls for the currently playing content.

Parameters
@Nullable Bundle savedInstanceState

The dialog's saved instance state.

Returns
@Nullable View

The media control view, or null if none.

onDetachedFromWindow

public void onDetachedFromWindow()

onKeyDown

public boolean onKeyDown(int keyCode, @NonNull KeyEvent event)

onKeyUp

public boolean onKeyUp(int keyCode, @NonNull KeyEvent event)

setVolumeControlEnabled

Added in 1.1.0
public void setVolumeControlEnabled(boolean enable)

Sets whether to enable the volume slider and volume control using the volume keys when the route supports it.

The default value is true.

Protected methods

onCreate

protected void onCreate(@Nullable Bundle savedInstanceState)