Audio caption improvements (#2220)

* Fix caption display in audio player

* Make video/audio description scrollable

* Constrain the maximum size of media label previews
This commit is contained in:
Levi Bard 2021-09-17 21:55:54 +02:00 committed by GitHub
commit 45598cf047
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View file

@ -21,6 +21,7 @@ import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.method.ScrollingMovementMethod
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
@ -79,6 +80,7 @@ class ViewVideoFragment : ViewMediaFragment() {
) {
binding.mediaDescription.text = description
binding.mediaDescription.visible(showingDescription)
binding.mediaDescription.movementMethod = ScrollingMovementMethod()
binding.videoView.transitionName = url
binding.videoView.setVideoPath(url)
@ -125,7 +127,10 @@ class ViewVideoFragment : ViewMediaFragment() {
val videoWidth = mp.videoWidth.toFloat()
val videoHeight = mp.videoHeight.toFloat()
if (containerWidth / containerHeight > videoWidth / videoHeight) {
if (isAudio) {
binding.videoView.layoutParams.height = 1
binding.videoView.layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT
} else if (containerWidth / containerHeight > videoWidth / videoHeight) {
binding.videoView.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
binding.videoView.layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT
} else {