Builder
class Builder
kotlin.Any | |
↳ | androidx.mediarouter.media.MediaRouterParams.Builder |
Builder class for MediaRouterParams
.
Summary
Public constructors | |
---|---|
<init>() Constructor for builder to create |
|
<init>(@NonNull params: MediaRouterParams) Constructor for builder to create |
Public methods | |
---|---|
MediaRouterParams |
build() Builds the |
MediaRouterParams.Builder |
setDialogType(dialogType: Int) Sets the media route controller dialog type. |
MediaRouterParams.Builder |
setOutputSwitcherEnabled(enabled: Boolean) Sets whether output switcher dialogs are enabled. |
MediaRouterParams.Builder |
setTransferToLocalEnabled(enabled: Boolean) Enables media can be transferred from remote (e.g. TV) to local (e.g. phone, Bluetooth). |
Public constructors
<init>
Builder(@NonNull params: MediaRouterParams)
Constructor for builder to create MediaRouterParams
with existing MediaRouterParams
instance.
Parameters | |
---|---|
params |
MediaRouterParams: the existing instance to copy data from. |
Public methods
setDialogType
@NonNull fun setDialogType(dialogType: Int): MediaRouterParams.Builder
Sets the media route controller dialog type. Default value is DIALOG_TYPE_DEFAULT
.
Note that from Android R, output switcher will be used rather than the dialog type set by this method if both setOutputSwitcherEnabled(boolean)
output switcher} and media transfer feature
are enabled.
Parameters | |
---|---|
dialogType |
Int: the dialog type |
setOutputSwitcherEnabled
@NonNull fun setOutputSwitcherEnabled(enabled: Boolean): MediaRouterParams.Builder
Sets whether output switcher dialogs are enabled. This method will be no-op for Android versions earlier than Android R. Default value is false
.
If set to true
, and when media transfer is enabled
, MediaRouteButton
will show output switcher when clicked, no matter what type of dialog is set by setDialogType(int)
.
If set to false
, MediaRouteButton
will show the dialog type which is set by setDialogType(int)
.
setTransferToLocalEnabled
@NonNull fun setTransferToLocalEnabled(enabled: Boolean): MediaRouterParams.Builder
Enables media can be transferred from remote (e.g. TV) to local (e.g. phone, Bluetooth). Apps that enabling this feature should handle the case in their
properly. Default value is false
.
When this is enabled, MediaRouter.Callback#onRouteSelected(MediaRouter, * MediaRouter.RouteInfo, int, MediaRouter.RouteInfo)
will be called whenever the 'remote to local' transfer happens, regardless of the selector provided in MediaRouter#addCallback(MediaRouteSelector, MediaRouter.Callback)
.
Note: This method will be no-op for Android versions earlier than Android R. It has effect only when media transfer is enabled
.