LibreTube/app/src/main/java/com/github/libretube/CustomExoPlayerView.kt
2022-02-01 19:52:06 +04:00

28 lines
874 B
Kotlin

package com.github.libretube
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import com.google.android.exoplayer2.ui.PlayerView
import com.google.android.exoplayer2.ui.StyledPlayerControlView
import com.google.android.exoplayer2.ui.StyledPlayerView
internal class CustomExoPlayerView(
context: Context, attributeSet: AttributeSet? = null
) : StyledPlayerView(context, attributeSet) {
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean {
when (event.action) {
MotionEvent.ACTION_DOWN -> {
if (isControllerFullyVisible) {
hideController()
}else {
showController()
}
}
}
return false
}
}