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

Commit a4e49cdb authored by Hawkwood's avatar Hawkwood
Browse files

Move flag calls to static initializier

Bug: 407182293
Test: atest ClockSectionTest
Flag: com.android.systemui.shared.clock_reactive_smartspace_layout
Change-Id: I63b2bad95392b9571d34169eeb2de3c6fe47af7d
parent a2ba06b7
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ private const val BURN_IN_PREVENTION_PERIOD_Y = 521f
private const val BURN_IN_PREVENTION_PERIOD_X = 83f
private const val BURN_IN_PREVENTION_PERIOD_SCALE = 181f
private const val BURN_IN_PREVENTION_PERIOD_PROGRESS = 89f
private val BASE_BURNIN_SCALE = if (Flags.clockReactiveSmartspaceLayout()) 0.75f else 0.8f

/**
 * Returns the translation offset that should be used to avoid burn in at the current time (in
@@ -55,9 +56,7 @@ fun getBurnInProgressOffset(): Float {

/** Returns a value to scale a view in order to avoid burn in. */
fun getBurnInScale(): Float {
    val multiplier = if (Flags.clockReactiveSmartspaceLayout()) 0.75f else 0.8f

    return multiplier +
    return BASE_BURNIN_SCALE +
        zigzag(
            System.currentTimeMillis() / MILLIS_PER_MINUTES,
            0.2f,
+2 −3
Original line number Diff line number Diff line
@@ -192,18 +192,17 @@ constructor(

            val burnInY = MathUtils.lerp(0, burnIn.translationY, interpolated).toInt()
            val translationY = max(params.topInset - params.minViewY, burnInY)
            val stopScale = if (Flags.clockReactiveSmartspaceLayout()) MAX_LARGE_CLOCK_SCALE else 1f
            BurnInModel(
                translationX = MathUtils.lerp(0, burnIn.translationX, interpolated).toInt(),
                translationY = translationY,
                scale = MathUtils.lerp(burnIn.scale, stopScale, 1f - interpolated),
                scale = MathUtils.lerp(burnIn.scale, MAX_LARGE_CLOCK_SCALE, 1f - interpolated),
                scaleClockOnly = useScaleOnly,
            )
        }
    }

    companion object {
        private const val MAX_LARGE_CLOCK_SCALE = 0.9f
        private val MAX_LARGE_CLOCK_SCALE = if (Flags.clockReactiveSmartspaceLayout()) 0.9f else 1f
    }
}