class ClipAdapter extends BaseBindingAdapter<Clip,com.weebly.opus1269.clipman.databinding.ClipRowBinding,MainHandlers,ClipViewModel,ClipAdapter.ClipViewHolder>
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ClipAdapter.ClipViewHolder
Our ViewHolder
|
(package private) static class |
ClipAdapter.ClipViewHolderFactory
Factory to create an instance of our ViewHolder
|
(package private) static class |
ClipAdapter.ClipViewModelFactory
Factory to create an instance of our ViewModel
|
Modifier and Type | Field and Description |
---|---|
private MainActivity |
mActivity
Our Activity
|
private java.util.List<Clip> |
mList
Our List
|
mLifecycleOwner
Constructor and Description |
---|
ClipAdapter(MainActivity activity,
MainHandlers handlers) |
Modifier and Type | Method and Description |
---|---|
private ClipAdapter.ClipViewHolder |
getHolder(Clip clip) |
private int |
getSelectedPos(java.util.List<Clip> clips,
Clip selClip) |
private boolean |
idChanged(Clip clip1,
Clip clip2) |
void |
onBindViewHolder(ClipAdapter.ClipViewHolder holder,
int position) |
boolean |
select(Clip newSel,
Clip oldSel) |
private void |
setSelected(Clip clip,
boolean isSelected) |
void |
submitList(java.util.List<Clip> list)
Pass a new List to the AdapterHelper.
|
getItemCount, getItemId, onCreateViewHolder
bindViewHolder, createViewHolder, getItemViewType, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver
@NonNull private final MainActivity mActivity
@Nullable private java.util.List<Clip> mList
ClipAdapter(@NonNull MainActivity activity, MainHandlers handlers)
public void onBindViewHolder(@NonNull ClipAdapter.ClipViewHolder holder, int position)
onBindViewHolder
in class BaseBindingAdapter<Clip,com.weebly.opus1269.clipman.databinding.ClipRowBinding,MainHandlers,ClipViewModel,ClipAdapter.ClipViewHolder>
public void submitList(java.util.List<Clip> list)
BaseBindingAdapter
If a List is already present, a diff will be computed asynchronously on a background thread. When the diff is computed, it will be applied, and the new List will be swapped in.
submitList
in class BaseBindingAdapter<Clip,com.weebly.opus1269.clipman.databinding.ClipRowBinding,MainHandlers,ClipViewModel,ClipAdapter.ClipViewHolder>
list
- The new List.private void setSelected(@Nullable Clip clip, boolean isSelected)
private int getSelectedPos(@Nullable java.util.List<Clip> clips, @Nullable Clip selClip)
@Nullable private ClipAdapter.ClipViewHolder getHolder(@Nullable Clip clip)