Another couple of kotlin utils

Replacement of @BindView from ButterKnife

private val someTextView: TextView by lazy { findViewById( }
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
  • The first pair will get the full width/height of the view. Since view.height returns the height of the view itself. Sometimes it is useful to take the height of the view and additionally wrapping margins
  • The second pair will get the width/height of only the drawable part of the view. The mentioned view.height returns the height of the view with padding. But sometimes it is useful to know the height of the content area — an area without paddings.

Coroutine properties — properties that can be suspended

prop set 6




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