Open neworld opened 7 years ago
👍
By the way, what about makeGone()
, makeVisible()
, makeInvisible()
?
Naming depends. I personally and my colleagues prefer shorter. It is pretty intuitive, heavily used, especially my beloved visibleIf(...)
. However, the interface has to be consistent, so I don't see any problem to use longer names if they are following some consistency or conventions.
Has this been implemented? I am personally using similar helpers and they're just what Anko commons should have. My extension functions, which are as concise as image_view.show()
:
// shows this view
fun View.show(): View {
this.visibility = View.VISIBLE
return this
}
// hides the view
fun View.hide(): View {
this.visibility = View.INVISIBLE
return this
}
// makes the view gone
fun View.gone(): View {
this.visibility = View.GONE
return this
}
Current Android way to change the visibility of views is not very clean. What if we could have these:
Interface could be:
If these little helpers could be a part of Anko, I would like to implement this.