Skip to content

Commit 4dfec91

Browse files
authored
Revert "voice note player ui (#680)" (#690)
This reverts commit bc8909b.
1 parent e3c7bd5 commit 4dfec91

3 files changed

Lines changed: 13 additions & 38 deletions

File tree

app/src/main/java/com/bitchat/android/ui/media/VoiceNotePlayer.kt

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package com.bitchat.android.ui.media
22

33
import android.media.MediaPlayer
4-
import androidx.compose.foundation.border
5-
import androidx.compose.foundation.isSystemInDarkTheme
4+
import androidx.compose.foundation.background
5+
import androidx.compose.foundation.clickable
66
import androidx.compose.foundation.layout.*
7-
import androidx.compose.foundation.shape.RoundedCornerShape
7+
import androidx.compose.foundation.shape.CircleShape
88
import androidx.compose.material.icons.Icons
99
import androidx.compose.material.icons.filled.Pause
1010
import androidx.compose.material.icons.filled.PlayArrow
1111
import androidx.compose.material3.FilledTonalIconButton
1212
import androidx.compose.material3.Icon
13-
import androidx.compose.material3.IconButtonDefaults
1413
import androidx.compose.material3.MaterialTheme
1514
import androidx.compose.material3.Text
1615
import androidx.compose.runtime.*
@@ -34,8 +33,6 @@ fun VoiceNotePlayer(
3433
var durationMs by remember { mutableStateOf(0) }
3534
val player = remember { MediaPlayer() }
3635

37-
val borderOpacity = if (isSystemInDarkTheme()) 0.3f else 0.2f
38-
3936
// Seek function - position is a fraction from 0.0 to 1.0
4037
val seekTo: (Float) -> Unit = { position ->
4138
if (isPrepared && durationMs > 0) {
@@ -89,34 +86,20 @@ fun VoiceNotePlayer(
8986
DisposableEffect(Unit) { onDispose { try { player.release() } catch (_: Exception) {} } }
9087

9188
Row(
92-
modifier = Modifier.fillMaxWidth()
93-
.border(
94-
color = MaterialTheme.colorScheme.primary.copy(alpha = borderOpacity),
95-
width = 1.0.dp,
96-
shape = RoundedCornerShape(14.dp)
97-
)
98-
.padding(12.dp),
89+
modifier = Modifier.fillMaxWidth(),
9990
verticalAlignment = Alignment.CenterVertically,
100-
horizontalArrangement = Arrangement.spacedBy(8.dp),
91+
horizontalArrangement = Arrangement.spacedBy(8.dp)
10192
) {
10293
// Disable play/pause while showing send progress override (optional UX choice)
10394
val controlsEnabled = isPrepared && !isError && progressOverride == null
104-
FilledTonalIconButton(
105-
onClick = { if (controlsEnabled) isPlaying = !isPlaying },
106-
enabled = controlsEnabled,
107-
modifier = Modifier.size(28.dp),
108-
colors = IconButtonDefaults.filledTonalIconButtonColors(
109-
containerColor = MaterialTheme.colorScheme.primary,
110-
contentColor = MaterialTheme.colorScheme.onPrimary
111-
),
112-
) {
95+
FilledTonalIconButton(onClick = { if (controlsEnabled) isPlaying = !isPlaying }, enabled = controlsEnabled, modifier = Modifier.size(28.dp)) {
11396
Icon(
11497
imageVector = if (isPlaying) Icons.Filled.Pause else Icons.Filled.PlayArrow,
11598
contentDescription = if (isPlaying) "Pause" else "Play"
11699
)
117100
}
118-
119-
WaveformPreview(
101+
val progressBarColor = progressColor ?: MaterialTheme.colorScheme.primary
102+
com.bitchat.android.ui.media.WaveformPreview(
120103
modifier = Modifier
121104
.height(24.dp)
122105
.weight(1f)
@@ -127,12 +110,7 @@ fun VoiceNotePlayer(
127110
onSeek = seekTo
128111
)
129112
val durText = if (durationMs > 0) String.format("%02d:%02d", (durationMs / 1000) / 60, (durationMs / 1000) % 60) else "--:--"
130-
Text(
131-
color = MaterialTheme.colorScheme.tertiary,
132-
text = durText,
133-
fontFamily = FontFamily.Monospace,
134-
fontSize = 12.sp,
135-
)
113+
Text(text = durText, fontFamily = FontFamily.Monospace, fontSize = 12.sp)
136114
}
137115
}
138116

app/src/main/java/com/bitchat/android/ui/media/WaveformViews.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import androidx.compose.runtime.withFrameNanos
1111
import androidx.compose.runtime.getValue
1212
import androidx.compose.runtime.rememberUpdatedState
1313
import androidx.compose.foundation.gestures.detectTapGestures
14-
import androidx.compose.material3.MaterialTheme
1514
import androidx.compose.ui.input.pointer.pointerInput
1615
import androidx.compose.ui.Modifier
1716
import androidx.compose.ui.geometry.Offset
@@ -75,10 +74,10 @@ fun WaveformPreview(
7574
modifier = modifier,
7675
samples = stateSamples,
7776
fillProgress = if (stateSamples.isEmpty()) 0f else progress,
78-
baseColor = Color.Gray.copy(alpha = 0.35f),
77+
baseColor = Color(0x2200FF7F),
7978
fillColor = when {
8079
sendProgress != null -> Color(0xFF1E88E5) // blue while sending
81-
else -> MaterialTheme.colorScheme.primary // green during playback
80+
else -> Color(0xFF00C851) // green during playback
8281
},
8382
onSeek = onSeek
8483
)

app/src/main/java/com/bitchat/android/ui/theme/Theme.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ private val DarkColorScheme = darkColorScheme(
2727
surface = Color(0xFF111111), // Very dark gray
2828
onSurface = Color(0xFF39FF14), // Green text
2929
error = Color(0xFFFF5555), // Red for errors
30-
onError = Color.Black,
31-
tertiary = Color(0x99EBEBF5),
30+
onError = Color.Black
3231
)
3332

3433
private val LightColorScheme = lightColorScheme(
@@ -41,8 +40,7 @@ private val LightColorScheme = lightColorScheme(
4140
surface = Color(0xFFF8F8F8), // Very light gray
4241
onSurface = Color(0xFF008000), // Dark green text
4342
error = Color(0xFFCC0000), // Dark red for errors
44-
onError = Color.White,
45-
tertiary = Color(0x993C3C43)
43+
onError = Color.White
4644
)
4745

4846
@Composable

0 commit comments

Comments
 (0)