mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 11:02:35 +01:00
Replace coerceIn() with MathUtils.clamp().
This commit is contained in:
parent
1a8f396e77
commit
2eec2e9128
@ -4,6 +4,7 @@ import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewConfiguration
|
||||
import androidx.core.math.MathUtils
|
||||
import org.schabi.newpipe.MainActivity
|
||||
import org.schabi.newpipe.ktx.AnimationType
|
||||
import org.schabi.newpipe.ktx.animate
|
||||
@ -234,11 +235,13 @@ class PopupPlayerGestureListener(
|
||||
isMoving = true
|
||||
|
||||
val diffX = (movingEvent.rawX - initialEvent.rawX)
|
||||
val posX = (initialPopupX + diffX).coerceIn(
|
||||
val posX = MathUtils.clamp(
|
||||
initialPopupX + diffX,
|
||||
0f, (playerUi.screenWidth - playerUi.popupLayoutParams.width).toFloat()
|
||||
)
|
||||
val diffY = (movingEvent.rawY - initialEvent.rawY)
|
||||
val posY = (initialPopupY + diffY).coerceIn(
|
||||
val posY = MathUtils.clamp(
|
||||
initialPopupY + diffY,
|
||||
0f, (playerUi.screenHeight - playerUi.popupLayoutParams.height).toFloat()
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user