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

Commit ec0f179c authored by Hawkwood Glazier's avatar Hawkwood Glazier Committed by Android (Google) Code Review
Browse files

Merge "Animate changes to font axes for picker preview changes" into main

parents 5e674c9f 2626bcf4
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -111,10 +111,6 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) :

            override fun onZenDataChanged(data: ZenData) {}

            override fun onFontAxesChanged(axes: ClockAxisStyle) {
                view.updateAxes(axes)
            }

            override var isReactiveTouchInteractionEnabled
                get() = view.isReactiveTouchInteractionEnabled
                set(value) {
@@ -152,6 +148,13 @@ class ComposedDigitalLayerController(private val clockCtx: ClockContext) :
            override fun onFidgetTap(x: Float, y: Float) {
                view.animateFidget(x, y)
            }

            private var hasFontAxes = false

            override fun onFontAxesChanged(style: ClockAxisStyle) {
                view.updateAxes(style, isAnimated = hasFontAxes)
                hasFontAxes = true
            }
        }

    override val faceEvents =
+2 −2
Original line number Diff line number Diff line
@@ -231,8 +231,6 @@ class DefaultClockController(
        override fun onAlarmDataChanged(data: AlarmData) {}

        override fun onZenDataChanged(data: ZenData) {}

        override fun onFontAxesChanged(axes: ClockAxisStyle) {}
    }

    open inner class DefaultClockAnimations(
@@ -285,6 +283,8 @@ class DefaultClockController(
        override fun onPositionUpdated(distance: Float, fraction: Float) {}

        override fun onFidgetTap(x: Float, y: Float) {}

        override fun onFontAxesChanged(style: ClockAxisStyle) {}
    }

    inner class LargeClockAnimations(
+2 −7
Original line number Diff line number Diff line
@@ -99,12 +99,6 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController
                smallClock.events.onZenDataChanged(data)
                largeClock.events.onZenDataChanged(data)
            }

            override fun onFontAxesChanged(axes: ClockAxisStyle) {
                val fontAxes = ClockAxisStyle(getDefaultAxes(clockCtx.settings).merge(axes))
                smallClock.events.onFontAxesChanged(fontAxes)
                largeClock.events.onFontAxesChanged(fontAxes)
            }
        }

    override fun initialize(
@@ -113,10 +107,10 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController
        foldFraction: Float,
        clockListener: ClockEventListener?,
    ) {
        events.onFontAxesChanged(clockCtx.settings.axes)
        smallClock.run {
            layerController.onViewBoundsChanged = { clockListener?.onBoundsChanged(it) }
            events.onThemeChanged(theme.copy(isDarkTheme = isDarkTheme))
            animations.onFontAxesChanged(clockCtx.settings.axes)
            animations.doze(dozeFraction)
            animations.fold(foldFraction)
            events.onTimeTick()
@@ -125,6 +119,7 @@ class FlexClockController(private val clockCtx: ClockContext) : ClockController
        largeClock.run {
            layerController.onViewBoundsChanged = { clockListener?.onBoundsChanged(it) }
            events.onThemeChanged(theme.copy(isDarkTheme = isDarkTheme))
            animations.onFontAxesChanged(clockCtx.settings.axes)
            animations.doze(dozeFraction)
            animations.fold(foldFraction)
            events.onTimeTick()
+11 −9
Original line number Diff line number Diff line
@@ -31,10 +31,12 @@ import com.android.systemui.plugins.clocks.ClockFaceConfig
import com.android.systemui.plugins.clocks.ClockFaceController
import com.android.systemui.plugins.clocks.ClockFaceEvents
import com.android.systemui.plugins.clocks.ClockFaceLayout
import com.android.systemui.plugins.clocks.ClockFontAxis.Companion.merge
import com.android.systemui.plugins.clocks.DefaultClockFaceLayout
import com.android.systemui.plugins.clocks.ThemeConfig
import com.android.systemui.plugins.clocks.WeatherData
import com.android.systemui.plugins.clocks.ZenData
import com.android.systemui.shared.clocks.FlexClockController.Companion.getDefaultAxes
import com.android.systemui.shared.clocks.FontUtils.get
import com.android.systemui.shared.clocks.FontUtils.set
import com.android.systemui.shared.clocks.ViewUtils.computeLayoutDiff
@@ -131,15 +133,6 @@ class FlexClockFaceController(clockCtx: ClockContext, private val isLargeClock:
            layerController.faceEvents.onThemeChanged(theme)
        }

        override fun onFontAxesChanged(settings: ClockAxisStyle) {
            var axes = ClockAxisStyle(settings)
            if (!isLargeClock && axes[GSFAxes.WIDTH] > SMALL_CLOCK_MAX_WDTH) {
                axes[GSFAxes.WIDTH] = SMALL_CLOCK_MAX_WDTH
            }

            layerController.events.onFontAxesChanged(axes)
        }

        /**
         * targetRegion passed to all customized clock applies counter translationY of Keyguard and
         * keyguard_large_clock_top_margin from default clock
@@ -232,6 +225,15 @@ class FlexClockFaceController(clockCtx: ClockContext, private val isLargeClock:
            override fun onFidgetTap(x: Float, y: Float) {
                layerController.animations.onFidgetTap(x, y)
            }

            override fun onFontAxesChanged(style: ClockAxisStyle) {
                var axes = ClockAxisStyle(getDefaultAxes(clockCtx.settings).merge(style))
                if (!isLargeClock && axes[GSFAxes.WIDTH] > SMALL_CLOCK_MAX_WDTH) {
                    axes[GSFAxes.WIDTH] = SMALL_CLOCK_MAX_WDTH
                }

                layerController.animations.onFontAxesChanged(axes)
            }
        }

    companion object {
+7 −4
Original line number Diff line number Diff line
@@ -171,10 +171,6 @@ open class SimpleDigitalHandLayerController(
            override fun onAlarmDataChanged(data: AlarmData) {}

            override fun onZenDataChanged(data: ZenData) {}

            override fun onFontAxesChanged(axes: ClockAxisStyle) {
                view.updateAxes(axes)
            }
        }

    override val animations =
@@ -195,6 +191,13 @@ open class SimpleDigitalHandLayerController(
                view.dozeFraction = fraction
            }

            private var hasFontAxes = false

            override fun onFontAxesChanged(style: ClockAxisStyle) {
                view.updateAxes(style, isAnimated = hasFontAxes)
                hasFontAxes = true
            }

            override fun fold(fraction: Float) {
                applyLayout()
                refreshTime()
Loading