Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ToolbarNBottombarTemplateLayout<A : Activity>(private val layoutInterface: ToolbarNBottombarTemplateLayoutInterface) : AnkoComponent<A> {
- var binding: ViewDataBinding? = null
- override fun createView(ui: AnkoContext<A>): View {
- return ui.constraintLayout {
- val toolbar = themedToolbar(layoutInterface.toolbarStyleId())
- toolbar.layoutParams = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT,
- ConstraintLayout.LayoutParams.WRAP_CONTENT)
- val included = include<View>(layoutInterface.includedLayoutId()) {
- id = View.generateViewId()
- }
- binding = DataBindingUtil.bind(included)
- val footer = themedTextView(layoutInterface.footerStyleId())
- footer.layoutParams = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT,
- ConstraintLayout.LayoutParams.WRAP_CONTENT)
- constraintSet {
- connect(toolbar.id,
- android.support.constraint.ConstraintSet.TOP,
- ConstraintSet.PARENT_ID,
- android.support.constraint.ConstraintSet.TOP)
- connect(footer.id,
- android.support.constraint.ConstraintSet.BOTTOM,
- ConstraintSet.PARENT_ID,
- android.support.constraint.ConstraintSet.BOTTOM)
- connect(included.id,
- android.support.constraint.ConstraintSet.TOP,
- toolbar.id,
- android.support.constraint.ConstraintSet.BOTTOM)
- connect(included.id,
- android.support.constraint.ConstraintSet.BOTTOM,
- footer.id,
- android.support.constraint.ConstraintSet.TOP)
- }.applyTo(this)
- }
- }
- interface ToolbarNBottombarTemplateLayoutInterface {
- fun toolbarStyleId(): Int
- fun includedLayoutId(): Int
- fun footerStyleId(): Int
- }
- }
Add Comment
Please, Sign In to add comment