Skip to content

Instantly share code, notes, and snippets.

@samiuelson
Created May 6, 2020 14:42
Show Gist options
  • Save samiuelson/c24dd4f4ec3223274c3cce045ac7ddab to your computer and use it in GitHub Desktop.
Save samiuelson/c24dd4f4ec3223274c3cce045ac7ddab to your computer and use it in GitHub Desktop.
private fun updateMessagesList(messages: List<Message>) {
adapter.submitList(messages)
adapter.notifyDataSetChanged()
val scrollTarget = adapter.itemCount
messageListSmoothScroller.targetPosition = scrollTarget
messagesList.layoutManager?.startSmoothScroll(messageListSmoothScroller)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment