Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a819fd6 authored by Mike Schneider's avatar Mike Schneider
Browse files

Rename constantValue* into fixedValue*

These are used interchangeably, for readability we should only use one
of the names.

Bug: 417698047
Test: existing unit tests
Flag: EXEMPT Strict mechanical refactor (pun intended :)
Change-Id: If75cc560d90a016f2ec660c96f221ee893bf6adb
parent 2dbd54de
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ class MotionValueBenchmark {
                    defaultSpring = SpringParameters(stiffness = 300f, dampingRatio = .9f),
                    initialMapping = Mapping.Zero,
                ) {
                    constantValue(breakpoint = 1f, value = 1f)
                    fixedValue(breakpoint = 1f, value = 1f)
                }
            )

@@ -232,7 +232,7 @@ class MotionValueBenchmark {
                    defaultSpring = SpringParameters(stiffness = 300f, dampingRatio = .9f),
                    initialMapping = Mapping.Zero,
                ) {
                    constantValue(
                    fixedValue(
                        breakpoint = 1f,
                        value = 1f,
                        guarantee = Guarantee.GestureDragDelta(1f),
+1 −1
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ class VerticalExpandContainerSpec(
        return with(density) {
            MotionSpec(
                directionalMotionSpec(opacitySpring, initialMapping = Mapping.Zero) {
                    constantValue(breakpoint = visibleHeight.toPx(), value = 1f)
                    fixedValue(breakpoint = visibleHeight.toPx(), value = 1f)
                }
            )
        }
+5 −5
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ internal open class DirectionalBuilderImpl(
        return CanBeLastSegmentImpl
    }

    override fun constantValue(
    override fun fixedValue(
        breakpoint: Float,
        value: Float,
        spring: SpringParameters,
@@ -204,11 +204,11 @@ internal open class DirectionalBuilderImpl(
        applySemantics(semantics)
        toBreakpointImpl(breakpoint, key)
        jumpToImpl(value, spring, guarantee)
        continueWithConstantValueImpl()
        continueWithFixedValueImpl()
        return CanBeLastSegmentImpl
    }

    override fun constantValueFromCurrent(
    override fun fixedValueFromCurrent(
        breakpoint: Float,
        delta: Float,
        spring: SpringParameters,
@@ -219,7 +219,7 @@ internal open class DirectionalBuilderImpl(
        applySemantics(semantics)
        toBreakpointImpl(breakpoint, key)
        jumpByImpl(delta, spring, guarantee)
        continueWithConstantValueImpl()
        continueWithFixedValueImpl()
        return CanBeLastSegmentImpl
    }

@@ -258,7 +258,7 @@ internal open class DirectionalBuilderImpl(
        fractionalMapping = fraction
    }

    private fun continueWithConstantValueImpl() {
    private fun continueWithFixedValueImpl() {
        check(sourceValue.isFinite())

        mappings.add(Mapping.Fixed(sourceValue))
+5 −5
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ interface DirectionalBuilderScope {

    /**
     * Ends the current segment at the [breakpoint] position and defines the next segment to output
     * a constant value ([value]).
     * a fixed value ([value]).
     *
     * Note: This segment can be used as the last segment in the specification.
     *
@@ -169,7 +169,7 @@ interface DirectionalBuilderScope {
     * @param semantics Updated semantics values to be applied. Must be a subset of the
     *   [SemanticKey]s used when first creating this builder.
     */
    fun constantValue(
    fun fixedValue(
        breakpoint: Float,
        value: Float,
        spring: SpringParameters = defaultSpring,
@@ -187,7 +187,7 @@ interface DirectionalBuilderScope {
     *
     * @param breakpoint The breakpoint defining the end of the current segment and the start of the
     *   next.
     * @param delta An optional offset to apply to the mapped value to determine the constant value.
     * @param delta An optional offset to apply to the mapped value to determine the fixed value.
     *   Defaults to 0f.
     * @param spring The [SpringParameters] for the transition to this breakpoint. Defaults to
     *   [defaultSpring].
@@ -196,7 +196,7 @@ interface DirectionalBuilderScope {
     * @param semantics Updated semantics values to be applied. Must be a subset of the
     *   [SemanticKey]s used when first creating this builder.
     */
    fun constantValueFromCurrent(
    fun fixedValueFromCurrent(
        breakpoint: Float,
        delta: Float = 0f,
        spring: SpringParameters = defaultSpring,
@@ -238,7 +238,7 @@ interface DirectionalBuilderScope {
     *
     * @param breakpoint The breakpoint defining the end of the current segment and the start of the
     *   next.
     * @param delta An optional offset to apply to the mapped value to determine the constant value.
     * @param delta An optional offset to apply to the mapped value to determine the fixed value.
     * @param spring The [SpringParameters] for the transition to this breakpoint.
     * @param guarantee The animation guarantee for this transition.
     * @param key A unique [BreakpointKey] for this breakpoint.
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ fun MotionBuilderContext.effectsDirectionalMotionSpec(
 *     target(breakpoint = 10f, from = 0f, to = 50f)
 *
 *     // At breakpoint 20: Jump +5, and constant value 55.
 *     constantValueFromCurrent(breakpoint = 20f, delta = 5f)
 *     fixedValueFromCurrent(breakpoint = 20f, delta = 5f)
 *
 *     // At breakpoint 30: Jump to 40. Linear mapping using: progress_since_breakpoint * fraction.
 *     fractionalInput(breakpoint = 30f, from = 40f, fraction = 2f)
Loading