https://kotlinlang.org logo
#android
Title
# android
s

Sergio Crespo Toubes

04/03/2019, 11:07 AM
Nice android core project. Thanks!!!
m

mgrzechocinski

04/03/2019, 2:23 PM
Having
resId
on any single String, or
html
or any
Int
type doesn’t sound good to me….
r

rook

04/03/2019, 3:29 PM
I’m lazy, so I made these, for whatever they’re worth:```fun View.show() { if (visibility != VISIBLE) { visibility = VISIBLE } } fun View.hide(gone: Boolean = true) { when (visibility) { VISIBLE -> visibility = if (gone) GONE else INVISIBLE INVISIBLE -> if (gone) visibility = GONE GONE -> if (!gone) visibility = INVISIBLE } }```
s

Sergio Crespo Toubes

04/03/2019, 3:35 PM
i have added these
Copy code
fun View.invisible() {
	if (visibility != INVISIBLE) {
		visibility = INVISIBLE
	}
}

fun View.gone() {
	if (visibility != GONE) {
		visibility = GONE
	}
}
g

ghedeon

04/03/2019, 3:40 PM
majority of these extensions is in anko or ktx libraries. I'd rather trust their code and copy from there.
3