Fixes issue where alt text positioning covers video controller (#4632)

Fixes issue where alt text positioning covers video controller
Also adds scroll view for more responsive scrolling
closes #4165
This commit is contained in:
andrewhamilton0 2024-09-02 12:39:23 -04:00 committed by GitHub
commit 74d479c3dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 25 deletions

View file

@ -22,7 +22,6 @@ import android.graphics.drawable.Drawable
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.method.ScrollingMovementMethod
import android.view.GestureDetector
import android.view.Gravity
import android.view.LayoutInflater
@ -353,12 +352,11 @@ class ViewVideoFragment : ViewMediaFragment() {
description: String?,
showingDescription: Boolean
) {
binding.mediaDescription.text = description
binding.mediaDescription.visible(showingDescription)
binding.mediaDescription.movementMethod = ScrollingMovementMethod()
binding.mediaDescriptionTextView.text = description
binding.mediaDescriptionScrollView.visible(showingDescription)
// Ensure the description is visible over the video
binding.mediaDescription.elevation = binding.videoView.elevation + 1
binding.mediaDescriptionScrollView.elevation = binding.videoView.elevation + 1
binding.videoView.transitionName = url
@ -383,16 +381,16 @@ class ViewVideoFragment : ViewMediaFragment() {
val alpha = if (isDescriptionVisible) 1.0f else 0.0f
if (isDescriptionVisible) {
// If to be visible, need to make visible immediately and animate alpha
binding.mediaDescription.alpha = 0.0f
binding.mediaDescription.visible(isDescriptionVisible)
binding.mediaDescriptionScrollView.alpha = 0.0f
binding.mediaDescriptionScrollView.visible(isDescriptionVisible)
}
binding.mediaDescription.animate().alpha(alpha)
binding.mediaDescriptionScrollView.animate().alpha(alpha)
.setListener(object : AnimatorListenerAdapter() {
@SuppressLint("SyntheticAccessor")
override fun onAnimationEnd(animation: Animator) {
view ?: return
binding.mediaDescription.visible(isDescriptionVisible)
binding.mediaDescriptionScrollView.visible(isDescriptionVisible)
animation.removeListener(this)
}
})