Skip to content

Instantly share code, notes, and snippets.

@micer
Created March 14, 2018 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micer/ae156e15b3b0650fb93181429551788e to your computer and use it in GitHub Desktop.
Save micer/ae156e15b3b0650fb93181429551788e to your computer and use it in GitHub Desktop.
I'll put useful Kotlin Extension Functions here
private inline fun <T> TextView.updateOrHide(content: T?, action: TextView.(content: T) -> Unit) {
if (content != null) {
visibility = View.VISIBLE
action(content)
} else {
visibility = View.GONE
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment