feat: add support for simple speech to text #34

Merged
reya merged 2 commits from feat/speech-to-text into master 2026-07-03 08:38:59 +00:00
Showing only changes of commit 51c268c455 - Show all commits

View File

@@ -6,6 +6,12 @@ import android.net.Uri
import android.speech.RecognizerIntent import android.speech.RecognizerIntent
import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
@@ -608,11 +614,16 @@ fun ChatInput(
}, },
) )
Spacer(modifier = Modifier.size(8.dp)) Spacer(modifier = Modifier.size(8.dp))
if (value.isNotEmpty()) { AnimatedContent(
FilledTonalIconButton( targetState = value.isNotEmpty(),
transitionSpec = { (scaleIn() + fadeIn()) togetherWith (scaleOut() + fadeOut()) },
label = "send_mic_transition"
) { isNotEmpty ->
if (isNotEmpty) {
IconButton(
onClick = onSend, onClick = onSend,
modifier = Modifier.size(56.dp), modifier = Modifier.size(56.dp),
colors = IconButtonDefaults.filledTonalIconButtonColors( colors = IconButtonDefaults.iconButtonColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant, containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant contentColor = MaterialTheme.colorScheme.onSurfaceVariant
) )
@@ -626,10 +637,6 @@ fun ChatInput(
FilledTonalIconButton( FilledTonalIconButton(
onClick = onMicClick, onClick = onMicClick,
modifier = Modifier.size(56.dp), modifier = Modifier.size(56.dp),
colors = IconButtonDefaults.filledTonalIconButtonColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) { ) {
Icon( Icon(
painter = painterResource(Res.drawable.ic_audio), painter = painterResource(Res.drawable.ic_audio),
@@ -639,3 +646,4 @@ fun ChatInput(
} }
} }
} }
}