Skip to content

Commit 8809dcd

Browse files
committed
Cleanup
1 parent 7504a51 commit 8809dcd

File tree

1 file changed

+39
-33
lines changed
  • libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/audio

1 file changed

+39
-33
lines changed

libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/audio/MediaAudioView.kt

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import android.widget.FrameLayout
1414
import androidx.compose.foundation.background
1515
import androidx.compose.foundation.layout.Box
1616
import androidx.compose.foundation.layout.Column
17-
import androidx.compose.foundation.layout.ColumnScope
1817
import androidx.compose.foundation.layout.Spacer
1918
import androidx.compose.foundation.layout.fillMaxSize
2019
import androidx.compose.foundation.layout.fillMaxWidth
@@ -69,8 +68,8 @@ import io.element.android.libraries.mediaviewer.impl.local.LocalMediaViewState
6968
import io.element.android.libraries.mediaviewer.impl.local.PlayableState
7069
import io.element.android.libraries.mediaviewer.impl.local.player.MediaPlayerControllerState
7170
import io.element.android.libraries.mediaviewer.impl.local.player.MediaPlayerControllerView
72-
import io.element.android.libraries.mediaviewer.impl.local.player.seekToEnsurePlaying
7371
import io.element.android.libraries.mediaviewer.impl.local.player.rememberExoPlayer
72+
import io.element.android.libraries.mediaviewer.impl.local.player.seekToEnsurePlaying
7473
import io.element.android.libraries.mediaviewer.impl.local.player.togglePlay
7574
import io.element.android.libraries.mediaviewer.impl.local.rememberLocalMediaViewState
7675
import kotlinx.collections.immutable.toPersistentList
@@ -270,6 +269,7 @@ private fun ExoPlayerMediaAudioView(
270269
if (waveform == null) {
271270
// Display the info below the player
272271
AudioInfoView(
272+
modifier = Modifier.padding(horizontal = 16.dp),
273273
info = info,
274274
metadata = metadata,
275275
)
@@ -308,40 +308,46 @@ private fun ExoPlayerMediaAudioView(
308308
}
309309

310310
@Composable
311-
fun ColumnScope.AudioInfoView(
311+
private fun AudioInfoView(
312312
info: MediaInfo?,
313313
metadata: MediaMetadata?,
314+
modifier: Modifier = Modifier,
314315
) {
315-
// Render the info about the file and from the metadata
316-
val metaDataInfo = metadata.buildInfo()
317-
if (metaDataInfo.isNotEmpty()) {
318-
Spacer(modifier = Modifier.height(16.dp))
319-
Text(
320-
text = metaDataInfo,
321-
style = ElementTheme.typography.fontBodyMdRegular,
322-
maxLines = 1,
323-
overflow = TextOverflow.Ellipsis,
324-
color = MaterialTheme.colorScheme.primary
325-
)
326-
}
327-
if (info != null) {
328-
Spacer(modifier = Modifier.height(24.dp))
329-
Text(
330-
text = info.filename,
331-
maxLines = 2,
332-
style = ElementTheme.typography.fontBodyLgRegular,
333-
overflow = TextOverflow.Ellipsis,
334-
textAlign = TextAlign.Center,
335-
color = MaterialTheme.colorScheme.primary
336-
)
337-
Spacer(modifier = Modifier.height(4.dp))
338-
Text(
339-
text = formatFileExtensionAndSize(info.fileExtension, info.formattedFileSize),
340-
style = ElementTheme.typography.fontBodyMdRegular,
341-
maxLines = 1,
342-
overflow = TextOverflow.Ellipsis,
343-
color = MaterialTheme.colorScheme.primary
344-
)
316+
Column(
317+
modifier = modifier.fillMaxWidth(),
318+
horizontalAlignment = Alignment.CenterHorizontally,
319+
) {
320+
// Render the info about the file and from the metadata
321+
val metaDataInfo = metadata.buildInfo()
322+
if (metaDataInfo.isNotEmpty()) {
323+
Spacer(modifier = Modifier.height(16.dp))
324+
Text(
325+
text = metaDataInfo,
326+
style = ElementTheme.typography.fontBodyMdRegular,
327+
maxLines = 1,
328+
overflow = TextOverflow.Ellipsis,
329+
color = MaterialTheme.colorScheme.primary
330+
)
331+
}
332+
if (info != null) {
333+
Spacer(modifier = Modifier.height(24.dp))
334+
Text(
335+
text = info.filename,
336+
maxLines = 2,
337+
style = ElementTheme.typography.fontBodyLgRegular,
338+
overflow = TextOverflow.Ellipsis,
339+
textAlign = TextAlign.Center,
340+
color = MaterialTheme.colorScheme.primary
341+
)
342+
Spacer(modifier = Modifier.height(4.dp))
343+
Text(
344+
text = formatFileExtensionAndSize(info.fileExtension, info.formattedFileSize),
345+
style = ElementTheme.typography.fontBodyMdRegular,
346+
maxLines = 1,
347+
overflow = TextOverflow.Ellipsis,
348+
color = MaterialTheme.colorScheme.primary
349+
)
350+
}
345351
}
346352
}
347353

0 commit comments

Comments
 (0)