PlaybackSupportFragment
open class PlaybackSupportFragment : Fragment
kotlin.Any | ||
↳ | androidx.fragment.app.Fragment | |
↳ | androidx.leanback.app.PlaybackSupportFragment |
A fragment for displaying playback controls and related content.
A PlaybackSupportFragment 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)
.
Hiding and showing controls: the controls are initially visible and automatically show/hide when play/pause or user interacts with fragment.
- App may manually call
showControlsOverlay(boolean)
orhideControlsOverlay(boolean)
to show or hide the controls. - The controls are visible by default upon onViewCreated(). To make it initially invisible, call hideControlsOverlay(false) in overridden onViewCreated(). Upon play or pause, PlaybackControlGlue or PlaybackTransportControlGlue will fade-in the controls and automatically fade out after a delay customized by
- Upon user interaction event, fragment will fade-in the controls and automatically fade out after a delay customized by
R.attr#playbackControlsAutoHideTickleTimeout
. To disable the fade in and fade out behavior, call
R.attr#playbackControlsAutoHideTimeout
. To disable the fade in and fade out behavior: call #setControlsOverlayAutoHideEnabled(boolean)
with false.
Summary
Constants | |
---|---|
static Int |
A dark translucent background. |
static Int |
A light translucent background. |
static Int |
No background. |
Public constructors | |
---|---|
<init>() |
Public methods | |
---|---|
open Unit |
fadeOut() Fades out the playback overlay immediately. |
open ObjectAdapter! | |
open Int |
Returns the background type. |
open ProgressBarManager! |
Returns the ProgressBarManager that will show or hide progress bar in |
open Unit |
hideControlsOverlay(runAnimation: Boolean) Hide controls overlay. |
open Boolean |
Returns true if controls will be auto hidden after a delay when fragment is resumed. |
open Boolean |
Returns true if controls overlay is visible, false otherwise. |
open Boolean | |
open Boolean |
Returns true if showing and auto-hiding controls when user interacts; false otherwise. |
open Unit |
Updates the ui when the row data changes. |
open Unit | |
open View? |
onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) |
open Unit | |
open Unit | |
open Unit |
onPause() |
open Unit |
onResume() |
open Unit |
onStart() |
open Unit |
onStop() |
open Unit |
onViewCreated(@NonNull view: View, @Nullable savedInstanceState: Bundle?) |
open Unit |
setAdapter(adapter: ObjectAdapter!) Sets the list of rows for the fragment. |
open Unit |
setBackgroundType(type: Int) Sets the background type. |
open Unit |
setControlsOverlayAutoHideEnabled(enabled: Boolean) Enables or disables auto hiding controls overlay after a short delay fragment is resumed. |
open Unit |
setFadingEnabled(enabled: Boolean) |
open Unit |
setHostCallback(hostCallback: PlaybackGlueHost.HostCallback!) Sets the |
open Unit |
setOnItemViewClickedListener(listener: BaseOnItemViewClickedListener<Any!>!) This listener is called every time there is a click in |
open Unit |
setOnItemViewSelectedListener(listener: |