belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
Deprecated since version 27.1.0
PlaybackFragment
public
class
PlaybackFragment
extends Fragment
java.lang.Object | ||
↳ | android.app.Fragment | |
↳ | android.support.v17.leanback.app.PlaybackFragment |
Known Direct Subclasses |
This class was deprecated
in API level 27.1.0.
use PlaybackSupportFragment
A fragment for displaying playback controls and related content.
A PlaybackFragment renders the elements of its ObjectAdapter
as a set
of rows in a vertical list. The Adapter's PresenterSelector
must maintain subclasses
of RowPresenter
.
A playback row is a row rendered by PlaybackRowPresenter
.
App can call setPlaybackRow(Row)
to set playback row for the first element of adapter.
App can call setPlaybackRowPresenter(PlaybackRowPresenter)
to set presenter for it.
setPlaybackRow(Row)
and setPlaybackRowPresenter(PlaybackRowPresenter)
are
optional, app can pass playback row and PlaybackRowPresenter in the adapter using
setAdapter(ObjectAdapter)
.
Auto hide controls upon playing: best practice is calling
setControlsOverlayAutoHideEnabled(boolean)
upon play/pause. The auto hiding timer will
be cancelled upon tickle()
triggered by input event.
Summary
Constants | |
---|---|
int |
BG_DARK
A dark translucent background. |
int |
BG_LIGHT
A light translucent background. |
int |
BG_NONE
No background. |
Inherited constants |
---|
From
interface
android.content.ComponentCallbacks2
|
Public constructors | |
---|---|
PlaybackFragment()
|
Public methods | |
---|---|
void
|
fadeOut()
This method was deprecated
in API level 26.1.0.
Call |
ObjectAdapter
|
getAdapter()
|
int
|
getBackgroundType()
Returns the background type. |
ProgressBarManager
|
getProgressBarManager()
Returns the ProgressBarManager that will show or hide progress bar in
|
void
|
hideControlsOverlay(boolean runAnimation)
Hide controls overlay. |
boolean
|
isControlsOverlayAutoHideEnabled()
Returns true if controls will be auto hidden after a delay when fragment is resumed. |
boolean
|
isControlsOverlayVisible()
Returns true if controls overlay is visible, false otherwise. |
boolean
|
isFadingEnabled()
This method was deprecated
in API level 26.1.0.
Uses |
void
|
notifyPlaybackRowChanged()
Updates the ui when the row data changes. |
void
|
onCreate(Bundle savedInstanceState)
|
View
|
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
void
|
onDestroy()
|
void
|
onDestroyView()
|
void
|
onPause()
|
void
|
onResume()
|
void
|
onStart()
|
void
|
onStop()
|
void
|
onViewCreated(View view, Bundle savedInstanceState)
|
void
|
setAdapter(ObjectAdapter adapter)
Sets the list of rows for the fragment. |
void
|
setBackgroundType(int type)
Sets the background type. |
void
|
setControlsOverlayAutoHideEnabled(boolean enabled)
Enables or disables auto hiding controls overlay after a short delay fragment is resumed. |
void
|
setFadingEnabled(boolean enabled)
This method was deprecated
in API level 26.1.0.
Uses |
void
|
setHostCallback(PlaybackGlueHost.HostCallback hostCallback)
Sets the |
void
|
setOnItemViewClickedListener(BaseOnItemViewClickedListener listener)
This listener is called every time there is a click in |
void
|
setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener)
This listener is called every time there is a selection in |
final
void
|
setOnKeyInterceptListener(View.OnKeyListener handler)
Sets the input event handler. |
void
|
setOnPlaybackItemViewClickedListener(BaseOnItemViewClickedListener listener)
Sets the |
void
|
setPlaybackRow(Row row)
Sets the playback row for the playback controls. |
void
|
setPlaybackRowPresenter(PlaybackRowPresenter presenter)
Sets the presenter for rendering the playback row set by |
void
|
setPlaybackSeekUiClient(PlaybackSeekUi.Client client)
Interface to be implemented by UI widget to support PlaybackSeekUi. |
void
|
setSelectedPosition(int position)
Sets the selected row position with smooth animation. |
void
|
setSelectedPosition(int position, boolean smooth)
Sets the selected row position. |
void
|
showControlsOverlay(boolean runAnimation)
Show controls overlay. |
void
|
tickle()
Tickles the playback controls. |
Protected methods | |
---|---|
void
|
onBufferingStateChanged(boolean start)
Called when media has start or stop buffering. |
void
|
onError(int errorCode, CharSequence errorMessage)
Called when media has error. |
void
|
onVideoSizeChanged(int videoWidth, int videoHeight)
Called when size of the video changes. |
Inherited methods | |
---|---|
From
class
android.app.Fragment
| |
From
class
java.lang.Object
| |
From
interface
android.content.ComponentCallbacks2
| |
From
interface
android.view.View.OnCreateContextMenuListener
| |
From
interface
android.content.ComponentCallbacks
|
Constants
BG_DARK
int BG_DARK
A dark translucent background.
Constant Value: 1 (0x00000001)
BG_LIGHT
int BG_LIGHT
A light translucent background.
Constant Value: 2 (0x00000002)
Public constructors
Public methods
fadeOut
void fadeOut ()
This method was deprecated
in API level 26.1.0.
Call hideControlsOverlay(boolean)
Fades out the playback overlay immediately.
getBackgroundType
int getBackgroundType ()
Returns the background type.
Returns | |
---|---|
int |
getProgressBarManager
ProgressBarManager getProgressBarManager ()
Returns the ProgressBarManager that will show or hide progress bar in
onBufferingStateChanged(boolean)
.
Returns | |
---|---|
ProgressBarManager |
The ProgressBarManager that will show or hide progress bar in
onBufferingStateChanged(boolean) .
|
hideControlsOverlay
void hideControlsOverlay (boolean runAnimation)
Hide controls overlay.
Parameters | |
---|---|
runAnimation |
boolean : True to run animation, false otherwise.
|
isControlsOverlayAutoHideEnabled
boolean isControlsOverlayAutoHideEnabled ()
Returns true if controls will be auto hidden after a delay when fragment is resumed.
Returns | |
---|---|
boolean |
isControlsOverlayVisible
boolean isControlsOverlayVisible ()
Returns true if controls overlay is visible, false otherwise.
Returns | |
---|---|
boolean |
True if controls overlay is visible, false otherwise. |
isFadingEnabled
boolean isFadingEnabled ()
This method was deprecated
in API level 26.1.0.
Uses isControlsOverlayAutoHideEnabled()
Returns | |
---|---|
boolean |
notifyPlaybackRowChanged
void notifyPlaybackRowChanged ()
Updates the ui when the row data changes.
onCreateView
View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Parameters | |
---|---|
inflater |
LayoutInflater |
container |
ViewGroup |
savedInstanceState |
Bundle |
Returns | |
---|---|
View |
onDestroy
void onDestroy ()
onDestroyView
void onDestroyView ()
onPause
void onPause ()
onResume
void onResume ()
onStart
void onStart ()
onStop
void onStop ()
onViewCreated
void onViewCreated (View view, Bundle savedInstanceState)
Parameters | |
---|---|
view |
View |
savedInstanceState |
Bundle |
setAdapter
void setAdapter (ObjectAdapter adapter)
Sets the list of rows for the fragment. A default ClassPresenterSelector
will be
created if getPresenterSelector()
is null. if user provides
setPlaybackRow(Row)
and setPlaybackRowPresenter(PlaybackRowPresenter)
,
the row and presenter will be set onto the adapter.
Parameters | |
---|---|
adapter |
ObjectAdapter : The adapter that contains related rows and optional playback row.
|
setBackgroundType
void setBackgroundType (int type)
Sets the background type.
Parameters | |
---|---|
type |
int : One of BG_LIGHT, BG_DARK, or BG_NONE.
|
setControlsOverlayAutoHideEnabled
void setControlsOverlayAutoHideEnabled (boolean enabled)
Enables or disables auto hiding controls overlay after a short delay fragment is resumed.
If enabled and fragment is resumed, the view will fade out after a time period.
tickle()
will kill the timer, next time fragment is resumed,
the timer will be started again if isControlsOverlayAutoHideEnabled()
is true.
Parameters | |
---|---|
enabled |
boolean |
setFadingEnabled
void setFadingEnabled (boolean enabled)
This method was deprecated
in API level 26.1.0.
Uses setControlsOverlayAutoHideEnabled(boolean)
Parameters | |
---|---|
enabled |
boolean |
setHostCallback
void setHostCallback (PlaybackGlueHost.HostCallback hostCallback)
Sets the PlaybackGlueHost.HostCallback
. Implementor of this interface will
take appropriate actions to take action when the hosting fragment starts/stops processing.
Parameters | |
---|---|
hostCallback |
PlaybackGlueHost.HostCallback |
setOnItemViewClickedListener
void setOnItemViewClickedListener (BaseOnItemViewClickedListener listener)
This listener is called every time there is a click in RowsFragment
. This can
be used by users to take additional actions such as animations.
Parameters | |
---|---|
listener |
BaseOnItemViewClickedListener |
setOnItemViewSelectedListener
void setOnItemViewSelectedListener (BaseOnItemViewSelectedListener listener)
This listener is called every time there is a selection in RowsFragment
. This can
be used by users to take additional actions such as animations.
Parameters | |
---|---|
listener |
BaseOnItemViewSelectedListener |
setOnKeyInterceptListener
void setOnKeyInterceptListener (View.OnKeyListener handler)
Sets the input event handler.
Parameters | |
---|---|
handler |
View.OnKeyListener |
setOnPlaybackItemViewClickedListener
void setOnPlaybackItemViewClickedListener (BaseOnItemViewClickedListener listener)
Sets the BaseOnItemViewClickedListener
that would be invoked for clicks
only on PlaybackRowPresenter.ViewHolder
.
Parameters | |
---|---|
listener |
BaseOnItemViewClickedListener |
setPlaybackRow
void setPlaybackRow (Row row)
Sets the playback row for the playback controls. The row will be set as first element
of adapter if the adapter is ArrayObjectAdapter
or SparseArrayObjectAdapter
.
Parameters | |
---|---|
row |
Row : The row that represents the playback.
|
setPlaybackRowPresenter
void setPlaybackRowPresenter (PlaybackRowPresenter presenter)
Sets the presenter for rendering the playback row set by setPlaybackRow(Row)
. If
adapter does not set a PresenterSelector
, setAdapter(ObjectAdapter)
will
create a ClassPresenterSelector
by default and map from the row object class to this
PlaybackRowPresenter
.
Parameters | |
---|---|
presenter |
PlaybackRowPresenter : Presenter used to render setPlaybackRow(Row) .
|
setPlaybackSeekUiClient
void setPlaybackSeekUiClient (PlaybackSeekUi.Client client)
Interface to be implemented by UI widget to support PlaybackSeekUi.
Parameters | |
---|---|
client |
PlaybackSeekUi.Client |
setSelectedPosition
void setSelectedPosition (int position)
Sets the selected row position with smooth animation.
Parameters | |
---|---|
position |
int |
setSelectedPosition
void setSelectedPosition (int position, boolean smooth)
Sets the selected row position.
Parameters | |
---|---|
position |
int |
smooth |
boolean |
showControlsOverlay
void showControlsOverlay (boolean runAnimation)
Show controls overlay.
Parameters | |
---|---|
runAnimation |
boolean : True to run animation, false otherwise.
|
tickle
void tickle ()
Tickles the playback controls. Fades in the view if it was faded out. tickle()
will
also kill the timer created by setControlsOverlayAutoHideEnabled(boolean)
. When
next time fragment is resumed, the timer will be started again if
isControlsOverlayAutoHideEnabled()
is true. In most cases app does not need call
this method, tickling on input events is handled by the fragment.
Protected methods
onBufferingStateChanged
void onBufferingStateChanged (boolean start)
Called when media has start or stop buffering. App may override. The default initial state is not buffering.
Parameters | |
---|---|
start |
boolean : True for buffering start, false otherwise.
|
onError
void onError (int errorCode, CharSequence errorMessage)
Called when media has error. App may override.
Parameters | |
---|---|
errorCode |
int : Optional error code for specific implementation. |
errorMessage |
CharSequence : Optional error message for specific implementation.
|
onVideoSizeChanged
void onVideoSizeChanged (int videoWidth, int videoHeight)
Called when size of the video changes. App may override.
Parameters | |
---|---|
videoWidth |
int : Intrinsic width of video |
videoHeight |
int : Intrinsic height of video
|
Interfaces
- BrowseFragment.FragmentHost
- BrowseFragment.MainFragmentAdapterProvider
- BrowseFragment.MainFragmentRowsAdapterProvider
- BrowseSupportFragment.FragmentHost
- BrowseSupportFragment.MainFragmentAdapterProvider
- BrowseSupportFragment.MainFragmentRowsAdapterProvider
- HeadersFragment.OnHeaderClickedListener
- HeadersFragment.OnHeaderViewSelectedListener
- HeadersSupportFragment.OnHeaderClickedListener
- HeadersSupportFragment.OnHeaderViewSelectedListener
- SearchFragment.SearchResultProvider
- SearchSupportFragment.SearchResultProvider
Classes
- BackgroundManager
- BaseFragment
- BaseSupportFragment
- BrandedFragment
- BrandedSupportFragment
- BrowseFragment
- BrowseFragment.BrowseTransitionListener
- BrowseFragment.FragmentFactory
- BrowseFragment.ListRowFragmentFactory
- BrowseFragment.MainFragmentAdapter
- BrowseFragment.MainFragmentAdapterRegistry
- BrowseFragment.MainFragmentRowsAdapter
- BrowseSupportFragment
- BrowseSupportFragment.BrowseTransitionListener
- BrowseSupportFragment.FragmentFactory
- BrowseSupportFragment.ListRowFragmentFactory
- BrowseSupportFragment.MainFragmentAdapter
- BrowseSupportFragment.MainFragmentAdapterRegistry
- BrowseSupportFragment.MainFragmentRowsAdapter
- DetailsFragment
- DetailsFragmentBackgroundController
- DetailsSupportFragment
- DetailsSupportFragmentBackgroundController
- ErrorFragment
- ErrorSupportFragment
- GuidedStepFragment
- GuidedStepSupportFragment
- HeadersFragment
- HeadersSupportFragment
- OnboardingFragment
- OnboardingSupportFragment
- PlaybackFragment
- PlaybackFragmentGlueHost
- PlaybackSupportFragment
- PlaybackSupportFragmentGlueHost
- ProgressBarManager
- RowsFragment
- RowsFragment.MainFragmentAdapter
- RowsFragment.MainFragmentRowsAdapter
- RowsSupportFragment
- RowsSupportFragment.MainFragmentAdapter
- RowsSupportFragment.MainFragmentRowsAdapter
- SearchFragment
- SearchSupportFragment
- VerticalGridFragment
- VerticalGridSupportFragment
- VideoFragment
- VideoFragmentGlueHost
- VideoSupportFragment
- VideoSupportFragmentGlueHost