From 1d1acc9f35793a84bcd45a94b083d3ebd938a43d Mon Sep 17 00:00:00 2001 From: Jean Silva Date: Wed, 27 Mar 2024 06:06:17 -0300 Subject: [PATCH] refact: prefix StackMeasurePolicy's calculation methods' names with 'calculate' --- .../registration/ui/stack/StackMeasurePolicy.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/feature/registration/src/main/java/com/jeanbarrossilva/orca/feature/registration/ui/stack/StackMeasurePolicy.kt b/feature/registration/src/main/java/com/jeanbarrossilva/orca/feature/registration/ui/stack/StackMeasurePolicy.kt index 60ce4ab2f..5f82876bc 100644 --- a/feature/registration/src/main/java/com/jeanbarrossilva/orca/feature/registration/ui/stack/StackMeasurePolicy.kt +++ b/feature/registration/src/main/java/com/jeanbarrossilva/orca/feature/registration/ui/stack/StackMeasurePolicy.kt @@ -63,7 +63,7 @@ internal object StackMeasurePolicy : MeasurePolicy { * for calculating the Y offset of all subsequent background items. * * @see calculateUnscaledYOffset - * @see scaleBackgroundItemYOffset + * @see calculateScaledYOffsetForBackgroundItem */ @UnitFraction private const val InitialBackgroundItemYOffsetFraction = .1f @@ -100,10 +100,14 @@ internal object StackMeasurePolicy : MeasurePolicy { val backgroundItemCount = items.size - FurthermostVisibleBackgroundItemIndexSubtrahend val backgroundItems = items.take(backgroundItemCount) val backgroundScales = - List(backgroundItemCount) { scaleBackgroundItem(backgroundItemCount, index = it) } + List(backgroundItemCount) { calculateScaleForBackgroundItem(backgroundItemCount, index = it) } val backgroundYOffsets = backgroundItems.mapIndexed { index, backgroundItem -> - scaleBackgroundItemYOffset(index, backgroundItem.height, backgroundScales[index]) + calculateScaledYOffsetForBackgroundItem( + index, + backgroundItem.height, + backgroundScales[index] + ) } val backgroundHeight = backgroundYOffsets.sum() return layout( @@ -138,7 +142,7 @@ internal object StackMeasurePolicy : MeasurePolicy { * @see calculateUnscaledYOffset */ @Throws(IllegalArgumentException::class) - private fun scaleBackgroundItemYOffset( + private fun calculateScaledYOffsetForBackgroundItem( @BackgroundItemIndex index: Int, height: Int, @UnitFraction scale: Float @@ -171,7 +175,7 @@ internal object StackMeasurePolicy : MeasurePolicy { */ @Throws(IllegalArgumentException::class) @UnitFraction - private fun scaleBackgroundItem(count: Int, @BackgroundItemIndex index: Int): Float { + private fun calculateScaleForBackgroundItem(count: Int, @BackgroundItemIndex index: Int): Float { val reversedIndex = reverseBackgroundItemIndex(count, index) return InitialBackgroundItemScale.pow(reversedIndex) }