Package 

Class ArrayAnyAdapter

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Integer size() Returns the number of items in the adapter.
      Object get(Integer position)
      final Integer indexOf(Object item) Returns the index for the first occurrence of item in the adapter, or -1 if not found.
      final Unit notifyArrayItemRangeChanged(Integer positionStart, Integer itemCount) Notify that the content of a range of items changed.
      final Unit add(Object item) Adds an item to the end of the adapter.
      final Unit add(Integer index, Object item) Inserts an item into this adapter at the specified index.
      final Unit addAll(Integer index, Collection<Object> items) Adds the objects in the given collection to the adapter, starting at the given index.
      final Boolean remove(Object item) Removes the first occurrence of the given item from the adapter.
      final Unit move(Integer fromPosition, Integer toPosition) Moved the item at fromPosition to toPosition.
      final Unit replace(Integer position, Object item) Replaces item at position with a new item and calls notifyItemRangeChanged() at the given position.
      final Integer removeItems(Integer position, Integer count) Removes a range of items from the adapter.
      final Unit clear() Removes all items from this adapter, leaving it empty.
      final Unit setItems(List<Object> itemList, DiffCallback<Object> callback) Set a new item list to adapter.
      • Methods inherited from class de.pfaffenrodt.adapter.ArrayAnyAdapter

        getItemCount, getItemViewType, getPresenter, onBindViewHolder, onCreateViewHolder, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled
      • Methods inherited from class de.pfaffenrodt.adapter.AnyAdapter

        bindViewHolder, canRestoreState, createViewHolder, findRelativeAdapterPositionIn, getItemId, getStateRestorationPolicy, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, registerAdapterDataObserver, setHasStableIds, setStateRestorationPolicy, unregisterAdapterDataObserver
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArrayAnyAdapter

        ArrayAnyAdapter(Presenter presenter)
        Constructs an adapter that uses the given Presenter for all items.
      • ArrayAnyAdapter

        ArrayAnyAdapter()
        Constructs an adapter.
    • Method Detail

      • size

         Integer size()

        Returns the number of items in the adapter.

      • indexOf

         final Integer indexOf(Object item)

        Returns the index for the first occurrence of item in the adapter, or -1 if not found.

        Parameters:
        item - The item to find in the list.
      • notifyArrayItemRangeChanged

         final Unit notifyArrayItemRangeChanged(Integer positionStart, Integer itemCount)

        Notify that the content of a range of items changed. Note that this is not same as items being added or removed.

        Parameters:
        positionStart - The position of first item that has changed.
        itemCount - The count of how many items have changed.
      • add

         final Unit add(Object item)

        Adds an item to the end of the adapter.

        Parameters:
        item - The item to add to the end of the adapter.
      • add

         final Unit add(Integer index, Object item)

        Inserts an item into this adapter at the specified index. If the index is .getItemCount an exception will be thrown.

        Parameters:
        index - The index at which the item should be inserted.
        item - The item to insert into the adapter.
      • addAll

         final Unit addAll(Integer index, Collection<Object> items)

        Adds the objects in the given collection to the adapter, starting at the given index. If the index is >= .getItemCount an exception will be thrown.

        Parameters:
        index - The index at which the items should be inserted.
        items - A Collection of items to insert.
      • remove

         final Boolean remove(Object item)

        Removes the first occurrence of the given item from the adapter.

        Parameters:
        item - The item to remove from the adapter.
      • move

         final Unit move(Integer fromPosition, Integer toPosition)

        Moved the item at fromPosition to toPosition.

        Parameters:
        fromPosition - Previous position of the item.
        toPosition - New position of the item.
      • replace

         final Unit replace(Integer position, Object item)

        Replaces item at position with a new item and calls notifyItemRangeChanged() at the given position. Note that this method does not compare new item to existing item.

        Parameters:
        position - The index of item to replace.
        item - The new item to be placed at given position.
      • removeItems

         final Integer removeItems(Integer position, Integer count)

        Removes a range of items from the adapter. The range is specified by giving the starting position and the number of elements to remove.

        Parameters:
        position - The index of the first item to remove.
        count - The number of items to remove.
      • clear

         final Unit clear()

        Removes all items from this adapter, leaving it empty.

      • setItems

         final Unit setItems(List<Object> itemList, DiffCallback<Object> callback)

        Set a new item list to adapter. The DiffUtil will compute the difference and dispatch it to specified position.

        Parameters:
        itemList - List of new Items
        callback - Optional DiffCallback Object to compute the difference between the old data set and new data set.