-
public final class MessagesLazyListStateProvides a wrapper around lazy list state to be used with Messages composable. It is used to keep track of the focused message offset needed to center the focused message in the scroll list.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceMessagesLazyListState.MessageOffsetHandlerHandler that calculates the message offset that will be applied to the focused message. Implements Serializable so that it can be saved using Saver to persist the custom implementation of the handler across compositions.
public classMessagesLazyListState.Companion
-
Field Summary
Fields Modifier and Type Field Description private final IntegerfocusedMessageOffsetprivate final LazyListStatelazyListState
-
Constructor Summary
Constructors Constructor Description MessagesLazyListState(LazyListState lazyListState, MessagesLazyListState.MessageOffsetHandler messageOffsetHandler)
-
Method Summary
Modifier and Type Method Description final IntegergetFocusedMessageOffset()final LazyListStategetLazyListState()final UnitupdateParentSize(IntSize parentSize)Updates the list parent holder. final UnitupdateFocusedMessageSize(IntSize focusedMessageSize)Updates the size of the focused message. -
-
Constructor Detail
-
MessagesLazyListState
MessagesLazyListState(LazyListState lazyListState, MessagesLazyListState.MessageOffsetHandler messageOffsetHandler)
- Parameters:
lazyListState- State of the lazy list that represents the list of messages.messageOffsetHandler- The handler that calculates the focused message offset.
-
-
Method Detail
-
getFocusedMessageOffset
final Integer getFocusedMessageOffset()
-
getLazyListState
final LazyListState getLazyListState()
-
updateParentSize
final Unit updateParentSize(IntSize parentSize)
Updates the list parent holder. By default will update the size of Messages composable.
- Parameters:
parentSize- The size of the parent view.
-
updateFocusedMessageSize
final Unit updateFocusedMessageSize(IntSize focusedMessageSize)
Updates the size of the focused message.
- Parameters:
focusedMessageSize- The size of the message view we wish to focus to on the screen.
-
-
-
-