Android APIs
public class

PlaybackOverlayFragment

extends DetailsFragment
java.lang.Object
   ↳ android.app.Fragment
     ↳ android.support.v17.leanback.app.DetailsFragment
       ↳ android.support.v17.leanback.app.PlaybackOverlayFragment

Class Overview

A fragment for displaying playback controls and related content.

A PlaybackOverlayFragment renders the elements of its ObjectAdapter as a set of rows in a vertical list. The elements in this adapter must be subclasses of Row.

An instance of PlaybackControlsRow is expected to be at position 0 in the adapter.

Summary

Nested Classes
interface PlaybackOverlayFragment.InputEventHandler Interface allowing the application to handle input events. 
class PlaybackOverlayFragment.OnFadeCompleteListener Listener allowing the application to receive notification of fade in and/or fade out completion events. 
[Expand]
Inherited XML Attributes
From class android.app.Fragment
Constants
int BG_DARK A dark translucent background.
int BG_LIGHT A light translucent background.
int BG_NONE No background.
[Expand]
Inherited Constants
From interface android.content.ComponentCallbacks2
Public Constructors
PlaybackOverlayFragment()
Public Methods
int getBackgroundType()
Returns the background type.
PlaybackOverlayFragment.OnFadeCompleteListener getFadeCompleteListener()
Returns the listener to be called when fade in or out has completed.
final PlaybackOverlayFragment.InputEventHandler getInputEventHandler()
Returns the input event handler.
boolean isFadingEnabled()
Returns true if view fading is enabled.
void onCreate(Bundle savedInstanceState)
Called to do initial creation of a fragment.
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Called to have the fragment instantiate its user interface view.
void onDestroyView()
Called when the view previously created by onCreateView(LayoutInflater, ViewGroup, Bundle) has been detached from the fragment.
void onResume()
Called when the fragment is visible to the user and actively running.
void setAdapter(ObjectAdapter adapter)
Sets the list of rows for the fragment.
void setBackgroundType(int type)
Sets the background type.
void setFadeCompleteListener(PlaybackOverlayFragment.OnFadeCompleteListener listener)
Sets the listener to be called when fade in or out has completed.
void setFadingEnabled(boolean enabled)
Enables or disables view fading.
final void setInputEventHandler(PlaybackOverlayFragment.InputEventHandler handler)
Sets the input event handler.
void tickle()
Tickles the playback controls.
[Expand]
Inherited Methods
From class android.support.v17.leanback.app.DetailsFragment
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

public static final int BG_DARK

A dark translucent background.

Constant Value: 1 (0x00000001)

public static final int BG_LIGHT

A light translucent background.

Constant Value: 2 (0x00000002)

public static final int BG_NONE

No background.

Constant Value: 0 (0x00000000)

Public Constructors

public PlaybackOverlayFragment ()

Public Methods

public int getBackgroundType ()

Returns the background type.

public PlaybackOverlayFragment.OnFadeCompleteListener getFadeCompleteListener ()

Returns the listener to be called when fade in or out has completed.

public final PlaybackOverlayFragment.InputEventHandler getInputEventHandler ()

Returns the input event handler.

public boolean isFadingEnabled ()

Returns true if view fading is enabled.

public void onCreate (Bundle savedInstanceState)

Called to do initial creation of a fragment. This is called after onAttach(Activity) and before onCreateView(LayoutInflater, ViewGroup, Bundle).

Note that this can be called while the fragment's activity is still in the process of being created. As such, you can not rely on things like the activity's content view hierarchy being initialized at this point. If you want to do work once the activity itself is created, see onActivityCreated(Bundle).

Parameters
savedInstanceState If the fragment is being re-created from a previous saved state, this is the state.

public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Called to have the fragment instantiate its user interface view. This is optional, and non-graphical fragments can return null (which is the default implementation). This will be called between onCreate(Bundle) and onActivityCreated(Bundle).

If you return a View from here, you will later be called in onDestroyView() when the view is being released.

Parameters
inflater The LayoutInflater object that can be used to inflate any views in the fragment,
container If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view.
savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.
Returns
  • Return the View for the fragment's UI, or null.

public void onDestroyView ()

Called when the view previously created by onCreateView(LayoutInflater, ViewGroup, Bundle) has been detached from the fragment. The next time the fragment needs to be displayed, a new view will be created. This is called after onStop() and before onDestroy(). It is called regardless of whether onCreateView(LayoutInflater, ViewGroup, Bundle) returned a non-null view. Internally it is called after the view's state has been saved but before it has been removed from its parent.

public void onResume ()

Called when the fragment is visible to the user and actively running. This is generally tied to Activity.onResume of the containing Activity's lifecycle.

public void setAdapter (ObjectAdapter adapter)

Sets the list of rows for the fragment.

public void setBackgroundType (int type)

Sets the background type.

Parameters
type One of BG_LIGHT, BG_DARK, or BG_NONE.

public void setFadeCompleteListener (PlaybackOverlayFragment.OnFadeCompleteListener listener)

Sets the listener to be called when fade in or out has completed.

public void setFadingEnabled (boolean enabled)

Enables or disables view fading. If enabled, the view will be faded in when the fragment starts, and will fade out after a time period. The timeout period is reset each time tickle() is called.

public final void setInputEventHandler (PlaybackOverlayFragment.InputEventHandler handler)

Sets the input event handler.

public void tickle ()

Tickles the playback controls. Fades in the view if it was faded out, otherwise resets the fade out timer. Tickling on input events is handled by the fragment.