belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
Deprecated since version 27.1.0
DetailsFragment
public
class
DetailsFragment
extends BaseFragment
java.lang.Object | ||||
↳ | android.app.Fragment | |||
↳ | android.support.v17.leanback.app.BrandedFragment | |||
↳ | android.support.v17.leanback.app.BaseFragment | |||
↳ | android.support.v17.leanback.app.DetailsFragment |
This class was deprecated
in API level 27.1.0.
use DetailsSupportFragment
A fragment for creating Leanback details screens.
A DetailsFragment renders the elements of its ObjectAdapter
as a set
of rows in a vertical list.The Adapter's PresenterSelector
must maintain subclasses
of RowPresenter
.
FullWidthDetailsOverviewRowPresenter
is found in adapter, DetailsFragment will
setup default behavior of the DetailsOverviewRow:
setupDetailsOverviewRowPresenter(FullWidthDetailsOverviewRowPresenter)
.
onSetDetailsOverviewRowStatus(FullWidthDetailsOverviewRowPresenter, FullWidthDetailsOverviewRowPresenter.ViewHolder, int, int, int)
.
The recommended activity themes to use with a DetailsFragment are
Theme_Leanback_Details
with activity
shared element transition for FullWidthDetailsOverviewRowPresenter
.
Theme_Leanback_Details_NoSharedElementTransition
if shared element transition is not needed, for example if first row is not rendered by
FullWidthDetailsOverviewRowPresenter
.
DetailsFragment can use DetailsFragmentBackgroundController
to add a parallax drawable
background and embedded video playing fragment.
Summary
Inherited constants |
---|
From
interface
android.content.ComponentCallbacks2
|
Public constructors | |
---|---|
DetailsFragment()
|
Public methods | |
---|---|
ObjectAdapter
|
getAdapter()
Returns the list of rows. |
BaseOnItemViewClickedListener
|
getOnItemViewClickedListener()
Returns the item clicked listener. |
DetailsParallax
|
getParallax()
Returns the |
RowsFragment
|
getRowsFragment()
Gets embedded RowsFragment showing multiple rows for DetailsFragment. |
void
|
onCreate(Bundle savedInstanceState)
|
View
|
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
View
|
onInflateTitleView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)
Called by |
void
|
onStart()
|
void
|
onStop()
|
void
|
setAdapter(ObjectAdapter adapter)
Sets the list of rows for the fragment. |
void
|
setOnItemViewClickedListener(BaseOnItemViewClickedListener listener)
Sets an item clicked listener. |
void
|
setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener)
Sets an item selection listener. |
void
|
setSelectedPosition(int position)
Sets the selected row position with smooth animation. |
void
|
setSelectedPosition(int position, boolean smooth)
Sets the selected row position. |
Protected methods | |
---|---|
Object
|
createEntranceTransition()
Create entrance transition. |
View
|
inflateTitle(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)
This method was deprecated
in API level 24.1.0.
override |
void
|
onEntranceTransitionEnd()
Callback when entrance transition is ended. |
void
|
onEntranceTransitionPrepare()
Callback when entrance transition is prepared. |
void
|
onEntranceTransitionStart()
Callback when entrance transition is started. |
void
|
onSetDetailsOverviewRowStatus(FullWidthDetailsOverviewRowPresenter presenter, FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int adapterPosition, int selectedPosition, int selectedSubPosition)
Called to change DetailsOverviewRow view status when current selected row position or selected sub position changed. |
void
|
onSetRowStatus(RowPresenter presenter, RowPresenter.ViewHolder viewHolder, int adapterPosition, int selectedPosition, int selectedSubPosition)
Called on every visible row to change view status when current selected row position or selected sub position changed. |
void
|
runEntranceTransition(Object entranceTransition)
Run entrance transition. |
void
|
setupDetailsOverviewRowPresenter(FullWidthDetailsOverviewRowPresenter presenter)
Called to setup |
void
|
setupPresenter(Presenter rowPresenter)
Called to setup each Presenter of Adapter passed in |
Inherited methods | |
---|---|
From
class
android.support.v17.leanback.app.BaseFragment
| |
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
|
Public constructors
Public methods
getAdapter
ObjectAdapter getAdapter ()
Returns the list of rows.
Returns | |
---|---|
ObjectAdapter |
getOnItemViewClickedListener
BaseOnItemViewClickedListener getOnItemViewClickedListener ()
Returns the item clicked listener.
Returns | |
---|---|
BaseOnItemViewClickedListener |
getParallax
DetailsParallax getParallax ()
Returns the DetailsParallax
instance used by
DetailsFragmentBackgroundController
to configure parallax effect of background and
control embedded video playback. App usually does not use this method directly.
App may use this method for other custom parallax tasks.
Returns | |
---|---|
DetailsParallax |
The DetailsParallax instance attached to the DetailsFragment. |
getRowsFragment
RowsFragment getRowsFragment ()
Gets embedded RowsFragment showing multiple rows for DetailsFragment. If view of DetailsFragment is not created, the method returns null.
Returns | |
---|---|
RowsFragment |
Embedded RowsFragment showing multiple rows for DetailsFragment. |
onCreateView
View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Parameters | |
---|---|
inflater |
LayoutInflater |
container |
ViewGroup |
savedInstanceState |
Bundle |
Returns | |
---|---|
View |
onInflateTitleView
View onInflateTitleView (LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)
Called by installTitleView(LayoutInflater, ViewGroup, Bundle)
to inflate
title view. Default implementation uses layout file lb_browse_title.
Subclass may override and use its own layout, the layout must have a descendant with id
browse_title_group that implements TitleViewAdapter.Provider
. Subclass may return
null if no title is needed.
Parameters | |
---|---|
inflater |
LayoutInflater : The LayoutInflater object that can be used to inflate
any views in the fragment, |
parent |
ViewGroup : Parent of title view. |
savedInstanceState |
Bundle : If non-null, this fragment is being re-constructed
from a previous saved state as given here. |
Returns | |
---|---|
View |
Title view which must have a descendant with id browse_title_group that implements
TitleViewAdapter.Provider , or null for no title view.
|
onStop
void onStop ()
setAdapter
void setAdapter (ObjectAdapter adapter)
Sets the list of rows for the fragment.
Parameters | |
---|---|
adapter |
ObjectAdapter |
setOnItemViewClickedListener
void setOnItemViewClickedListener (BaseOnItemViewClickedListener listener)
Sets an item clicked listener.
Parameters | |
---|---|
listener |
BaseOnItemViewClickedListener |
setOnItemViewSelectedListener
void setOnItemViewSelectedListener (BaseOnItemViewSelectedListener listener)
Sets an item selection listener.
Parameters | |
---|---|
listener |
BaseOnItemViewSelectedListener |
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 |
Protected methods
createEntranceTransition
Object createEntranceTransition ()
Create entrance transition. Subclass can override to load transition from resource or construct manually. Typically app does not need to override the default transition that browse and details provides.
Returns | |
---|---|
Object |
inflateTitle
View inflateTitle (LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState)
This method was deprecated
in API level 24.1.0.
override onInflateTitleView(LayoutInflater, ViewGroup, Bundle)
instead.
Parameters | |
---|---|
inflater |
LayoutInflater |
parent |
ViewGroup |
savedInstanceState |
Bundle |
Returns | |
---|---|
View |
onEntranceTransitionEnd
void onEntranceTransitionEnd ()
Callback when entrance transition is ended.
onEntranceTransitionPrepare
void onEntranceTransitionPrepare ()
Callback when entrance transition is prepared. This is when fragment should stop user input and animations.
onEntranceTransitionStart
void onEntranceTransitionStart ()
Callback when entrance transition is started. This is when fragment should stop processing layout.
onSetDetailsOverviewRowStatus
void onSetDetailsOverviewRowStatus (FullWidthDetailsOverviewRowPresenter presenter, FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int adapterPosition, int selectedPosition, int selectedSubPosition)
Called to change DetailsOverviewRow view status when current selected row position
or selected sub position changed. Subclass may override. The default
implementation switches between three states based on the positions:
STATE_HALF
,
STATE_FULL
and
STATE_SMALL
.
Parameters | |
---|---|
presenter |
FullWidthDetailsOverviewRowPresenter : The presenter used to create row ViewHolder. |
viewHolder |
FullWidthDetailsOverviewRowPresenter.ViewHolder : The visible (attached) row ViewHolder, note that it may or may not
be selected. |
adapterPosition |
int : The adapter position of viewHolder inside adapter. |
selectedPosition |
int : The adapter position of currently selected row. |
selectedSubPosition |
int : The sub position within currently selected row. This is used
When a row has multiple alignment positions.
|
onSetRowStatus
void onSetRowStatus (RowPresenter presenter, RowPresenter.ViewHolder viewHolder, int adapterPosition, int selectedPosition, int selectedSubPosition)
Called on every visible row to change view status when current selected row position
or selected sub position changed. Subclass may override. The default
implementation calls onSetDetailsOverviewRowStatus(FullWidthDetailsOverviewRowPresenter, FullWidthDetailsOverviewRowPresenter.ViewHolder, int, int, int)
if presenter is
instance of FullWidthDetailsOverviewRowPresenter
.
Parameters | |
---|---|
presenter |
RowPresenter : The presenter used to create row ViewHolder. |
viewHolder |
RowPresenter.ViewHolder : The visible (attached) row ViewHolder, note that it may or may not
be selected. |
adapterPosition |
int : The adapter position of viewHolder inside adapter. |
selectedPosition |
int : The adapter position of currently selected row. |
selectedSubPosition |
int : The sub position within currently selected row. This is used
When a row has multiple alignment positions.
|
runEntranceTransition
void runEntranceTransition (Object entranceTransition)
Run entrance transition. Subclass may use TransitionManager to perform go(Scene) or beginDelayedTransition(). App should not override the default implementation of browse and details fragment.
Parameters | |
---|---|
entranceTransition |
Object |
setupDetailsOverviewRowPresenter
void setupDetailsOverviewRowPresenter (FullWidthDetailsOverviewRowPresenter presenter)
Called to setup FullWidthDetailsOverviewRowPresenter
. The default implementation
adds two alignment positions(ItemAlignmentFacet
) for ViewHolder of
FullWidthDetailsOverviewRowPresenter to align in fragment.
Parameters | |
---|---|
presenter |
FullWidthDetailsOverviewRowPresenter |
setupPresenter
void setupPresenter (Presenter rowPresenter)
Called to setup each Presenter of Adapter passed in setAdapter(ObjectAdapter)
.Note
that setup should only change the Presenter behavior that is meaningful in DetailsFragment.
For example how a row is aligned in details Fragment. The default implementation invokes
setupDetailsOverviewRowPresenter(FullWidthDetailsOverviewRowPresenter)
Parameters | |
---|---|
rowPresenter |
Presenter |
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