Skip to content

Instantly share code, notes, and snippets.

@josinSbazin
Last active September 27, 2018 10:19
Show Gist options
  • Save josinSbazin/7a5295600fc524259d627b7d0e3b7d44 to your computer and use it in GitHub Desktop.
Save josinSbazin/7a5295600fc524259d627b7d0e3b7d44 to your computer and use it in GitHub Desktop.
Extension For Android
inline fun <V: View> V.isVisibleAndActionOrGone(condition: Boolean, body: (V) -> Unit) {
if (condition) {
this.visibility = View.VISIBLE
body(this)
} else {
this.visibility = View.GONE
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment