Package com.tomtom.ivi.appsuite.media.api.common.frontend.controls

Media controls; the classes in this package implement the concept of #media-controls.

Types

Link copied to clipboard
@IviExperimental(reasons = [])
typealias ActionLaunchCall = (Action) -> Boolean

Type alias for the callback to invoke when a MediaControl's Action is launched.

Link copied to clipboard
@IviExperimental(reasons = [])
abstract class ActionMediaControl(context: MediaControlContext) : MediaControl

A MediaControl which can be performed on active media.

Link copied to clipboard
@IviExperimental(reasons = [])
class CompositeMediaControl(controls: List<MediaControl>) : ToggleMediaControl

Continuously picks the first visible media control from the given controls list, and delegates all calls to it. If there is no visible control, it will delegate to the last control in the list.

Link copied to clipboard
@IviExperimental(reasons = [])
object InvisibleControlFactory : MediaControlFactory

Factory that creates an invisible MediaControl.

Link copied to clipboard
@IviExperimental(reasons = [])
typealias LiveSourceId = LiveData<SourceId?>

Type alias for a LiveData with the current media source, if one is playing.

Link copied to clipboard
@IviExperimental(reasons = [])
interface MediaControl

A visual control for a media-related command. It can be used anywhere the user can interact with active media.

Link copied to clipboard
@IviExperimental(reasons = [])
class MediaControlContext(    val source: LiveSourceId,     val playbackState: LiveData<IviPlaybackState>,     val activeMediaItem: LiveData<IviMediaItem?>,     val actions: LiveDataActionList,     val actionLauncher: ActionLaunchCall,     val coroutineScope: CoroutineScope)

Provides access to contextual information for MediaControls. Actual use of the information provided by MediaControlContext is not mandatory.

Link copied to clipboard
@IviExperimental(reasons = [])
interface MediaControlFactory

Creates MediaControls within the given MediaControlContext.

Link copied to clipboard
@IviExperimental(reasons = [])
enum MediaControlPriority : Enum<MediaControlPriority>

Priority of a MediaControl. When room for controls is limited, their priority is used to determine which controls are displayed.

Link copied to clipboard
@IviExperimental(reasons = [])
abstract class MultipleActionMediaControl(context: MediaControlContext) : ActionMediaControl

An ActionMediaControl that cycles between multiple states.

Link copied to clipboard
@IviExperimental(reasons = [])
abstract class SingleActionMediaControl(context: MediaControlContext) : ActionMediaControl

An ActionMediaControl always resulting in one single Action which can be performed on active media.

Link copied to clipboard
@IviExperimental(reasons = [])
abstract class ToggleActionMediaControl(context: MediaControlContext) : ActionMediaControl, ToggleMediaControl

An ActionMediaControl with two states: activated and deactivated.

Link copied to clipboard
@IviExperimental(reasons = [])
interface ToggleMediaControl : MediaControl

A MediaControl with two states: activated and deactivated. These will be automatically represented to the end-user by highlighting the given drawable when isActivated is true.

Functions

Link copied to clipboard
@IviExperimental(reasons = [])
fun MediaServiceApi.asMediaControlContext(viewModelScope: CoroutineScope): MediaControlContext

Use a MediaServiceApi to obtain a MediaControlContext to use on MediaControls. The given viewModelScope should be attached to a LifecycleViewModel: it is necessary for MediaControls to perform asynchronous operations.