Android APIs
public class

HeadersFragment

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

Class Overview

An internal fragment containing a list of row headers.

Summary

[Expand]
Inherited Constants
From interface android.content.ComponentCallbacks2
Fields
protected boolean mInTransition
protected int mReparentHeaderId
Public Constructors
HeadersFragment()
Public Methods
final ObjectAdapter getAdapter()
Returns the list of rows.
final PresenterSelector getPresenterSelector()
Get the presenter selector used to create and bind views.
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 onViewCreated(View view, Bundle savedInstanceState)
Called immediately after onCreateView(LayoutInflater, ViewGroup, Bundle) has returned, but before any saved state has been restored in to the view.
final void setAdapter(ObjectAdapter rowsAdapter)
Sets the adapter for the fragment.
void setOnHeaderClickedListener(HeadersFragment.OnHeaderClickedListener listener)
void setOnItemSelectedListener(OnItemSelectedListener listener)
final void setPresenterSelector(PresenterSelector presenterSelector)
Set the presenter selector used to create and bind views.
void setSelectedPosition(int position)
Set the selected item position.
Protected Methods
final ItemBridgeAdapter getBridgeAdapter()
Returns the bridge adapter.
Object getItem(Row row, int position)
int getLayoutResourceId()
void onRowSelected(ViewGroup parent, View view, int position, long id)
void updateAdapter()
[Expand]
Inherited Methods
From class android.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener

Fields

protected boolean mInTransition

protected int mReparentHeaderId

Public Constructors

public HeadersFragment ()

Public Methods

public final ObjectAdapter getAdapter ()

Returns the list of rows.

public final PresenterSelector getPresenterSelector ()

Get the presenter selector used to create and bind views.

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 onViewCreated (View view, Bundle savedInstanceState)

Called immediately after onCreateView(LayoutInflater, ViewGroup, Bundle) has returned, but before any saved state has been restored in to the view. This gives subclasses a chance to initialize themselves once they know their view hierarchy has been completely created. The fragment's view hierarchy is not however attached to its parent at this point.

Parameters
view The View returned by onCreateView(LayoutInflater, ViewGroup, Bundle).
savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.

public final void setAdapter (ObjectAdapter rowsAdapter)

Sets the adapter for the fragment.

public void setOnHeaderClickedListener (HeadersFragment.OnHeaderClickedListener listener)

public void setOnItemSelectedListener (OnItemSelectedListener listener)

public final void setPresenterSelector (PresenterSelector presenterSelector)

Set the presenter selector used to create and bind views.

public void setSelectedPosition (int position)

Set the selected item position.

Protected Methods

protected final ItemBridgeAdapter getBridgeAdapter ()

Returns the bridge adapter.

protected Object getItem (Row row, int position)

protected int getLayoutResourceId ()

protected void onRowSelected (ViewGroup parent, View view, int position, long id)

protected void updateAdapter ()