Browse Source

android: input bar — single right icon (PTT when empty, Send when text)

topo_upd
evgeny 2 months ago
parent
commit
b11e705f7a
  1. 34
      tools/chatgui-android/app/src/main/java/com/utun/chat/ui/components/MessageBubble.kt

34
tools/chatgui-android/app/src/main/java/com/utun/chat/ui/components/MessageBubble.kt

@ -168,15 +168,27 @@ fun InputBar(
Spacer(Modifier.width(4.dp)) Spacer(Modifier.width(4.dp))
if (isRecording && isRecordingLocked) { if (isRecording && isRecordingLocked) {
/* Locked: cancel + send voice — PTT box replaced by action buttons */ /* Locked: cancel + send voice */
IconButton(onClick = onVoiceCancel) { IconButton(onClick = onVoiceCancel) {
Text("\u2715", fontSize = 20.sp, color = Color(0xFFE53935)) Text("\u2715", fontSize = 20.sp, color = Color(0xFFE53935))
} }
IconButton(onClick = onVoiceSend) { IconButton(onClick = onVoiceSend) {
Text("\u25B6", fontSize = 20.sp, color = Color(0xFF4CAF50)) Text("\u25B6", fontSize = 20.sp, color = Color(0xFF4CAF50))
} }
} else if (!isRecording && text.isNotBlank()) {
/* Send button — round, primary color */
val sendColor = MaterialTheme.colorScheme.primary
Box(
modifier = Modifier
.size(44.dp)
.background(sendColor, CircleShape)
.clickable { onSend() },
contentAlignment = Alignment.Center
) {
Text("\u27A4", fontSize = 22.sp, color = Color.White)
}
} else { } else {
/* PTT Box — always present (same identity), just changes appearance */ /* PTT Box — podcast/recording, same identity in idle and holding */
val pttBg = if (isRecording) Color(0xFFE53935) else Color.Transparent val pttBg = if (isRecording) Color(0xFFE53935) else Color.Transparent
Box( Box(
modifier = Modifier modifier = Modifier
@ -221,24 +233,6 @@ fun InputBar(
) { ) {
Text("\uD83C\uDFA4", fontSize = 20.sp, color = if (isRecording) Color.White else Color.Unspecified) Text("\uD83C\uDFA4", fontSize = 20.sp, color = if (isRecording) Color.White else Color.Unspecified)
} }
if (!isRecording) {
Spacer(Modifier.width(4.dp))
val sendColor = MaterialTheme.colorScheme.primary
val sendEnabled = enabled && text.isNotBlank()
Box(
modifier = Modifier
.size(44.dp)
.background(
if (sendEnabled) sendColor else sendColor.copy(alpha = 0.35f),
CircleShape
)
.clickable { if (sendEnabled) onSend() },
contentAlignment = Alignment.Center
) {
Text("\u27A4", fontSize = 22.sp, color = Color.White)
}
}
} }
} }
} }

Loading…
Cancel
Save