Skip to content

Instantly share code, notes, and snippets.

@benigumocom
Created November 16, 2018 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benigumocom/ea5dd92cef66f6d30def910dfe02f174 to your computer and use it in GitHub Desktop.
Save benigumocom/ea5dd92cef66f6d30def910dfe02f174 to your computer and use it in GitHub Desktop.
@ModelView(defaultLayout = R2.layout.default_component_layout)
@Styleable("Component")
class Component @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
ConstraintLayout(context, attrs, defStyleAttr) {
init {
inflate(R.layout.component_inner_layout)
Paris.style(this).apply(attrs)
}
@Attr(R2.styleable.Component_title)
@TextProp
fun setTitle(text: CharSequence) {
title.text = text // kotlinx.android.syntethic
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment