Comments (13)
Personally I use show()
and hide()
respectively for visibility = View.VISIBLE
and visibility = View.INVISIBLE
. For View.GONE
what comes to my mind is gone()
or disappear()
.
from android-ktx.
There is already a pending PR for these
from android-ktx.
Here's my take: https://github.com/android/android-ktx/compare/jakew/visibility-properties/2018-02-06
I'm not really a fan of the function approach to setting this state because it makes the code more verbose when dealing with booleans from a model or other conditional logic.
from android-ktx.
I sometimes add and use isVisible
/isInvisible
/isGone
too
from android-ktx.
We can have:
fun View.visible() {
visibility = View.VISIBLE
}
fun View.invisible() {
visibility = View.INVISIBLE
}
fun View.gone() {
visibility = View.GONE
}
If these look good then I can make a PR.
from android-ktx.
#137 - is first feature what i make in kotlin and use still now. I think they have almost every project and then they just have to be)
from android-ktx.
@ouattararomuald You're in for a bad time with show()
and hide()
on FloatingActionButton.
from android-ktx.
Here #146 variant of @ouattararomuald. I use the same naming for current extensions
from android-ktx.
@chrisbanes Thanks for pointing this out
from android-ktx.
@JakeWharton I like this property based approach. It also solves the naming problem with gone
.
from android-ktx.
+1 to properties.
from android-ktx.
👍 for properties
from android-ktx.
Oh, i pushed new commit with solved problems after review from @JakeWharton. But i see new nice idea - change 6 functions to 3 properties. And i see what community likes the idea...
from android-ktx.
Related Issues (20)
- Convenience DSL for Media Controller Callback event handling
- androidx.preference.PreferenceFragment not derived from androidx.fragment.app.Fragment HOT 2
- Manifest merger failed HOT 5
- Release of 1.0.0-alpha3 out of sync with this repo HOT 4
- Extension property of bitmap from ImageView HOT 1
- error: resource android:attr/fontVariationSettings not found. HOT 1
- ImageDecoder source and test issues HOT 7
- inline extension properties can't be used in SAM lambda functions due to compiler bug HOT 1
- Add popular libraries extensions in new module HOT 1
- AAPT2 Error HOT 1
- View.post with with this view as a parameter HOT 2
- Resources.Theme.resolveAttribute extension
- Improve View.doOnPreDraw(...) HOT 1
- Features suggestions: Live data transformation HOT 1
- Offer: AsyncTask replacement
- Can't use getString(String) : String HOT 2
- androidx.core.os.BundleKt.bundleOf: Imports for API 21 classes break on older devices HOT 2
- gradle error HOT 3
- Add support for manipulating a color as HSV HOT 1
- Hi everyone!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-ktx.