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

Commit 9d4ba69a authored by omarmt's avatar omarmt Committed by Omar Miatello
Browse files

new defaultSwipeSpec

This new SwipeSpec uses a springs

Flexiglass: stiffness = 300f, dampingRatio = 0.8f
STL: stiffness = MediumLow (400f), dampingRatio = RatioLowBouncy (0.75f)

Test: Manually tested on Flexiglass
Bug: 345750458
Flag: com.android.systemui.scene_container
Change-Id: I476b02ebbdfbc0ede77ae60ee35203a6384f9217
parent f87fc38d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
package com.android.systemui.scene.ui.composable

import androidx.compose.animation.core.spring
import androidx.compose.foundation.gestures.Orientation
import com.android.compose.animation.scene.ProgressConverter
import com.android.compose.animation.scene.TransitionKey
@@ -44,6 +45,7 @@ val SceneContainerTransitions = transitions {

    // Overscroll progress starts linearly with some resistance (3f) and slowly approaches 0.2f
    defaultOverscrollProgressConverter = ProgressConverter.tanh(maxProgress = 0.2f, tilt = 3f)
    defaultSwipeSpec = spring(stiffness = 300f, dampingRatio = 0.8f, visibilityThreshold = 0.5f)

    // Scene transitions

+1 −0
Original line number Diff line number Diff line
@@ -152,6 +152,7 @@ internal constructor(
        internal val DefaultSwipeSpec =
            spring(
                stiffness = Spring.StiffnessMediumLow,
                dampingRatio = Spring.DampingRatioLowBouncy,
                visibilityThreshold = OffsetVisibilityThreshold,
            )

+4 −2
Original line number Diff line number Diff line
@@ -1203,7 +1203,8 @@ class DraggableHandlerTest {
    fun overscroll_releaseBetween0And100Percent_up() = runGestureTest {
        // Make scene B overscrollable.
        layoutState.transitions = transitions {
            from(SceneA, to = SceneB) { spec = spring(dampingRatio = Spring.DampingRatioNoBouncy) }
            defaultSwipeSpec = spring(dampingRatio = Spring.DampingRatioNoBouncy)
            from(SceneA, to = SceneB) {}
            overscroll(SceneB, Orientation.Vertical) { fade(TestElements.Foo) }
        }

@@ -1234,7 +1235,8 @@ class DraggableHandlerTest {
    fun overscroll_releaseBetween0And100Percent_down() = runGestureTest {
        // Make scene C overscrollable.
        layoutState.transitions = transitions {
            from(SceneA, to = SceneC) { spec = spring(dampingRatio = Spring.DampingRatioNoBouncy) }
            defaultSwipeSpec = spring(dampingRatio = Spring.DampingRatioNoBouncy)
            from(SceneA, to = SceneC) {}
            overscroll(SceneC, Orientation.Vertical) { fade(TestElements.Foo) }
        }