features/characters_list / com.vmadalin.dynamicfeatures.characterslist.ui.list / CharactersListViewModel

CharactersListViewModel

class CharactersListViewModel : ViewModel

View model responsible for preparing and managing the data for CharactersListFragment.

See Also

ViewModel

Constructors

<init>

View model responsible for preparing and managing the data for CharactersListFragment.

CharactersListViewModel(dataSourceFactory: CharactersPageDataSourceFactory)

Properties

data

val data: LiveData<PagedList<CharacterItem!>!>

dataSourceFactory

val dataSourceFactory: CharactersPageDataSourceFactory

event

val event: SingleLiveData<CharactersListViewEvent>

networkState

val networkState: LiveData<NetworkState!>

state

val state: LiveData<CharactersListViewState!>

Functions

openCharacterDetail

Send interaction event for open character detail view from selected character.

fun openCharacterDetail(characterId: Long): Unit

refreshLoadedCharactersList

Refresh characters fetch them again and update the list.

fun refreshLoadedCharactersList(): Unit

retryAddCharactersList

Retry last fetch operation to add characters into list.

fun retryAddCharactersList(): Unit