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:
parent
49fbe1f408
commit
74d479c3dc
@ -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)
|
||||
}
|
||||
})
|
||||
|
@ -8,22 +8,6 @@
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mediaDescription"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:background="#60000000"
|
||||
android:hyphenationFrequency="full"
|
||||
android:lineSpacingMultiplier="1.1"
|
||||
android:padding="8dp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#eee"
|
||||
android:textSize="?attr/status_text_medium"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Some media description" />
|
||||
|
||||
<androidx.media3.ui.PlayerView
|
||||
android:id="@+id/videoView"
|
||||
android:layout_width="wrap_content"
|
||||
@ -38,6 +22,30 @@
|
||||
app:show_timeout="0"
|
||||
app:hide_on_touch="false" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/mediaDescriptionScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:layout_marginBottom="160dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mediaDescriptionTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#60000000"
|
||||
android:hyphenationFrequency="full"
|
||||
android:lineSpacingMultiplier="1.1"
|
||||
android:padding="8dp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#eee"
|
||||
android:textSize="?attr/status_text_medium"
|
||||
tools:text="Some media description" />
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
x
Reference in New Issue
Block a user