File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/player/gesture Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import android.util.Log
44import android.view.MotionEvent
55import android.view.View
66import android.view.ViewConfiguration
7+ import androidx.core.math.MathUtils
78import org.schabi.newpipe.MainActivity
89import org.schabi.newpipe.ktx.AnimationType
910import org.schabi.newpipe.ktx.animate
@@ -234,11 +235,13 @@ class PopupPlayerGestureListener(
234235 isMoving = true
235236
236237 val diffX = (movingEvent.rawX - initialEvent.rawX)
237- val posX = (initialPopupX + diffX).coerceIn(
238+ val posX = MathUtils .clamp(
239+ initialPopupX + diffX,
238240 0f , (playerUi.screenWidth - playerUi.popupLayoutParams.width).toFloat()
239241 )
240242 val diffY = (movingEvent.rawY - initialEvent.rawY)
241- val posY = (initialPopupY + diffY).coerceIn(
243+ val posY = MathUtils .clamp(
244+ initialPopupY + diffY,
242245 0f , (playerUi.screenHeight - playerUi.popupLayoutParams.height).toFloat()
243246 )
244247
You can’t perform that action at this time.
0 commit comments