PlaybackSeekDataProvider
public
class
PlaybackSeekDataProvider
extends Object
java.lang.Object | |
↳ | androidx.leanback.widget.PlaybackSeekDataProvider |
Class to be implemented by app to provide seeking data and thumbnails to UI.
Summary
Nested classes | |
---|---|
class |
PlaybackSeekDataProvider.ResultCallback
Client to receive result for |
Public constructors | |
---|---|
PlaybackSeekDataProvider()
|
Public methods | |
---|---|
long[]
|
getSeekPositions()
Get a list of sorted seek positions. |
void
|
getThumbnail(int index, PlaybackSeekDataProvider.ResultCallback callback)
Called to get thumbnail bitmap. |
void
|
reset()
Called when seek stops, Provider should cancel pending requests for the thumbnails. |
Inherited methods | |
---|---|
Public constructors
PlaybackSeekDataProvider
public PlaybackSeekDataProvider ()
Public methods
getSeekPositions
public long[] getSeekPositions ()
Get a list of sorted seek positions. The positions should not change after user starts seeking.
Returns | |
---|---|
long[] |
A list of sorted seek positions. |
getThumbnail
public void getThumbnail (int index, PlaybackSeekDataProvider.ResultCallback callback)
Called to get thumbnail bitmap. This method is called on UI thread. When provider finds
cache bitmap, it may invoke PlaybackSeekDataProvider.ResultCallback.onThumbnailLoaded(Bitmap, int)
immediately. Provider may start background thread and invoke
PlaybackSeekDataProvider.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 PlaybackSeekDataProvider.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
public void reset ()
Called when seek stops, Provider should cancel pending requests for the thumbnails.
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.