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

Commit 95bd01ef authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Add damping to shade blurs" into rvc-dev

parents 8a3882d7 15a7514c
Loading
Loading
Loading
Loading
+17 −2
Original line number Original line Diff line number Diff line
@@ -21,6 +21,9 @@ import android.animation.AnimatorListenerAdapter
import android.animation.ValueAnimator
import android.animation.ValueAnimator
import android.view.Choreographer
import android.view.Choreographer
import android.view.View
import android.view.View
import androidx.dynamicanimation.animation.FloatPropertyCompat
import androidx.dynamicanimation.animation.SpringAnimation
import androidx.dynamicanimation.animation.SpringForce
import com.android.internal.util.IndentingPrintWriter
import com.android.internal.util.IndentingPrintWriter
import com.android.systemui.Dumpable
import com.android.systemui.Dumpable
import com.android.systemui.Interpolators
import com.android.systemui.Interpolators
@@ -59,6 +62,16 @@ class NotificationShadeWindowBlurController @Inject constructor(
    private var notificationAnimator: Animator? = null
    private var notificationAnimator: Animator? = null
    private var updateScheduled: Boolean = false
    private var updateScheduled: Boolean = false
    private var shadeExpansion = 1.0f
    private var shadeExpansion = 1.0f
    private val shadeSpring = SpringAnimation(this, object :
            FloatPropertyCompat<NotificationShadeWindowBlurController>("shadeBlurRadius") {
        override fun setValue(rect: NotificationShadeWindowBlurController?, value: Float) {
            shadeBlurRadius = value.toInt()
        }

        override fun getValue(rect: NotificationShadeWindowBlurController?): Float {
            return shadeBlurRadius.toFloat()
        }
    })
    private var shadeBlurRadius = 0
    private var shadeBlurRadius = 0
        set(value) {
        set(value) {
            if (field == value) return
            if (field == value) return
@@ -135,6 +148,9 @@ class NotificationShadeWindowBlurController @Inject constructor(
        if (WAKE_UP_ANIMATION_ENABLED) {
        if (WAKE_UP_ANIMATION_ENABLED) {
            keyguardStateController.addCallback(keyguardStateCallback)
            keyguardStateController.addCallback(keyguardStateCallback)
        }
        }
        shadeSpring.spring = SpringForce(0.0f)
        shadeSpring.spring.dampingRatio = SpringForce.DAMPING_RATIO_NO_BOUNCY
        shadeSpring.spring.stiffness = SpringForce.STIFFNESS_LOW
    }
    }


    /**
    /**
@@ -153,8 +169,7 @@ class NotificationShadeWindowBlurController @Inject constructor(
        if (shadeBlurRadius == newBlur) {
        if (shadeBlurRadius == newBlur) {
            return
            return
        }
        }
        shadeBlurRadius = newBlur
        shadeSpring.animateToFinalPosition(newBlur.toFloat())
        scheduleUpdate()
    }
    }


    private fun scheduleUpdate() {
    private fun scheduleUpdate() {