Let the preview provider use stable data. I do not get why the generated screenshot was always similar.
This commit is contained in:
committed by
Benoit Marty
parent
93ae7941a4
commit
90cd52b5d5
@@ -52,7 +52,7 @@ import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.libraries.androidutils.ui.showKeyboard
|
||||
import io.element.android.libraries.designsystem.components.media.createFakeWaveform
|
||||
import io.element.android.libraries.designsystem.components.media.WaveFormSamples
|
||||
import io.element.android.libraries.designsystem.preview.DAY_MODE_NAME
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.NIGHT_MODE_NAME
|
||||
@@ -808,30 +808,33 @@ internal fun TextComposerCaptionPreview() = ElementPreview {
|
||||
internal fun TextComposerVoicePreview() = ElementPreview {
|
||||
PreviewColumn(
|
||||
items = persistentListOf(
|
||||
VoiceMessageState.Recording(61.seconds, createFakeWaveform()),
|
||||
VoiceMessageState.Recording(
|
||||
duration = 61.seconds,
|
||||
levels = WaveFormSamples.realisticWaveForm,
|
||||
),
|
||||
VoiceMessageState.Preview(
|
||||
isSending = false,
|
||||
isPlaying = false,
|
||||
showCursor = false,
|
||||
waveform = createFakeWaveform(),
|
||||
waveform = WaveFormSamples.realisticWaveForm,
|
||||
time = 0.seconds,
|
||||
playbackProgress = 0.0f
|
||||
playbackProgress = 0.0f,
|
||||
),
|
||||
VoiceMessageState.Preview(
|
||||
isSending = false,
|
||||
isPlaying = true,
|
||||
showCursor = true,
|
||||
waveform = createFakeWaveform(),
|
||||
waveform = WaveFormSamples.realisticWaveForm,
|
||||
time = 3.seconds,
|
||||
playbackProgress = 0.2f
|
||||
playbackProgress = 0.2f,
|
||||
),
|
||||
VoiceMessageState.Preview(
|
||||
isSending = true,
|
||||
isPlaying = false,
|
||||
showCursor = false,
|
||||
waveform = createFakeWaveform(),
|
||||
waveform = WaveFormSamples.realisticWaveForm,
|
||||
time = 61.seconds,
|
||||
playbackProgress = 0.0f
|
||||
playbackProgress = 0.0f,
|
||||
),
|
||||
)
|
||||
) { voiceMessageState ->
|
||||
@@ -848,12 +851,15 @@ internal fun TextComposerVoicePreview() = ElementPreview {
|
||||
internal fun TextComposerVoiceNotEncryptedPreview() = ElementPreview {
|
||||
PreviewColumn(
|
||||
items = persistentListOf(
|
||||
VoiceMessageState.Recording(61.seconds, createFakeWaveform()),
|
||||
VoiceMessageState.Recording(
|
||||
duration = 61.seconds,
|
||||
levels = WaveFormSamples.realisticWaveForm,
|
||||
),
|
||||
VoiceMessageState.Preview(
|
||||
isSending = false,
|
||||
isPlaying = false,
|
||||
showCursor = false,
|
||||
waveform = createFakeWaveform(),
|
||||
waveform = WaveFormSamples.realisticWaveForm,
|
||||
time = 0.seconds,
|
||||
playbackProgress = 0.0f
|
||||
),
|
||||
@@ -861,7 +867,7 @@ internal fun TextComposerVoiceNotEncryptedPreview() = ElementPreview {
|
||||
isSending = false,
|
||||
isPlaying = true,
|
||||
showCursor = true,
|
||||
waveform = createFakeWaveform(),
|
||||
waveform = WaveFormSamples.realisticWaveForm,
|
||||
time = 3.seconds,
|
||||
playbackProgress = 0.2f
|
||||
),
|
||||
@@ -869,7 +875,7 @@ internal fun TextComposerVoiceNotEncryptedPreview() = ElementPreview {
|
||||
isSending = true,
|
||||
isPlaying = false,
|
||||
showCursor = false,
|
||||
waveform = createFakeWaveform(),
|
||||
waveform = WaveFormSamples.realisticWaveForm,
|
||||
time = 61.seconds,
|
||||
playbackProgress = 0.0f
|
||||
),
|
||||
|
||||
@@ -29,8 +29,8 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.libraries.designsystem.components.media.WaveFormSamples
|
||||
import io.element.android.libraries.designsystem.components.media.WaveformPlaybackView
|
||||
import io.element.android.libraries.designsystem.components.media.createFakeWaveform
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
@@ -138,14 +138,18 @@ private fun PlayerButton(
|
||||
private fun PauseIcon() = Icon(
|
||||
imageVector = CompoundIcons.PauseSolid(),
|
||||
contentDescription = stringResource(id = CommonStrings.a11y_pause),
|
||||
modifier = Modifier.size(20.dp).padding(2.dp),
|
||||
modifier = Modifier
|
||||
.size(20.dp)
|
||||
.padding(2.dp),
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun PlayIcon() = Icon(
|
||||
imageVector = CompoundIcons.PlaySolid(),
|
||||
contentDescription = stringResource(id = CommonStrings.a11y_play),
|
||||
modifier = Modifier.size(20.dp).padding(2.dp),
|
||||
modifier = Modifier
|
||||
.size(20.dp)
|
||||
.padding(2.dp),
|
||||
)
|
||||
|
||||
@PreviewsDayNight
|
||||
@@ -160,7 +164,7 @@ internal fun VoiceMessagePreviewPreview() = ElementPreview {
|
||||
time = 2.seconds,
|
||||
playbackProgress = 0.2f,
|
||||
showCursor = true,
|
||||
waveform = createFakeWaveform()
|
||||
waveform = WaveFormSamples.longRealisticWaveForm,
|
||||
)
|
||||
AVoiceMessagePreview(
|
||||
isInteractive = true,
|
||||
@@ -168,7 +172,7 @@ internal fun VoiceMessagePreviewPreview() = ElementPreview {
|
||||
time = 0.seconds,
|
||||
playbackProgress = 0.0f,
|
||||
showCursor = true,
|
||||
waveform = createFakeWaveform()
|
||||
waveform = WaveFormSamples.longRealisticWaveForm,
|
||||
)
|
||||
AVoiceMessagePreview(
|
||||
isInteractive = false,
|
||||
@@ -176,7 +180,7 @@ internal fun VoiceMessagePreviewPreview() = ElementPreview {
|
||||
time = 789.seconds,
|
||||
playbackProgress = 0.0f,
|
||||
showCursor = false,
|
||||
waveform = createFakeWaveform()
|
||||
waveform = WaveFormSamples.longRealisticWaveForm,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user