Package 

Class ExpandableViewHolder

  • All Implemented Interfaces:
    android.view.View.OnClickListener , android.view.View.OnLongClickListener , android.view.View.OnTouchListener , eu.davidea.flexibleadapter.helpers.ItemTouchHelperCallback.ViewHolderCallback

    
    public abstract class ExpandableViewHolder
    extends FlexibleViewHolder
                        

    ViewHolder for a Expandable Items. It holds methods which can be used to trigger expansion or collapsing events.

    This class extends FlexibleViewHolder, which means it will benefit of all implemented methods the super class holds.

    • Method Summary

      Modifier and Type Method Description
      void onClick(View view) Called when user taps once on the ItemView.
      boolean onLongClick(View view) Called when user long taps on this itemView.
      void onActionStateChanged(int position, int actionState) Here we handle the event of when the ItemTouchHelper} first registers an itemas being moved or swiped.
      • Methods inherited from class eu.davidea.viewholders.FlexibleViewHolder

        getActivationElevation, getFrontView, getRearLeftView, getRearRightView, isDraggable, isSwipeable, onItemReleased, onTouch, scrollAnimators, setFullSpan, toggleActivation
      • Methods inherited from class eu.davidea.viewholders.ContentViewHolder

        getContentView, getFlexibleAdapterPosition, setBackupPosition
      • Methods inherited from class androidx.recyclerview.widget.RecyclerView.ViewHolder

        getAbsoluteAdapterPosition, getAdapterPosition, getBindingAdapter, getBindingAdapterPosition, getItemId, getItemViewType, getLayoutPosition, getOldPosition, getPosition, isRecyclable, setIsRecyclable, toString
      • Methods inherited from class android.view.View.OnClickListener

        onClick
      • Methods inherited from class android.view.View.OnLongClickListener

        onLongClick, onLongClickUseDefaultHapticFeedback
      • Methods inherited from class android.view.View.OnTouchListener

        onTouch
      • Methods inherited from class java.lang.Object

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

      • ExpandableViewHolder

        ExpandableViewHolder(View view, FlexibleAdapter adapter)
        Default constructor.
        Parameters:
        view - The View being hosted in this ViewHolder
        adapter - Adapter instance of type FlexibleAdapter
      • ExpandableViewHolder

        ExpandableViewHolder(View view, FlexibleAdapter adapter, boolean stickyHeader)
        Constructor to configure the sticky behaviour of a view.
        Parameters:
        view - The View being hosted in this ViewHolder
        adapter - Adapter instance of type FlexibleAdapter
        stickyHeader - true if the View can be a Sticky Header, false otherwise
    • Method Detail

      • onClick

        @CallSuper() void onClick(View view)

        Called when user taps once on the ItemView.

        Note: In Expandable version, it tries to expand, but before,it checks if the view isViewExpandableOnClick.

        Parameters:
        view - the view that receives the event
      • onLongClick

        @CallSuper() boolean onLongClick(View view)

        Called when user long taps on this itemView.

        Note: In Expandable version, it tries to collapse, but before,it checks if the view isViewCollapsibleOnLongClick.

        Parameters:
        view - the view that receives the event
      • onActionStateChanged

        @CallSuper() void onActionStateChanged(int position, int actionState)

        Here we handle the event of when the ItemTouchHelper} first registers an itemas being moved or swiped.

        In this implementation, View activation is automatically handled if dragged: The Itemwill be added to the selection list if not selected yet and mode MULTI is activated.

        Note: In the Expandable version, expanded items are forced to collapse.