Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AndroidDeveloperLB opened this issue Dec 30, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Dec 30, 2021

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
Copy link
Owner

Where these properties come from? ktx?

@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Dec 30, 2021

@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
Copy link
Owner

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
Copy link
Author

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

@Miha-x64
Copy link
Owner

Miha-x64 commented Jan 7, 2022

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

@Miha-x64 Miha-x64 added the enhancement New feature or request label Jan 7, 2022
@AndroidDeveloperLB
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants