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

Commit 1cbf78de authored by Matt Pietal's avatar Matt Pietal
Browse files

Controls UI - Prevent parent scroll while using dragging control

Any vertical diff while dragging would stop the drag, and scroll the
parent. Request the parent to let the child maintain focus.

Bug: 152493182
Test: manual, dim a light with enough controls to scroll
Change-Id: I4b00db3501c16521dc3156dc4631aa533fdf17ae
parent 5e8e9e5f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -64,12 +64,13 @@ class ToggleRangeBehavior : Behavior {

        val gestureListener = ToggleRangeGestureListener(cvh.layout)
        val gestureDetector = GestureDetector(context, gestureListener)
        cvh.layout.setOnTouchListener { _: View, e: MotionEvent ->
        cvh.layout.setOnTouchListener { v: View, e: MotionEvent ->
            if (gestureDetector.onTouchEvent(e)) {
                return@setOnTouchListener true
            }

            if (e.getAction() == MotionEvent.ACTION_UP && gestureListener.isDragging) {
                v.getParent().requestDisallowInterceptTouchEvent(false)
                gestureListener.isDragging = false
                endUpdateRange()
                return@setOnTouchListener true
@@ -254,6 +255,7 @@ class ToggleRangeBehavior : Behavior {
            yDiff: Float
        ): Boolean {
            if (!isDragging) {
                v.getParent().requestDisallowInterceptTouchEvent(true)
                this@ToggleRangeBehavior.beginUpdateRange()
                isDragging = true
            }