Another couple of kotlin utils

Replacement of @BindView from ButterKnife

private val someTextView: TextView by lazy { findViewById(R.id.some_text_view) }
fun <T : View> View.bindable(@IdRes id: Int): Lazy<T> = 
lazyUnsafe { findViewById<T>(id) }
fun <T> lazyUnsafe(initializer: () -> T): Lazy<T> =
lazy(LazyThreadSafetyMode.NONE, initializer)

Useful utils for context and view

More handy dimension extensions for view

val p = view.padding.start
view.padding
view.margin

Coroutine properties — properties that can be suspended

prop set 6

Afterwords

--

--

--

Love being creative to solve some problems with an simple and elegant ways

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

#5 Floating Windows on Android: Moving Window

👨🏼‍💻Write Logcat logs to txt file(Android / Kotlin)

Maximizing the Leverage of Architecture in Android

Preference notifier Android library

Android background in a nutshell — Part III. Executors and EventBus.

Displaying menu and Toolbar androidx Fragment class

My Journey & Tips on converting Java Android project to 100% Kotlin — Kotlin 101

Keep your gradle dependencies up to date seamlessly :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michael Spitsin

Michael Spitsin

Love being creative to solve some problems with an simple and elegant ways

More from Medium

Kotlin Cookbook 1

Best practices for ViewDataBinding after Kotlin synthetics Depreciation

Higher Order Function & Type aliases Kotlin

Kotlin: Extensions to functions