added in version 24.1.0
belongs to Maven artifact com.android.support:preference-leanback-v17:28.0.0-alpha1

LeanbackListPreferenceDialogFragment.AdapterSingle

public class LeanbackListPreferenceDialogFragment.AdapterSingle
extends Adapter<LeanbackListPreferenceDialogFragment.ViewHolder> implements LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener

java.lang.Object
   ↳ android.support.v7.widget.RecyclerView.Adapter<android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder>
     ↳ android.support.v17.preference.LeanbackListPreferenceDialogFragment.AdapterSingle


Summary

Public constructors

LeanbackListPreferenceDialogFragment.AdapterSingle(CharSequence[] entries, CharSequence[] entryValues, CharSequence selectedValue)

Public methods

int getItemCount()

Returns the total number of items in the data set held by the adapter.

void onBindViewHolder(LeanbackListPreferenceDialogFragment.ViewHolder holder, int position)

Called by RecyclerView to display the data at the specified position.

LeanbackListPreferenceDialogFragment.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)

Called when RecyclerView needs a new RecyclerView.ViewHolder of the given type to represent an item.

void onItemClick(LeanbackListPreferenceDialogFragment.ViewHolder viewHolder)

Inherited methods

From class android.support.v7.widget.RecyclerView.Adapter
From class java.lang.Object
From interface android.support.v17.preference.LeanbackListPreferenceDialogFragment.ViewHolder.OnItemClickListener

Public constructors

LeanbackListPreferenceDialogFragment.AdapterSingle

added in version 24.1.0
LeanbackListPreferenceDialogFragment.AdapterSingle (CharSequence[] entries, 
                CharSequence[] entryValues, 
                CharSequence selectedValue)

Parameters
entries CharSequence

entryValues CharSequence

selectedValue CharSequence

Public methods

getItemCount

added in version 24.1.0
int getItemCount ()

Returns the total number of items in the data set held by the adapter.

Returns
int The total number of items in this adapter.

onBindViewHolder

added in version 24.1.0
void onBindViewHolder (LeanbackListPreferenceDialogFragment.ViewHolder holder, 
                int position)

Called by RecyclerView to display the data at the specified position. This method should update the contents of the itemView to reflect the item at the given position.

Note that unlike ListView, RecyclerView will not call this method again if the position of the item changes in the data set unless the item itself is invalidated or the new position cannot be determined. For this reason, you should only use the position parameter while acquiring the related data item inside this method and should not keep a copy of it. If you need the position of an item later on (e.g. in a click listener), use getAdapterPosition() which will have the updated adapter position. Override onBindViewHolder(ViewHolder, int, List) instead if Adapter can handle efficient partial bind.

Parameters
holder LeanbackListPreferenceDialogFragment.ViewHolder: The ViewHolder which should be updated to represent the contents of the item at the given position in the data set.

position int: The position of the item within the adapter's data set.

onCreateViewHolder

added in version 24.1.0
LeanbackListPreferenceDialogFragment.ViewHolder onCreateViewHolder (ViewGroup parent, 
                int viewType)

Called when RecyclerView needs a new RecyclerView.ViewHolder of the given type to represent an item.

This new ViewHolder should be constructed with a new View that can represent the items of the given type. You can either create a new View manually or inflate it from an XML layout file.

The new ViewHolder will be used to display items of the adapter using onBindViewHolder(ViewHolder, int, List). Since it will be re-used to display different items in the data set, it is a good idea to cache references to sub views of the View to avoid unnecessary findViewById(int) calls.

Parameters
parent ViewGroup: The ViewGroup into which the new View will be added after it is bound to an adapter position.

viewType int: The view type of the new View.

Returns
LeanbackListPreferenceDialogFragment.ViewHolder A new ViewHolder that holds a View of the given view type.

onItemClick

added in version 24.1.0
void onItemClick (LeanbackListPreferenceDialogFragment.ViewHolder viewHolder)

Parameters
viewHolder LeanbackListPreferenceDialogFragment.ViewHolder