Created
April 4, 2019 18:10
-
-
Save EmmanuelGuther/df05df6777489c6ee3188dcfccee43bc to your computer and use it in GitHub Desktop.
Kotlin pass a function as parameter and execute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal fun handleChatMessages(messages: List<MessageModel>?) { | |
| hideProgress() | |
| adapter.collection = messages.orEmpty() | |
| animate { runLayoutAnimation() } | |
| } | |
| private fun animate(function: () -> Unit) { | |
| when { | |
| firstTimeCreated -> function.invoke() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment