Package com.tomtom.ivi.platform.framework.api.ipc.iviservice.datasource

API of TomTom IndiGO's IPC framework specific to sharing data sources.

Types

Link copied to clipboard
interface IviDataSource<E : Any, Q : Any>

Interface of all IVI data source implementations.

Link copied to clipboard
interface IviPagingSource<E : Any>

Interface for an abstraction of pageable static data from some source, where loading pages of data is typically an expensive operation. Some examples of common PagingSources might be from network or from a database.

Link copied to clipboard
abstract class IviPagingSourceBase<E : Any> constructor : IviPagingSource<E>

Generic base class for all IviPagingSource implementations.

Link copied to clipboard
abstract class MutableIviDataSource<E : Any, Q : Any>(val jumpingSupported: Boolean) : IviDataSource<E, Q>

Base class for IviDataSource implementations that contains the code to load data from a data source.

Link copied to clipboard
abstract class MutableIviPagingSource<E : Any> : IviPagingSourceBase<E>

Base class for IviPagingSource implementations that contains the the code to load data from a data source.

Link copied to clipboard
interface PageProvider<E : Any>

Interface to load an IviPagingSource.LoadResult.Page from an IviPagingSource.

Functions

Link copied to clipboard
fun <P : IviPagingSource<E>, E : Any> Flow<P>.first(): Flow<E>

Transforms this IviPagingSource to a E with only the first element from the IviPagingSource.

fun <P : IviPagingSource<E>, E : Any> LiveData<P>.first(timeout: Duration = Duration.ZERO): LiveData<E>

Transforms this IviPagingSource to a E with only the first element from the IviPagingSource. If the returned LiveData becomes inactive while values are still being emited, the underlying coroutine will be cancelled after the timeout, unless the LiveData becomes active again before that timeout. By default timeout is Duration.ZERO, which means that once the returned LiveData becomes inactive it is not usable anymore.

Link copied to clipboard
fun <D : IviDataSource<E, Q>, E : Any, Q : Any> Flow<D>.mapQuery(query: Q): Flow<IviPagingSource<E>>

Transforms this IviDataSource to an IviPagingSource for the given query.

fun <D : IviDataSource<E, Q>, E : Any, Q : Any> LiveData<D>.mapQuery(query: Q, timeout: Duration = Duration.ZERO): LiveData<IviPagingSource<E>>

Transforms this IviDataSource to a IviPagingSource for a given query. If the returned LiveData becomes inactive while values are still being emited, the underlying coroutine will be cancelled after the timeout, unless the LiveData becomes active again before that timeout. By default timeout is Duration.ZERO, which means that once the returned LiveData becomes inactive it is not usable anymore.

fun <D : IviDataSource<E, Q>, E : Any, Q : Any, R> Flow<D>.mapQuery(query: Q, transformation: suspend (PageProvider<E>) -> R): Flow<R>

Transforms this IviDataSource to a R for the given query and given transformation lambda.

fun <D : IviDataSource<E, Q>, E : Any, Q : Any, R> LiveData<D>.mapQuery(    query: Q,     timeout: Duration = Duration.ZERO,     transformation: suspend (PageProvider<E>) -> R): LiveData<R>

Transforms this IviDataSource to a LiveData of type R for a given query and a given transformation. If the returned LiveData becomes inactive while values are still being emited, the underlying coroutine will be cancelled after the timeout, unless the LiveData becomes active again before that timeout. By default timeout is Duration.ZERO, which means that once the returned LiveData becomes inactive it is not usable anymore.

Link copied to clipboard
fun <P : IviPagingSource<E>, E : Any> Flow<P>.toList(): Flow<List<E>>

Transforms this IviPagingSource to a List containing elements of type E with all elements from the IviPagingSource.

fun <P : IviPagingSource<E>, E : Any> LiveData<P>.toList(timeout: Duration = Duration.ZERO): LiveData<List<E>>

Transforms this IviPagingSource to a List containing elements of type E with all elements from the IviPagingSource. If the returned LiveData becomes inactive while values are still being emited, the underlying coroutine will be cancelled after the timeout, unless the LiveData becomes active again before that timeout. By default timeout is Duration.ZERO, which means that once the returned LiveData becomes inactive it is not usable anymore.