mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Video player: Iterate on Play/Pause button
This commit is contained in:
committed by
Benoit Marty
parent
1f61be8f86
commit
3f9621e4af
+19
-3
@@ -11,10 +11,13 @@ import androidx.compose.animation.AnimatedVisibility
|
|||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableFloatStateOf
|
import androidx.compose.runtime.mutableFloatStateOf
|
||||||
@@ -63,8 +66,21 @@ fun MediaPlayerControllerView(
|
|||||||
.widthIn(max = 480.dp),
|
.widthIn(max = 480.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
IconButton(
|
val bgColor = if (state.isPlaying) {
|
||||||
onClick = onTogglePlay,
|
ElementTheme.colors.bgCanvasDefault
|
||||||
|
} else {
|
||||||
|
ElementTheme.colors.textPrimary
|
||||||
|
}
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.clickable { onTogglePlay() }
|
||||||
|
.size(36.dp)
|
||||||
|
.background(
|
||||||
|
color = bgColor,
|
||||||
|
shape = CircleShape,
|
||||||
|
)
|
||||||
|
.padding(8.dp),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
if (state.isPlaying) {
|
if (state.isPlaying) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -75,7 +91,7 @@ fun MediaPlayerControllerView(
|
|||||||
} else {
|
} else {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = CompoundIcons.PlaySolid(),
|
imageVector = CompoundIcons.PlaySolid(),
|
||||||
tint = ElementTheme.colors.iconPrimary,
|
tint = ElementTheme.colors.iconOnSolidPrimary,
|
||||||
contentDescription = stringResource(CommonStrings.a11y_play)
|
contentDescription = stringResource(CommonStrings.a11y_play)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user