Most visited

Recently visited

PlaybackOverlayFragment

public class PlaybackOverlayFragment
extends DetailsFragment

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


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 Adapter's PresenterSelector must maintain subclasses of RowPresenter.

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. 

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.

Inherited constants

From interface android.content.ComponentCallbacks2

Public constructors

PlaybackOverlayFragment()

Public methods

void fadeOut()

Fades out the playback overlay immediately.

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.

Inherited methods

From class android.support.v17.leanback.app.DetailsFragment
From class android.support.v17.leanback.app.BrandedFragment
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)

BG_NONE

int BG_NONE

No background.

Constant Value: 0 (0x00000000)

Public constructors

PlaybackOverlayFragment

PlaybackOverlayFragment ()

Public methods

fadeOut

void fadeOut ()

Fades out the playback overlay immediately.

getBackgroundType

int getBackgroundType ()

Returns the background type.

Returns
int

getFadeCompleteListener

PlaybackOverlayFragment.OnFadeCompleteListener getFadeCompleteListener ()

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

Returns
PlaybackOverlayFragment.OnFadeCompleteListener

getInputEventHandler

PlaybackOverlayFragment.InputEventHandler getInputEventHandler ()

Returns the input event handler.

Returns
PlaybackOverlayFragment.InputEventHandler

isFadingEnabled

boolean isFadingEnabled ()

Returns true if view fading is enabled.

Returns
boolean

onCreate

void onCreate (Bundle savedInstanceState)

Called to do initial creation of a fragment. This is called after onAttach(Activity) and before onCreateView(LayoutInflater, ViewGroup, Bundle), but is not called if the fragment instance is retained across Activity re-creation (see setRetainInstance(boolean)).

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).

If your app's targetSdkVersion is 23 or lower, child fragments being restored from the savedInstanceState are restored after onCreate returns. When targeting N or above and running on an N or newer platform version they are restored by Fragment.onCreate.

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

onCreateView

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 LayoutInflater: The LayoutInflater object that can be used to inflate any views in the fragment,
container ViewGroup: 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 Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here.
Returns
View Return the View for the fragment's UI, or null.

onDestroyView

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.

onResume

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.

setAdapter

void setAdapter (ObjectAdapter adapter)

Sets the list of rows for the fragment.

Parameters
adapter ObjectAdapter

setBackgroundType

void setBackgroundType (int type)

Sets the background type.

Parameters
type int: One of BG_LIGHT, BG_DARK, or BG_NONE.

setFadeCompleteListener

void setFadeCompleteListener (PlaybackOverlayFragment.OnFadeCompleteListener listener)

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

Parameters
listener PlaybackOverlayFragment.OnFadeCompleteListener

setFadingEnabled

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.

Parameters
enabled boolean

setInputEventHandler

void setInputEventHandler (PlaybackOverlayFragment.InputEventHandler handler)

Sets the input event handler.

Parameters
handler PlaybackOverlayFragment.InputEventHandler

tickle

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.

Hooray!