Package 

Interface IFlexible

    • Method Summary

      Modifier and Type Method Description
      abstract boolean isEnabled() Returns if the Item is enabled.
      abstract void setEnabled(boolean enabled) Setter to change enabled behaviour.
      abstract boolean isHidden() (Internal usage).When and item has been deleted (with Undo) or has been filtered out by theadapter, then, it has hidden status.
      abstract void setHidden(boolean hidden) Setter to change hidden behaviour.
      abstract int getSpanSize(int spanCount, int position) Individual item's span size to use only with {@code GridLayoutManager}.
      abstract boolean shouldNotifyChange(IFlexible newItem) Called by the FlexibleAdapter when it wants to check if this item should be boundagain with new content.
      abstract boolean isSelectable() Checks if the item can be selected.
      abstract void setSelectable(boolean selectable) Setter to change selectable behaviour.
      abstract String getBubbleText(int position) Custom bubble text for FastScroller.
      abstract boolean isDraggable()
      abstract void setDraggable(boolean draggable)
      abstract boolean isSwipeable()
      abstract void setSwipeable(boolean swipeable)
      abstract int getItemViewType() Identifies a specific view type for this item, used by FlexibleAdapter to auto-mapthe ViewTypes.
      abstract int getLayoutRes() Returns the layout resource ID to auto-inflate the View for this item.
      abstract VH createViewHolder(View view, FlexibleAdapter<IFlexible> adapter) Delegates the creation of the ViewHolder to the user (AutoMap).
      abstract void bindViewHolder(FlexibleAdapter<IFlexible> adapter, VH holder, int position, List<Object> payloads) Delegates the binding of this item's data to the given Layout.
      abstract void unbindViewHolder(FlexibleAdapter<IFlexible> adapter, VH holder, int position) Called when a view created by this adapter has been recycled.
      abstract void onViewAttached(FlexibleAdapter<IFlexible> adapter, VH holder, int position) Called when a view created by this adapter has been attached to a window.
      abstract void onViewDetached(FlexibleAdapter<IFlexible> adapter, VH holder, int position) Called when a view created by this adapter has been detached from its window.
      • Methods inherited from class java.lang.Object

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

      • isEnabled

         abstract boolean isEnabled()

        Returns if the Item is enabled.

      • setEnabled

         abstract void setEnabled(boolean enabled)

        Setter to change enabled behaviour.

        Parameters:
        enabled - false to disable all operations on this item
      • isHidden

         abstract boolean isHidden()

        (Internal usage).When and item has been deleted (with Undo) or has been filtered out by theadapter, then, it has hidden status.

      • setHidden

         abstract void setHidden(boolean hidden)

        Setter to change hidden behaviour. Useful while filtering this item.Default value is false.

        Parameters:
        hidden - true if this item should remain hidden, false otherwise
      • getSpanSize

         abstract int getSpanSize(int spanCount, int position)

        Individual item's span size to use only with {@code GridLayoutManager}.

        Note:

        • Default implementation in AbstractFlexibleItem already returns 1.
        • Not used when {@code StaggeredGridLayoutManager} is set. With such layout use setFullSpan.
        Parameters:
        spanCount - current column count
        position - the adapter position of the item
      • shouldNotifyChange

         abstract boolean shouldNotifyChange(IFlexible newItem)

        Called by the FlexibleAdapter when it wants to check if this item should be boundagain with new content.

        You should return {@code true} whether you want this item will be updated becauseits visual representations will change.

        Note: This method won't be called if setNotifyChangeOfUnfilteredItems is disabled.

        Default value is {@code true}.

        Parameters:
        newItem - The new item object with the new content
      • isSelectable

         abstract boolean isSelectable()

        Checks if the item can be selected.

      • setSelectable

         abstract void setSelectable(boolean selectable)

        Setter to change selectable behaviour.

        Parameters:
        selectable - false to disable selection on this item
      • getBubbleText

         abstract String getBubbleText(int position)

        Custom bubble text for FastScroller.

        To be called from the implementation of {@code onCreateBubbleText()}. Example:

        public String onCreateBubbleText(int position) {
            return getItem(position).getBubbleText(position);
        }
        Parameters:
        position - the current mapped position
      • setDraggable

         abstract void setDraggable(boolean draggable)
      • setSwipeable

         abstract void setSwipeable(boolean swipeable)
      • getItemViewType

         abstract int getItemViewType()

        Identifies a specific view type for this item, used by FlexibleAdapter to auto-mapthe ViewTypes.

        HELP: To know how to implement AutoMap for ViewTypes please refer to theFlexibleAdapter Wiki Pageon GitHub.

      • getLayoutRes

        @LayoutRes() abstract int getLayoutRes()

        Returns the layout resource ID to auto-inflate the View for this item. Optionally, youcan assign same layout for multiple item types, but getItemViewType mustreturn unique values!

        NOTE: Should identify a resource Layout reference android.R.layout.

      • createViewHolder

         abstract VH createViewHolder(View view, FlexibleAdapter<IFlexible> adapter)

        Delegates the creation of the ViewHolder to the user (AutoMap).

        HELP: To know how to implement AutoMap for ViewTypes please refer to theFlexibleAdapter Wiki Pageon GitHub.

        Parameters:
        view - the already inflated view
        adapter - the Adapter instance extending FlexibleAdapter
      • bindViewHolder

         abstract void bindViewHolder(FlexibleAdapter<IFlexible> adapter, VH holder, int position, List<Object> payloads)

        Delegates the binding of this item's data to the given Layout.

        HELP: To know how to implement AutoMap for ViewTypes please refer to theFlexibleAdapter Wiki Pageon GitHub.

        How to use Payload, please refer to onBindViewHolder.
        Parameters:
        adapter - the FlexibleAdapter instance
        holder - the ViewHolder instance
        position - the current position
        payloads - a non-null list of merged payloads.
      • unbindViewHolder

         abstract void unbindViewHolder(FlexibleAdapter<IFlexible> adapter, VH holder, int position)

        Called when a view created by this adapter has been recycled.

        A view is recycled when a {@code RecyclerView.LayoutManager} decides that it no longerneeds to be attached to its parent RecyclerView. This can be because it has fallen outof visibility or a set of cached views represented by views still attached to the parentRecyclerView.

        If an item view has large or expensive data bound to it such as large bitmaps, this may bea good place to release those resources.
        Parameters:
        adapter - the FlexibleAdapter instance
        holder - the ViewHolder instance being recycled
        position - the current position
      • onViewAttached

         abstract void onViewAttached(FlexibleAdapter<IFlexible> adapter, VH holder, int position)

        Called when a view created by this adapter has been attached to a window.

        This can be used as a reasonable signal that the view is about to be seen by the user.

        Parameters:
        adapter - the FlexibleAdapter instance
        holder - the ViewHolder instance being recycled
        position - the current position
      • onViewDetached

         abstract void onViewDetached(FlexibleAdapter<IFlexible> adapter, VH holder, int position)

        Called when a view created by this adapter has been detached from its window.

        Becoming detached from the window is not necessarily a permanent condition; the consumer of anAdapter's views may choose to cache views offscreen while they are not visible, attaching anddetaching them as appropriate.

        Parameters:
        adapter - the FlexibleAdapter instance
        holder - the ViewHolder instance being recycled
        position - the current position