Skip to content

Instantly share code, notes, and snippets.

@soulduse
Created February 16, 2018 11:18
Show Gist options
  • Save soulduse/8a928b94c47cf9dbcd09e6c0d1aa12df to your computer and use it in GitHub Desktop.
Save soulduse/8a928b94c47cf9dbcd09e6c0d1aa12df to your computer and use it in GitHub Desktop.
Anko Extensions
inline fun ViewManager.flexboxLayout(theme: Int = 0, init: FlexboxLayout.() -> Unit) = ankoView(::FlexboxLayout, theme, init)
inline fun ViewManager.swipeRefreshLayout(theme: Int = 0, init: SwipeRefreshLayout.() -> Unit) = ankoView(::SwipeRefreshLayout, theme, init)
inline fun ViewManager.zoomTextView(theme: Int = 0, init: ZoomTextView.() -> Unit) = ankoView(::ZoomTextView, theme, init)
inline fun ViewManager.textView(theme: Int = 0, init: TextView.() -> Unit) = ankoView(::TextView, theme, init)
inline fun ViewManager.imageView(theme: Int = 0, init: ImageView.() -> Unit) = ankoView(::ImageView, theme, init)
inline fun ViewManager.view(theme: Int = 0, init: View.() -> Unit) = ankoView(::View, theme, init)
inline fun ViewManager.button(theme: Int = 0, init: Button.() -> Unit) = ankoView(::Button, theme, init)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment