mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 19:18:52 +01:00
Add code to check if there is a STT provider on device.
This commit is contained in:
@@ -155,6 +155,17 @@ class ComposeActivity : QkThemedActivity(), ComposeView {
|
||||
showBackButton(true)
|
||||
viewModel.bindView(this)
|
||||
|
||||
// Check if there is a speech recognition service available
|
||||
val packageManager = packageManager
|
||||
val speechRecognizerIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
|
||||
val resolveInfoList = packageManager.queryIntentActivities(speechRecognizerIntent, PackageManager.MATCH_DEFAULT_ONLY)
|
||||
|
||||
if (resolveInfoList.isEmpty()) {
|
||||
// No STT provider found, show a Toast message
|
||||
Toast.makeText(this, "No speech-to-text service available on this device.", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
|
||||
contentView.layoutTransition = LayoutTransition().apply {
|
||||
disableTransitionType(LayoutTransition.CHANGING)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user