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

Commit d15254b7 authored by Omar Miatello's avatar Omar Miatello
Browse files

STL rename enum values for disableSwipesWhenScrolling() modifier 1/2

For clarity, the enum values will be called TopOrLeft and BottomOrRight,
to indicate that one or the other will be used based on the scroll
 orientation.

disableSwipesWhenScrolling(NestedScrollableBound.TopOrLeft)
disableSwipesWhenScrolling(NestedScrollableBound.BottomOrRight)

Test: Manually tested on the Demo app
Bug: 416342077
Flag: com.android.systemui.scene_container
Change-Id: I91f4e51f7b1947810333a844cc6a8636c0436626
parent 2a96c7d0
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -84,34 +84,38 @@ enum class NestedScrollableBound {
    Any,

    /** Disable after reaching the top (left) bound when scrolling vertically (horizontally). */
    TopLeft,
    TopOrLeft,

    /** Disable after reaching the bottom (right) bound when scrolling vertically (horizontally). */
    BottomRight;
    BottomOrRight;

    companion object {
        /**
         * Disable after reaching the left (right) bound when scrolling horizontally in a LTR (RTL)
         * layout.
         *
         * Note: This is exclusively for horizontal scrolling.
         */
        val Start: NestedScrollableBound
            @Composable
            get() =
                when (LocalLayoutDirection.current) {
                    LayoutDirection.Ltr -> TopLeft
                    LayoutDirection.Rtl -> BottomRight
                    LayoutDirection.Ltr -> TopOrLeft
                    LayoutDirection.Rtl -> BottomOrRight
                }

        /**
         * Disable after reaching the right (left) bound when scrolling horizontally in a LTR (RTL)
         * layout.
         *
         * Note: This is exclusively for horizontal scrolling.
         */
        val End: NestedScrollableBound
            @Composable
            get() =
                when (LocalLayoutDirection.current) {
                    LayoutDirection.Ltr -> BottomRight
                    LayoutDirection.Rtl -> TopLeft
                    LayoutDirection.Ltr -> BottomOrRight
                    LayoutDirection.Rtl -> TopOrLeft
                }
    }
}
@@ -190,10 +194,10 @@ private class NestedScrollControllerNode(
    private fun hasConsumedScrollInBounds(consumed: Float): Boolean {
        return when {
            consumed < 0f ->
                bounds == NestedScrollableBound.Any || bounds == NestedScrollableBound.BottomRight
                bounds == NestedScrollableBound.Any || bounds == NestedScrollableBound.BottomOrRight

            consumed > 0f ->
                bounds == NestedScrollableBound.Any || bounds == NestedScrollableBound.TopLeft
                bounds == NestedScrollableBound.Any || bounds == NestedScrollableBound.TopOrLeft

            else -> false
        }