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

Commit 1ad9e6ac authored by Hawkwood's avatar Hawkwood
Browse files

Modify clock fidget animation dispatch logic

When a wallpaper with focal area is being used, all empty space touches
will be routed to it. However, this also enables a seperate path that
allows the clock to still be tapped on directly to trigger the animation.
This improves consistency as previously the small clock would fidget but
only if the dynamic clock setting was enabled.

Bug: 374305993
Test: Checked fidget animation trigger
Flag: com.android.systemui.clock_fidget_animation
Change-Id: Idb5e8471f61e12cdab8b605cd7fc0ab6c1e0d6f3
parent b38e11b4
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.util.AttributeSet
import android.util.Log
import android.util.MathUtils.lerp
import android.util.TypedValue
import android.view.MotionEvent
import android.view.View
import android.view.View.MeasureSpec.EXACTLY
import android.view.animation.Interpolator
@@ -36,6 +37,7 @@ import android.view.animation.PathInterpolator
import android.widget.TextView
import com.android.app.animation.Interpolators
import com.android.internal.annotations.VisibleForTesting
import com.android.systemui.Flags.clockFidgetAnimation
import com.android.systemui.animation.AxisDefinition
import com.android.systemui.animation.GSFAxes
import com.android.systemui.animation.TextAnimator
@@ -204,6 +206,17 @@ open class SimpleDigitalClockTextView(
    var lockscreenColor = Color.WHITE
    var aodColor = Color.WHITE

    override fun onTouchEvent(evt: MotionEvent): Boolean {
        if (super.onTouchEvent(evt)) return true

        if (clockFidgetAnimation() && evt.action == MotionEvent.ACTION_UP) {
            (parent as? FlexClockView)?.animateFidget(evt.x, evt.y) ?: animateFidget(evt.x, evt.y)
            return true
        }

        return false
    }

    private val animatorListener =
        object : TextAnimatorListener {
            override fun onInvalidate() = invalidate()
+3 −3
Original line number Diff line number Diff line
@@ -231,10 +231,10 @@ constructor(
            return
        }

        if (selectedClockSize.value == ClockSizeSetting.DYNAMIC) {
            clockEventController.handleFidgetTap(x, y)
        } else {
        if (wallpaperFocalAreaInteractor.hasFocalArea.value) {
            wallpaperFocalAreaInteractor.setTapPosition(x, y)
        } else {
            clockEventController.handleFidgetTap(x, y)
        }
    }