LeanbackListPreferenceDialogFragment.AdapterSingle


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


Adapter for single choice.

Summary

Public constructors

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

This method is deprecated. Deprecated in Java

Public methods

int

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

LeanbackListPreferenceDialogFragment.ViewHolder
onCreateViewHolder(ViewGroup parent, int viewType)

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

Inherited methods

From androidx.recyclerview.widget.RecyclerView.Adapter
final void
bindViewHolder(@NonNull VH holder, int position)

This method is deprecated. Deprecated in Java

final @NonNull VH
createViewHolder(@NonNull ViewGroup parent, int viewType)

This method is deprecated. Deprecated in Java

int
findRelativeAdapterPositionIn(
    @NonNull RecyclerView.Adapter<RecyclerView.ViewHolder> adapter,
    @NonNull RecyclerView.ViewHolder viewHolder,
    int localPosition
)

This method is deprecated. Deprecated in Java

long
getItemId(int position)

This method is deprecated. Deprecated in Java

int
getItemViewType(int position)

This method is deprecated. Deprecated in Java

final @NonNull RecyclerView.Adapter.StateRestorationPolicy

This method is deprecated. Deprecated in Java

final boolean

This method is deprecated. Deprecated in Java

final boolean

This method is deprecated. Deprecated in Java

final void

This method is deprecated. Deprecated in Java

final void
notifyItemChanged(int position)

This method is deprecated. Deprecated in Java

final void
notifyItemChanged(int position, @Nullable Object payload)

This method is deprecated. Deprecated in Java

final void
notifyItemInserted(int position)

This method is deprecated. Deprecated in Java

final void
notifyItemMoved(int fromPosition, int toPosition)

This method is deprecated. Deprecated in Java

final void
notifyItemRangeChanged(int positionStart, int itemCount)

This method is deprecated. Deprecated in Java

final void
notifyItemRangeChanged(
    int positionStart,
    int itemCount,
    @Nullable Object payload
)

This method is deprecated. Deprecated in Java

final void
notifyItemRangeInserted(int positionStart, int itemCount)

This method is deprecated. Deprecated in Java

final void
notifyItemRangeRemoved(int positionStart, int itemCount)

This method is deprecated. Deprecated in Java

final void
notifyItemRemoved(int position)

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void
onBindViewHolder(
    @NonNull VH holder,
    int position,
    @NonNull List<Object> payloads
)

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

boolean

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void
onViewRecycled(@NonNull VH holder)

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void
setHasStableIds(boolean hasStableIds)

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

Public constructors

AdapterSingle

Added in 1.1.0
Deprecated in 1.1.0
public AdapterSingle(
    CharSequence[] entries,
    CharSequence[] entryValues,
    CharSequence selectedValue
)

Public methods

getItemCount

Added in 1.1.0
Deprecated in 1.1.0
public 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 1.1.0
Deprecated in 1.1.0
public 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 android.widget.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 getBindingAdapterPosition which will have the updated adapter position. Override onBindViewHolder instead if Adapter can handle efficient partial bind.

Parameters
LeanbackListPreferenceDialogFragment.ViewHolder holder

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

int position

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

onCreateViewHolder

Added in 1.1.0
Deprecated in 1.1.0
public LeanbackListPreferenceDialogFragment.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)

Called when RecyclerView needs a new 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. 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 calls.

Parameters
ViewGroup parent

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

int viewType

The view type of the new View.

Returns
LeanbackListPreferenceDialogFragment.ViewHolder

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

onItemClick

public void onItemClick(
    LeanbackListPreferenceDialogFragment.ViewHolder viewHolder
)