Small changes to the media player (#1572)
* Resolving some issues with media playback. * Changing ViewVideoFragment so that it fully handles autohiding the media controller, allowing consistency between it and the toolbar * Fixed an issue where the toolbar and description were not fading in * Do not hide the toolbar/media player if the video is loading or paused * Created "ExposedPlayPausedVideoView" to allow hooking play/pause * Fix back button when viewing videos * Back button did not work if video controls were visible. * Tweak audio player * Always show the controls when audio begins playing * Do not auto-hide the controls if the player is playing audio * Address PR comments * Use overloaded constructor * Remove m prefix * Fix subtle media player issues * Fix audio player incorrectly auto-hiding after hiding/showing toolbar * Only subscribe touch listener once content is ready - Prevents top toolbar visibility from getting out of phase with audio player visibility if hidden during load
This commit is contained in:
parent
21a7201f8a
commit
a7c1345085
4 changed files with 93 additions and 8 deletions
|
|
@ -0,0 +1,33 @@
|
|||
package com.keylesspalace.tusky.view
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.VideoView
|
||||
|
||||
class ExposedPlayPauseVideoView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0)
|
||||
: VideoView(context, attrs, defStyleAttr) {
|
||||
|
||||
private var listener: PlayPauseListener? = null
|
||||
|
||||
fun setPlayPauseListener(listener: PlayPauseListener) {
|
||||
this.listener = listener
|
||||
}
|
||||
|
||||
override fun start() {
|
||||
super.start()
|
||||
listener?.onPlay()
|
||||
}
|
||||
|
||||
override fun pause() {
|
||||
super.pause()
|
||||
listener?.onPause()
|
||||
}
|
||||
|
||||
interface PlayPauseListener {
|
||||
fun onPlay()
|
||||
fun onPause()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue