mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 16:30:31 +05:30
Merge pull request #5460 from RafaelsRamos/fix/5459
fix: Erratic navbar and miniplayer behaviour.
This commit is contained in:
commit
8b8eacd405
@ -23,6 +23,9 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
|
|||||||
private val swipeUpListener = mutableListOf<() -> Unit>()
|
private val swipeUpListener = mutableListOf<() -> Unit>()
|
||||||
private val swipeDownListener = mutableListOf<() -> Unit>()
|
private val swipeDownListener = mutableListOf<() -> Unit>()
|
||||||
|
|
||||||
|
private var startedMinimized = false
|
||||||
|
private var isStrictlyDownSwipe = false
|
||||||
|
|
||||||
init {
|
init {
|
||||||
addTransitionListener(object : TransitionAdapter() {
|
addTransitionListener(object : TransitionAdapter() {
|
||||||
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
|
override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
|
||||||
@ -65,7 +68,11 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
|
|||||||
distanceY: Float
|
distanceY: Float
|
||||||
): Boolean {
|
): Boolean {
|
||||||
|
|
||||||
if (distanceY < -15F) {
|
if (isStrictlyDownSwipe && distanceY > 0) {
|
||||||
|
isStrictlyDownSwipe = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStrictlyDownSwipe && startedMinimized && distanceY < -15F) {
|
||||||
swipeDownListener.forEach { it.invoke() }
|
swipeDownListener.forEach { it.invoke() }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -101,6 +108,10 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
|
|||||||
touchStarted = false
|
touchStarted = false
|
||||||
return super.onTouchEvent(event)
|
return super.onTouchEvent(event)
|
||||||
}
|
}
|
||||||
|
MotionEvent.ACTION_DOWN -> {
|
||||||
|
isStrictlyDownSwipe = true
|
||||||
|
startedMinimized = progress == 1F
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!touchStarted) {
|
if (!touchStarted) {
|
||||||
viewToDetectTouch.getHitRect(viewRect)
|
viewToDetectTouch.getHitRect(viewRect)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user