Mikes_IDEA_extensions
Mikes_IDEA_extensions copied to clipboard
Request: for Kotlin, offer to replace View.setVisibility to View.isVisible and similar cases
Meaning:
view.setVisibility = View.VISIBLE
-> view.isVisible = true
view.setVisibility = View.GONE
-> view.isVisible = false
view.setVisibility = View.INVISIBLE
-> view.isInvisible = true
And also the getter:
if(view.visibility==View.VISIBLE)
-> if(view.isVisible)
if(view.visibility==View.GONE)
-> if(view.isGone)
if(view.visibility==View.INVISIBLE)
-> if(view.isInvisible )
And the negated forms.
This is only to make code shorter and cleaner, of course. If you check its code, it does about the same...
Where these properties come from? ktx?
@Miha-x64 When you create a new project, don't you see them?
I can see this line when using it, if that helps:
import androidx.core.view.isVisible
Doesn't this inspection satisfy your needs? Android | Lint | Productivity | KTX Extension Available
Unfortunately, it doesn't work on the fly. And I keep it disabled because I prefer not to use ktx.
@Miha-x64 It doesn't offer this. I don't know what it covers.
@AndroidDeveloperLB, don't you mind building a list of methods and replacements you want to be suggested?
I don't know of any other examples. I just noticed them, so I thought I should use them instead, as it looks nicer :)