alexfacciorusso
01/15/2019, 4:27 PMfun <T> Boolean.map(valueTrue: T, valueFalse: T): T = if(this) valueTrue else valueFalse
in the stdlib been already asked/taken into consideration?serebit
01/15/2019, 4:28 PMalexfacciorusso
01/15/2019, 4:31 PMfun setLoading(loading: Boolean) = loading.map(View.VISIBLE, View.INVISIBLE)
alexfacciorusso
01/15/2019, 4:32 PMoverride fun showLoading(loading: Boolean) {
progressBar.visibility = loading.map(View.VISIBLE, View.INVISIBLE)
}
Shawn
01/15/2019, 4:35 PMprogressBar.visibility = if (loading) View.VISIBLE else View.INVISIBLE
Shawn
01/15/2019, 4:36 PM.map(??, ??)
serebit
01/15/2019, 4:36 PMjw
01/15/2019, 4:39 PMjw
01/15/2019, 4:39 PMif (loading) computeSomething() else computeOtherThing()