android: input bar — single right icon (PTT when empty, Send when text)
This commit is contained in:
1 parent
b90728be3c
commit
b11e705f7a
1 file changed
+14
-20
+14
-20
@@ -168,15 +168,27 @@ fun InputBar(
|
||||
Spacer(Modifier.width(4.dp))
|
||||
|
||||
if (isRecording && isRecordingLocked) {
|
||||
/* Locked: cancel + send voice — PTT box replaced by action buttons */
|
||||
/* Locked: cancel + send voice */
|
||||
IconButton(onClick = onVoiceCancel) {
|
||||
Text("\u2715", fontSize = 20.sp, color = Color(0xFFE53935))
|
||||
}
|
||||
IconButton(onClick = onVoiceSend) {
|
||||
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 {
|
||||
/* 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
|
||||
Box(
|
||||
modifier = Modifier
|
||||
@@ -221,24 +233,6 @@ fun InputBar(
|
||||
) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user