LibreTube/app/src/main/java/com/github/libretube/CustomExoPlayerView.kt

28 lines
874 B
Kotlin
Raw Normal View History

2022-02-01 21:22:06 +05:30
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
2021-12-14 02:58:17 +05:30
import com.google.android.exoplayer2.ui.StyledPlayerControlView
import com.google.android.exoplayer2.ui.StyledPlayerView
internal class CustomExoPlayerView(
context: Context, attributeSet: AttributeSet? = null
2021-12-14 02:58:17 +05:30
) : StyledPlayerView(context, attributeSet) {
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean {
when (event.action) {
MotionEvent.ACTION_DOWN -> {
2021-12-14 21:45:53 +05:30
if (isControllerFullyVisible) {
hideController()
}else {
showController()
}
}
}
return false
}
}