Last active
March 17, 2021 04:17
-
-
Save OmarKRostom/f3c9beda0338c7ee2fc6c7178f884fea to your computer and use it in GitHub Desktop.
Third step creating an arc layout manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun fill(recycler: RecyclerView.Recycler?, state: RecyclerView.State?) { | |
detachAndScrapAttachedViews(recycler ?: return) | |
for (itemIndex in 0 until itemCount) { | |
val view = recycler.getViewForPosition(itemIndex) | |
addView(view) | |
val viewWidth = pxFromDp(context, ITEM_WIDTH) | |
val viewHeight = pxFromDp(context, ITEM_HEIGHT) | |
measureChildWithMargins(view ?: return, viewWidth.toInt(), viewHeight.toInt()) | |
} | |
recycler.scrapList.toList().forEach { | |
recycler.recycleView(it.itemView) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment