xxfast
LazyVerticalStaggeredGrids
Joel Denke
internal fun placeSpaceAround( totalSize: Int, size: IntArray, outPosition: IntArray, reverseInput: Boolean ) { val consumedSize = size.fold(0) { a, b -> a + b } val gapSize = if (size.isNotEmpty()) { (totalSize - consumedSize).toFloat() / size.size } else { 0f } var current = gapSize / 2 size.forEachIndexed(reverseInput) { index, it -> outPosition[index] = current.roundToInt() current += it.toFloat() + gapSize } }
A modern programming language that makes developers happier.