Slide 107
Slide 107 text
motion_layout?.apply {
val cs = getConstraintSet(R.id.scrolling)
cs?.constrainWidth(placeholder.id, MATCH_PARENT)
cs?.constrainHeight(placeholder.id, WRAP_CONTENT)
if (topOffset > 0) {
cs?.setMargin(placeholder.id, TOP, placeholderTop)
cs?.setMargin(placeholder.id, BOTTOM, 0)
cs?.setVerticalBias(placeholder.id, 0f)
} else {
cs?.setMargin(placeholder.id, BOTTOM, placeholderBottom)
cs?.setMargin(placeholder.id, TOP, 0)
cs?.setVerticalBias(placeholder.id, 1f)
}
cs?.connect(placeholder.id, START, parentId, START, startMargin)
cs?.connect(placeholder.id, END, parentId, END, startMargin)
updateState(R.id.scrolling, cs)
setTransition(R.id.scrolling, R.id.selected)
placeholder?.isVisible = true
transitionToEnd()
}
MotionLayout & RecyclerView