Fix video tips for RTL

This commit is contained in:
Nicolas Pomepuy 2024-11-22 11:56:43 +01:00
parent 148fcd7097
commit 7c5f6795b8
2 changed files with 23 additions and 16 deletions

View File

@ -58,9 +58,9 @@
android:textColor="?attr/font_default"
android:textSize="24sp"
app:layout_constraintBottom_toTopOf="@+id/guideline8"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
tools:text="Help title" />
<TextView
@ -74,9 +74,9 @@
android:textColor="@color/white_transparent_50"
android:textSize="14sp"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline8"
tools:text="Help description" />
@ -261,7 +261,7 @@
android:layout_marginEnd="24dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
@ -300,7 +300,7 @@
android:layout_marginStart="24dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/guideline8"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline8"
tools:visibility="visible" />

View File

@ -46,6 +46,7 @@ import org.videolan.tools.*
import org.videolan.vlc.R
import org.videolan.vlc.gui.helpers.TipsUtils
import org.videolan.vlc.gui.view.PlayerProgress
import org.videolan.vlc.util.LocaleUtil
/**
* Delegate to manage the video tips workflow.
@ -233,17 +234,23 @@ class VideoTipsDelegate(private val player: VideoPlayerActivity) : OnClickListen
clearAllAnimations()
nextButton.setText(R.string.next_step)
// For RTL, we have to invert some constraints as the volume and brightness gestures are kept at the same side of the screen
val independentStart = if (LocaleUtil.isRtl()) ConstraintSet.END else ConstraintSet.START
val independentEnd = if (LocaleUtil.isRtl()) ConstraintSet.START else ConstraintSet.END
when (currentTip) {
VideoPlayerTipsStep.CONTROLS -> {
getTapIndicators().forEach { constraintSet.setVisibility(it.id, VISIBLE) }
TipsUtils.startTapAnimation(getTapIndicators().toList())
}
VideoPlayerTipsStep.BRIGHTNESS -> {
constraintSet.connect(R.id.helpTitle, ConstraintSet.START, R.id.tap_gesture_background, ConstraintSet.END, 16.dp)
constraintSet.connect(R.id.helpTitle, ConstraintSet.END, R.id.tipsBrightnessProgress, ConstraintSet.START, 16.dp)
constraintSet.clear(R.id.tap_gesture_background, independentEnd)
constraintSet.connect(R.id.tap_gesture_background, independentStart, ConstraintSet.PARENT_ID, independentStart, 32.dp)
constraintSet.connect(R.id.helpTitle, ConstraintSet.LEFT, R.id.tap_gesture_background, ConstraintSet.RIGHT, 16.dp)
constraintSet.connect(R.id.helpTitle, ConstraintSet.RIGHT, R.id.tipsBrightnessProgress, ConstraintSet.LEFT, 16.dp)
constraintSet.setHorizontalBias(R.id.helpTitle, 1F)
constraintSet.connect(R.id.helpDescription, ConstraintSet.START, R.id.tap_gesture_background, ConstraintSet.END, 16.dp)
constraintSet.connect(R.id.helpDescription, ConstraintSet.END, R.id.tipsBrightnessProgress, ConstraintSet.START, 16.dp)
constraintSet.connect(R.id.helpDescription, ConstraintSet.LEFT, R.id.tap_gesture_background, ConstraintSet.RIGHT, 16.dp)
constraintSet.connect(R.id.helpDescription, ConstraintSet.RIGHT, R.id.tipsBrightnessProgress, ConstraintSet.LEFT, 16.dp)
constraintSet.setHorizontalBias(R.id.helpDescription, 1F)
constraintSet.setVisibility(R.id.tapGesture, VISIBLE)
@ -255,14 +262,14 @@ class VideoTipsDelegate(private val player: VideoPlayerActivity) : OnClickListen
currentAnimations.add(swipe(tipsBrightnessProgress, tipsBrightnessText))
}
VideoPlayerTipsStep.VOLUME -> {
constraintSet.clear(R.id.tap_gesture_background, ConstraintSet.START)
constraintSet.connect(R.id.tap_gesture_background, ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END, 32.dp)
constraintSet.clear(R.id.tap_gesture_background, independentStart)
constraintSet.connect(R.id.tap_gesture_background, independentEnd, ConstraintSet.PARENT_ID, independentEnd, 32.dp)
constraintSet.connect(R.id.helpTitle, ConstraintSet.START, R.id.tipsVolumeProgress, ConstraintSet.END, 16.dp)
constraintSet.connect(R.id.helpTitle, ConstraintSet.END, R.id.tap_gesture_background, ConstraintSet.START, 16.dp)
constraintSet.connect(R.id.helpTitle, ConstraintSet.LEFT, R.id.tipsVolumeProgress, ConstraintSet.RIGHT, 16.dp)
constraintSet.connect(R.id.helpTitle, ConstraintSet.RIGHT, R.id.tap_gesture_background, ConstraintSet.LEFT, 16.dp)
constraintSet.setHorizontalBias(R.id.helpTitle, 0F)
constraintSet.connect(R.id.helpDescription, ConstraintSet.START, R.id.tipsVolumeProgress, ConstraintSet.END, 16.dp)
constraintSet.connect(R.id.helpDescription, ConstraintSet.END, R.id.tap_gesture_background, ConstraintSet.START, 16.dp)
constraintSet.connect(R.id.helpDescription, ConstraintSet.LEFT, R.id.tipsVolumeProgress, ConstraintSet.RIGHT, 16.dp)
constraintSet.connect(R.id.helpDescription, ConstraintSet.RIGHT, R.id.tap_gesture_background, ConstraintSet.LEFT, 16.dp)
constraintSet.setHorizontalBias(R.id.helpDescription, 0F)
constraintSet.setVisibility(R.id.tapGesture, VISIBLE)