belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
ObjectAdapter
public
abstract
class
ObjectAdapter
extends Object
java.lang.Object | |
↳ | android.support.v17.leanback.widget.ObjectAdapter |
Known Direct Subclasses |
Base class adapter to be used in leanback activities. Provides access to a data model and is
decoupled from the presentation of the items via PresenterSelector
.
Summary
Nested classes | |
---|---|
class |
ObjectAdapter.DataObserver
A DataObserver can be notified when an ObjectAdapter's underlying data changes. |
Constants | |
---|---|
int |
NO_ID
Indicates that an id has not been set. |
Public constructors | |
---|---|
ObjectAdapter(PresenterSelector presenterSelector)
Constructs an adapter with the given |
|
ObjectAdapter(Presenter presenter)
Constructs an adapter that uses the given |
|
ObjectAdapter()
Constructs an adapter. |
Public methods | |
---|---|
abstract
Object
|
get(int position)
Returns the item for the given position. |
long
|
getId(int position)
Returns the id for the given position. |
final
Presenter
|
getPresenter(Object item)
Returns the |
final
PresenterSelector
|
getPresenterSelector()
Returns the presenter selector for this ObjectAdapter. |
final
boolean
|
hasStableIds()
Returns true if the item ids are stable across changes to the underlying data. |
boolean
|
isImmediateNotifySupported()
Returns true if the adapter pairs each underlying data change with a call to notify and false otherwise. |
final
void
|
notifyItemRangeChanged(int positionStart, int itemCount, Object payload)
Notifies UI that some items has changed. |
final
void
|
notifyItemRangeChanged(int positionStart, int itemCount)
Notifies UI that some items has changed. |
final
void
|
registerObserver(ObjectAdapter.DataObserver observer)
Registers a DataObserver for data change notifications. |
final
void
|
setHasStableIds(boolean hasStableIds)
Sets whether the item ids are stable across changes to the underlying data. |
final
void
|
setPresenterSelector(PresenterSelector presenterSelector)
Sets the presenter selector. |
abstract
int
|
size()
Returns the number of items in the adapter. |
final
void
|
unregisterAllObservers()
Unregisters all DataObservers for this ObjectAdapter. |
final
void
|
unregisterObserver(ObjectAdapter.DataObserver observer)
Unregisters a DataObserver for data change notifications. |
Protected methods | |
---|---|
final
void
|
notifyChanged()
Notifies UI that the underlying data has changed. |
final
void
|
notifyItemMoved(int fromPosition, int toPosition)
Notifies UI that item at fromPosition has been moved to toPosition. |
final
void
|
notifyItemRangeInserted(int positionStart, int itemCount)
Notifies UI that new items has been inserted. |
final
void
|
notifyItemRangeRemoved(int positionStart, int itemCount)
Notifies UI that some items that has been removed. |
void
|
onHasStableIdsChanged()
Called when |
void
|
onPresenterSelectorChanged()
Called when |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Constants
NO_ID
int NO_ID
Indicates that an id has not been set.
Constant Value: -1 (0xffffffff)
Public constructors
ObjectAdapter
ObjectAdapter (PresenterSelector presenterSelector)
Constructs an adapter with the given PresenterSelector
.
Parameters | |
---|---|
presenterSelector |
PresenterSelector |
ObjectAdapter
ObjectAdapter (Presenter presenter)
Constructs an adapter that uses the given Presenter
for all items.
Parameters | |
---|---|
presenter |
Presenter |
Public methods
get
Object get (int position)
Returns the item for the given position.
Parameters | |
---|---|
position |
int |
Returns | |
---|---|
Object |
getId
long getId (int position)
Returns the id for the given position.
Parameters | |
---|---|
position |
int |
Returns | |
---|---|
long |
getPresenter
Presenter getPresenter (Object item)
Returns the Presenter
for the given item from the adapter.
Parameters | |
---|---|
item |
Object |
Returns | |
---|---|
Presenter |
getPresenterSelector
PresenterSelector getPresenterSelector ()
Returns the presenter selector for this ObjectAdapter.
Returns | |
---|---|
PresenterSelector |
hasStableIds
boolean hasStableIds ()
Returns true if the item ids are stable across changes to the
underlying data. When this is true, clients of the ObjectAdapter can use
getId(int)
to correlate Objects across changes.
Returns | |
---|---|
boolean |
isImmediateNotifySupported
boolean isImmediateNotifySupported ()
Returns true if the adapter pairs each underlying data change with a call to notify and false otherwise.
Returns | |
---|---|
boolean |
notifyItemRangeChanged
void notifyItemRangeChanged (int positionStart, int itemCount, Object payload)
Notifies UI that some items has changed.
Parameters | |
---|---|
positionStart |
int : Starting position of the changed items. |
itemCount |
int : Total number of items that changed. |
payload |
Object : Optional parameter, use null to identify a "full" update.
|
notifyItemRangeChanged
void notifyItemRangeChanged (int positionStart, int itemCount)
Notifies UI that some items has changed.
Parameters | |
---|---|
positionStart |
int : Starting position of the changed items. |
itemCount |
int : Total number of items that changed.
|
registerObserver
void registerObserver (ObjectAdapter.DataObserver observer)
Registers a DataObserver for data change notifications.
Parameters | |
---|---|
observer |
ObjectAdapter.DataObserver |
setHasStableIds
void setHasStableIds (boolean hasStableIds)
Sets whether the item ids are stable across changes to the underlying data.
Parameters | |
---|---|
hasStableIds |
boolean |
setPresenterSelector
void setPresenterSelector (PresenterSelector presenterSelector)
Sets the presenter selector. May not be null.
Parameters | |
---|---|
presenterSelector |
PresenterSelector |
unregisterAllObservers
void unregisterAllObservers ()
Unregisters all DataObservers for this ObjectAdapter.
unregisterObserver
void unregisterObserver (ObjectAdapter.DataObserver observer)
Unregisters a DataObserver for data change notifications.
Parameters | |
---|---|
observer |
ObjectAdapter.DataObserver |
Protected methods
notifyChanged
void notifyChanged ()
Notifies UI that the underlying data has changed.
notifyItemMoved
void notifyItemMoved (int fromPosition, int toPosition)
Notifies UI that item at fromPosition has been moved to toPosition.
Parameters | |
---|---|
fromPosition |
int : Previous position of the item. |
toPosition |
int : New position of the item.
|
notifyItemRangeInserted
void notifyItemRangeInserted (int positionStart, int itemCount)
Notifies UI that new items has been inserted.
Parameters | |
---|---|
positionStart |
int : Position where new items has been inserted. |
itemCount |
int : Count of the new items has been inserted.
|
notifyItemRangeRemoved
void notifyItemRangeRemoved (int positionStart, int itemCount)
Notifies UI that some items that has been removed.
Parameters | |
---|---|
positionStart |
int : Starting position of the removed items. |
itemCount |
int : Total number of items that has been removed.
|
onHasStableIdsChanged
void onHasStableIdsChanged ()
Called when setHasStableIds(boolean)
is called and the status
of stable ids has changed.
onPresenterSelectorChanged
void onPresenterSelectorChanged ()
Called when setPresenterSelector(PresenterSelector)
is called
and the PresenterSelector differs from the previous one.
Interfaces
- BaseGridView.OnKeyInterceptListener
- BaseGridView.OnMotionInterceptListener
- BaseGridView.OnTouchInterceptListener
- BaseGridView.OnUnhandledKeyListener
- BaseOnItemViewClickedListener
- BaseOnItemViewSelectedListener
- BrowseFrameLayout.OnChildFocusListener
- BrowseFrameLayout.OnFocusSearchListener
- FacetProvider
- FacetProviderAdapter
- FocusHighlight
- FragmentAnimationProvider
- ImeKeyMonitor
- ImeKeyMonitor.ImeKeyListener
- MultiActionsProvider
- OnActionClickedListener
- OnChildLaidOutListener
- OnChildSelectedListener
- OnItemViewClickedListener
- OnItemViewSelectedListener
- PlaybackSeekUi
- SearchBar.SearchBarListener
- SearchBar.SearchBarPermissionListener
- SearchEditText.OnKeyboardDismissListener
- SpeechRecognitionCallback
- TitleViewAdapter.Provider
- ViewHolderTask
Classes
- AbstractDetailsDescriptionPresenter
- AbstractDetailsDescriptionPresenter.ViewHolder
- AbstractMediaItemPresenter
- AbstractMediaItemPresenter.ViewHolder
- AbstractMediaListHeaderPresenter
- AbstractMediaListHeaderPresenter.ViewHolder
- Action
- ArrayObjectAdapter
- BaseCardView
- BaseCardView.LayoutParams
- BaseGridView
- BrowseFrameLayout
- ClassPresenterSelector
- ControlButtonPresenterSelector
- CursorObjectAdapter
- DetailsOverviewLogoPresenter
- DetailsOverviewLogoPresenter.ViewHolder
- DetailsOverviewRow
- DetailsOverviewRow.Listener
- DetailsOverviewRowPresenter
- DetailsOverviewRowPresenter.ViewHolder
- DetailsParallax
- DiffCallback
- DividerPresenter
- DividerRow
- FocusHighlightHelper
- FullWidthDetailsOverviewRowPresenter
- FullWidthDetailsOverviewRowPresenter.Listener
- FullWidthDetailsOverviewRowPresenter.ViewHolder
- FullWidthDetailsOverviewRowPresenter.ViewHolder.DetailsOverviewRowListener
- FullWidthDetailsOverviewSharedElementHelper
- GuidanceStylist
- GuidanceStylist.Guidance
- GuidedAction
- GuidedAction.Builder
- GuidedAction.BuilderBase
- GuidedActionDiffCallback
- GuidedActionEditText
- GuidedActionsStylist
- GuidedActionsStylist.ViewHolder
- GuidedDatePickerAction
- GuidedDatePickerAction.Builder
- GuidedDatePickerAction.BuilderBase
- HeaderItem
- HorizontalGridView
- HorizontalHoverCardSwitcher
- ImageCardView
- ItemAlignmentFacet
- ItemAlignmentFacet.ItemAlignmentDef
- ItemBridgeAdapter
- ItemBridgeAdapter.AdapterListener
- ItemBridgeAdapter.ViewHolder
- ItemBridgeAdapter.Wrapper
- ItemBridgeAdapterShadowOverlayWrapper
- ListRow
- ListRowHoverCardView
- ListRowPresenter
- ListRowPresenter.SelectItemViewHolderTask
- ListRowPresenter.ViewHolder
- ListRowView
- MultiActionsProvider.MultiAction
- ObjectAdapter
- ObjectAdapter.DataObserver
- OnChildViewHolderSelectedListener
- PageRow
- Parallax
- Parallax.FloatProperty
- Parallax.IntProperty
- Parallax.PropertyMarkerValue
- ParallaxEffect
- ParallaxTarget
- ParallaxTarget.DirectPropertyTarget
- ParallaxTarget.PropertyValuesHolderTarget
- PlaybackControlsRow
- PlaybackControlsRow.ClosedCaptioningAction
- PlaybackControlsRow.FastForwardAction
- PlaybackControlsRow.HighQualityAction
- PlaybackControlsRow.MoreActions
- PlaybackControlsRow.MultiAction
- PlaybackControlsRow.OnPlaybackProgressCallback
- PlaybackControlsRow.PictureInPictureAction
- PlaybackControlsRow.PlayPauseAction
- PlaybackControlsRow.RepeatAction
- PlaybackControlsRow.RewindAction
- PlaybackControlsRow.ShuffleAction
- PlaybackControlsRow.SkipNextAction
- PlaybackControlsRow.SkipPreviousAction
- PlaybackControlsRow.ThumbsAction
- PlaybackControlsRow.ThumbsDownAction
- PlaybackControlsRow.ThumbsUpAction
- PlaybackControlsRowPresenter
- PlaybackControlsRowPresenter.ViewHolder
- PlaybackRowPresenter
- PlaybackRowPresenter.ViewHolder
- PlaybackSeekDataProvider
- PlaybackSeekDataProvider.ResultCallback
- PlaybackSeekUi.Client
- PlaybackTransportRowPresenter
- PlaybackTransportRowPresenter.ViewHolder
- Presenter
- Presenter.ViewHolder
- Presenter.ViewHolderTask
- PresenterSelector
- PresenterSwitcher
- RecyclerViewParallax
- RecyclerViewParallax.ChildPositionProperty
- Row
- RowHeaderPresenter
- RowHeaderPresenter.ViewHolder
- RowHeaderView
- RowPresenter
- RowPresenter.ViewHolder
- SearchBar
- SearchEditText
- SearchOrbView
- SearchOrbView.Colors
- SectionRow
- ShadowOverlayContainer
- ShadowOverlayHelper
- ShadowOverlayHelper.Builder
- ShadowOverlayHelper.Options
- SinglePresenterSelector
- SparseArrayObjectAdapter
- SpeechOrbView
- TitleHelper
- TitleView
- TitleViewAdapter
- VerticalGridPresenter
- VerticalGridPresenter.ViewHolder
- VerticalGridView
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.