MediaContentViewModel

constructor(mediaItems: LiveData<List<IviMediaItem>>, mediaService: MediaServiceApi, @WorkerThread mediaItemMatcher: MediaItemMatcher, onItemClickAction: ClickAction, isLoading: LiveData<Boolean> = ImmutableLiveData(false), layoutPolicy: LiveData<LayoutPolicy> = ImmutableLiveData(LinearLayoutPolicy()), groupByHeaders: LiveData<Boolean> = ImmutableLiveData(true), dispatcher: CoroutineDispatcher = Dispatchers.Default)

Parameters

mediaItems

A list of incoming IviMediaItem, which is transformed into items.

mediaService

A media service that is used to get MediaServiceState: information about the currently active item, source, and playback state.

mediaItemMatcher

Used to match an item to the currently active item. This is needed to determine the item's IviPlaybackState.

onItemClickAction

An action that should be called when clicking an item from items list.

isLoading

If true, an empty list if items is returned. This is used to reduce visual glitches during content loading.

layoutPolicy

Used to determine ListGroupItem.ItemType for items.

groupByHeaders

If true, the items would be grouped by ItemType.HEADER based on the IviMediaItem.groupTitleHint.

dispatcher

A dispatcher which is used during items mapping. Could be substituted for testing purposes.