Ayden
findViewById<Button>(R.id.test).setOnClickListener(View.OnClickListener { if (progressBar.visibility == View.VISIBLE) { showProgressBar(false) } else { showProgressBar(true) } })
fun showProgressBar(visibility: Boolean) { progressBar.visibility = if (visibility) { View.INVISIBLE } else { View.VISIBLE } }
Khan
val shouldShow = progressBar.visibility != View.VISIBLE showProgressBar(shouldShow)
fun showProgressBar(shouldShow: Boolean) { progressBar.visibility = if (shouldShow) View.VISIBLE else View.INVISIBLE }
rkeazor
Aslam Hossin
yousefa2
isVisible
progressBar.isVisible = !progressBar.isVisible
A modern programming language that makes developers happier.