PlaybackSeekDataProvider
open class PlaybackSeekDataProvider
kotlin.Any | |
↳ | androidx.leanback.widget.PlaybackSeekDataProvider |
Class to be implemented by app to provide seeking data and thumbnails to UI.
Summary
Nested classes | |
---|---|
open |
Client to receive result for |
Public constructors | |
---|---|
<init>() Class to be implemented by app to provide seeking data and thumbnails to UI. |
Public methods | |
---|---|
open LongArray! |
Get a list of sorted seek positions. |
open Unit |
getThumbnail(index: Int, callback: PlaybackSeekDataProvider.ResultCallback!) Called to get thumbnail bitmap. |
open Unit |
reset() Called when seek stops, Provider should cancel pending requests for the thumbnails. |
Public constructors
<init>
PlaybackSeekDataProvider()
Class to be implemented by app to provide seeking data and thumbnails to UI.
Public methods
getSeekPositions
open fun getSeekPositions(): LongArray!
Get a list of sorted seek positions. The positions should not change after user starts seeking.
Return | |
---|---|
LongArray! |
A list of sorted seek positions. |
getThumbnail
open fun getThumbnail(
index: Int,
callback: PlaybackSeekDataProvider.ResultCallback!
): Unit
Called to get thumbnail bitmap. This method is called on UI thread. When provider finds cache bitmap, it may invoke ResultCallback#onThumbnailLoaded(Bitmap, int)
immediately. Provider may start background thread and invoke ResultCallback#onThumbnailLoaded(Bitmap, int)
later in UI thread. The method might be called multiple times for the same position, PlaybackSeekDataProvider must guarantee to replace pending ResultCallback
with the new one. When seeking right, getThumbnail() will be called with increasing index; when seeking left, getThumbnail() will be called with decreasing index. The increment of index can be used by subclass to determine prefetch direction.
Parameters | |
---|---|
index |
Int: Index of position in getSeekPositions() . |
callback |
PlaybackSeekDataProvider.ResultCallback!: The callback to receive the result on UI thread. It may be called within getThumbnail() if hit cache directly. |
reset
open fun reset(): Unit
Called when seek stops, Provider should cancel pending requests for the thumbnails.