Miha-x64 / Mikes_IDEA_extensions

IntelliJ IDEA: missing parts.
Apache License 2.0
34 stars 7 forks source link

Request: for Kotlin, offer to replace View.setVisibility to View.isVisible and similar cases #13

Open AndroidDeveloperLB opened 2 years ago

AndroidDeveloperLB commented 2 years ago

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...

Miha-x64 commented 2 years ago

Where these properties come from? ktx?

AndroidDeveloperLB commented 2 years ago

@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
Miha-x64 commented 2 years ago

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.

AndroidDeveloperLB commented 2 years ago

@Miha-x64 It doesn't offer this. I don't know what it covers.

Miha-x64 commented 2 years ago

@AndroidDeveloperLB, don't you mind building a list of methods and replacements you want to be suggested?

AndroidDeveloperLB commented 2 years ago

I don't know of any other examples. I just noticed them, so I thought I should use them instead, as it looks nicer :)