Package 

Class ExpandableList

  • All Implemented Interfaces:
    kotlin.collections.Collection , kotlin.collections.Iterable , kotlin.collections.List

    
    public final class ExpandableList<T extends Object>
     implements List<T>
                        

    A read-only, immutable list wrapper that supports expandable and collapsible behavior.

    This class behaves like a standard List but adds metadata and logic to control visibility of its elements based on a specified minimumVisibleItems threshold and current isCollapsed state.

    • When isCollapsed is true and the total item count exceeds minimumVisibleItems, only the first minimumVisibleItems items are exposed through the list interface. The remaining items are considered collapsed.

    • When isCollapsed is false, all items are exposed.

    • If the total number of items is less than or equal to minimumVisibleItems, all items are shown, and the list is not expandable.

    • Method Summary

      Modifier and Type Method Description
      final Boolean getCanExpand() Indicates whether the list can be expanded or collapsed, i.e.
      final Integer getCollapsedCount() The number of items that are currently collapsed (not visible).
      final Boolean getIsCollapsed()
      Integer getSize()
      • Methods inherited from class io.getstream.chat.android.ui.common.utils.ExpandableList

        addFirst, addLast, contains, containsAll, get, getFirst, getLast, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeFirst, removeLast, reversed, spliterator, subList
      • Methods inherited from class kotlin.collections.Collection

        forEach
      • Methods inherited from class kotlin.collections.List

        parallelStream, stream, toArray
      • Methods inherited from class java.lang.Object

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

      • ExpandableList

        ExpandableList(List<T> items, Integer minimumVisibleItems, Boolean isCollapsed)
        Parameters:
        items - the full list of items to wrap.
        minimumVisibleItems - the minimum number of items to show when collapsed.
        isCollapsed - whether the list is currently collapsed (hiding excess items).
    • Method Detail

      • getCanExpand

         final Boolean getCanExpand()

        Indicates whether the list can be expanded or collapsed, i.e., when the number of items exceeds minimumVisibleItems.

      • getCollapsedCount

         final Integer getCollapsedCount()

        The number of items that are currently collapsed (not visible). Returns 0 if the list is expanded or cannot be expanded.