mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
Merge pull request #2268 from Bnyro/master
Improve the behavior for expanding the mini player
This commit is contained in:
commit
700fe75770
@ -18,7 +18,6 @@ import android.text.util.Linkify
|
|||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@ -276,18 +275,6 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
|||||||
binding.playerMotionLayout.progress = 1.toFloat()
|
binding.playerMotionLayout.progress = 1.toFloat()
|
||||||
binding.playerMotionLayout.transitionToStart()
|
binding.playerMotionLayout.transitionToStart()
|
||||||
|
|
||||||
// quitting miniPlayer on single click
|
|
||||||
|
|
||||||
binding.titleTextView.setOnTouchListener { view, motionEvent ->
|
|
||||||
view.onTouchEvent(motionEvent)
|
|
||||||
if (motionEvent.action == MotionEvent.ACTION_UP) view.performClick()
|
|
||||||
binding.root.onTouchEvent(motionEvent)
|
|
||||||
}
|
|
||||||
binding.titleTextView.setOnClickListener {
|
|
||||||
binding.playerMotionLayout.setTransitionDuration(300)
|
|
||||||
binding.playerMotionLayout.transitionToStart()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (usePiP()) activity?.setPictureInPictureParams(getPipParams())
|
if (usePiP()) activity?.setPictureInPictureParams(getPipParams())
|
||||||
|
|
||||||
if (SDK_INT < Build.VERSION_CODES.O) {
|
if (SDK_INT < Build.VERSION_CODES.O) {
|
||||||
|
@ -81,18 +81,20 @@ class SingleViewTouchableMotionLayout(context: Context, attributeSet: AttributeS
|
|||||||
transitionListenerList += listener
|
transitionListenerList += listener
|
||||||
}
|
}
|
||||||
|
|
||||||
private val gestureDetector = GestureDetector(
|
private inner class Listener : GestureDetector.SimpleOnGestureListener() {
|
||||||
context,
|
override fun onSingleTapUp(e: MotionEvent): Boolean {
|
||||||
object : GestureDetector.SimpleOnGestureListener() {
|
setTransitionDuration(200)
|
||||||
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
transitionToStart()
|
||||||
transitionToEnd()
|
return true
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
|
||||||
|
val gestureDetector = GestureDetector(context, Listener())
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||||
|
gestureDetector.onTouchEvent(event)
|
||||||
|
|
||||||
// gestureDetector.onTouchEvent(event)
|
// gestureDetector.onTouchEvent(event)
|
||||||
when (event.actionMasked) {
|
when (event.actionMasked) {
|
||||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user