SearchSourceClient

@IviExperimental(reasons = [])
class SearchSourceClient(sourceId: SourceId, coroutineDispatcher: CoroutineDispatcher = Options.mediaCoroutineDispatcher) : SourceClient

SourceClient specialization oriented towards searching.

Call search, and retrieve the updated contents as soon as isLoading is false.

Parameters

sourceId

ID of the source to connect to.

coroutineDispatcher

The coroutine dispatcher to use to launch background operations. The most common are IPC requests via Binder. Defaults to the IO dispatcher.

Constructors

Link copied to clipboard
fun SearchSourceClient(sourceId: SourceId, coroutineDispatcher: CoroutineDispatcher = Options.mediaCoroutineDispatcher)

Properties

Link copied to clipboard
open override val contents: LiveData<List<IviMediaItem>>

The list of IviMediaItem results obtained by searching for query. Initially empty. The contents will be updated over time if the source decides to do so.

Link copied to clipboard
open override val isAvailable: LiveData<Boolean>

Whether the source can be queried and provide content.

Link copied to clipboard
open override val isLoading: LiveData<Boolean>

Whether the source is loading content.

Link copied to clipboard

The last search query. Initially empty. When calling search, this LiveData value will be updated.

Link copied to clipboard
open override val rootMetadata: LiveData<Bundle?>

The client root extras. Can be used to store various values to determine source behavior.

Functions

Link copied to clipboard
open suspend override fun <T> coLaunchBrowserAction(browserAction: BrowserAction<T>): BrowserActionResult<T>

Launch a browser action.

Link copied to clipboard
fun search(query: String?)

Starts a search for query. If the client is available, starts searching immediately. Otherwise, the query will be saved until available.

Link copied to clipboard
open override fun setContext(context: Context?)

Attaches the client to an Android Context.

Link copied to clipboard
open override fun setErrorCallback(callback: ErrorCallback)

Set the callback where to receive notifications about error conditions.

Link copied to clipboard
open override fun setTag(tag: String)

Set a tag to identify this client in debugging logs.