mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Mirror playback icons for RTL
This commit is contained in:
parent
bd767c570b
commit
7ff4b0cf10
1 changed files with 7 additions and 4 deletions
|
|
@ -42,10 +42,12 @@ import androidx.compose.ui.focus.onFocusChanged
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.isSpecified
|
import androidx.compose.ui.graphics.isSpecified
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
|
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||||
import androidx.compose.ui.platform.LocalView
|
import androidx.compose.ui.platform.LocalView
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.LayoutDirection
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
|
|
@ -368,12 +370,13 @@ fun PlaybackButtons(
|
||||||
seekForward: Duration,
|
seekForward: Duration,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
val isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier.focusGroup(),
|
modifier = modifier.focusGroup(),
|
||||||
horizontalArrangement = Arrangement.spacedBy(buttonSpacing),
|
horizontalArrangement = Arrangement.spacedBy(buttonSpacing),
|
||||||
) {
|
) {
|
||||||
PlaybackButton(
|
PlaybackButton(
|
||||||
iconRes = R.drawable.baseline_skip_previous_24,
|
iconRes = if (isLtr) R.drawable.baseline_skip_previous_24 else R.drawable.baseline_skip_next_24,
|
||||||
onClick = {
|
onClick = {
|
||||||
onControllerInteraction.invoke()
|
onControllerInteraction.invoke()
|
||||||
onPlaybackActionClick.invoke(PlaybackAction.Previous)
|
onPlaybackActionClick.invoke(PlaybackAction.Previous)
|
||||||
|
|
@ -382,7 +385,7 @@ fun PlaybackButtons(
|
||||||
onControllerInteraction = onControllerInteraction,
|
onControllerInteraction = onControllerInteraction,
|
||||||
)
|
)
|
||||||
PlaybackButton(
|
PlaybackButton(
|
||||||
iconRes = R.drawable.baseline_fast_rewind_24,
|
iconRes = if (isLtr) R.drawable.baseline_fast_rewind_24 else R.drawable.baseline_fast_forward_24,
|
||||||
onClick = {
|
onClick = {
|
||||||
onControllerInteraction.invoke()
|
onControllerInteraction.invoke()
|
||||||
player.seekBack(seekBack)
|
player.seekBack(seekBack)
|
||||||
|
|
@ -406,7 +409,7 @@ fun PlaybackButtons(
|
||||||
onControllerInteraction = onControllerInteraction,
|
onControllerInteraction = onControllerInteraction,
|
||||||
)
|
)
|
||||||
PlaybackButton(
|
PlaybackButton(
|
||||||
iconRes = R.drawable.baseline_fast_forward_24,
|
iconRes = if (isLtr) R.drawable.baseline_fast_forward_24 else R.drawable.baseline_fast_rewind_24,
|
||||||
onClick = {
|
onClick = {
|
||||||
onControllerInteraction.invoke()
|
onControllerInteraction.invoke()
|
||||||
player.seekForward(seekForward)
|
player.seekForward(seekForward)
|
||||||
|
|
@ -414,7 +417,7 @@ fun PlaybackButtons(
|
||||||
onControllerInteraction = onControllerInteraction,
|
onControllerInteraction = onControllerInteraction,
|
||||||
)
|
)
|
||||||
PlaybackButton(
|
PlaybackButton(
|
||||||
iconRes = R.drawable.baseline_skip_next_24,
|
iconRes = if (isLtr) R.drawable.baseline_skip_next_24 else R.drawable.baseline_skip_previous_24,
|
||||||
onClick = {
|
onClick = {
|
||||||
onControllerInteraction.invoke()
|
onControllerInteraction.invoke()
|
||||||
onPlaybackActionClick.invoke(PlaybackAction.Next)
|
onPlaybackActionClick.invoke(PlaybackAction.Next)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue