Last active
September 20, 2019 17:38
-
-
Save TroyStopera/ba16ae99609573dcf4ab5e55a2984390 to your computer and use it in GitHub Desktop.
View visibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.view.View | |
fun View?.setVisibleIf(boolean: Boolean, otherwise: Int = View.GONE) { | |
this?.visibility = if (boolean) View.VISIBLE else otherwise | |
} | |
fun View?.setVisibleIfNot(boolean: Boolean, otherwise: Int = View.GONE) = setVisibleIf(!boolean, otherwise) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment