Package org.robolectric.shadows
Class ShadowSpeechRecognizer
java.lang.Object
org.robolectric.shadows.ShadowSpeechRecognizer
@Implements(android.speech.SpeechRecognizer.class) public class ShadowSpeechRecognizer extends Object
Robolectric shadow for SpeechRecognizer.
-
Field Summary
Fields Modifier and Type Field Description protected static SpeechRecognizer
latestSpeechRecognizer
-
Constructor Summary
Constructors Constructor Description ShadowSpeechRecognizer()
-
Method Summary
Modifier and Type Method Description protected void
checkRecognitionSupport(Intent recognizerIntent, Executor executor, RecognitionSupportCallback supportListener)
protected static SpeechRecognizer
createOnDeviceSpeechRecognizer(Context context)
protected static SpeechRecognizer
createSpeechRecognizer(Context context, ComponentName serviceComponent)
Intent
getLastRecognizerIntent()
Returns the argument passed to the last call toSpeechRecognizer.startListening(android.content.Intent)
.Intent
getLatestModelDownloadIntent()
static SpeechRecognizer
getLatestSpeechRecognizer()
Returns the latest SpeechRecognizer.protected void
handleChangeListener(RecognitionListener listener)
Handles changing the listener and allows access to the internal listener to trigger events and sets the latest SpeechRecognizer.protected static boolean
isOnDeviceRecognitionAvailable(Context context)
static void
reset()
static void
setIsOnDeviceRecognitionAvailable(boolean available)
protected void
startListening(Intent recognizerIntent)
protected void
triggerModelDownload(Intent recognizerIntent)
void
triggerOnEndOfSpeech()
void
triggerOnError(int error)
void
triggerOnPartialResults(Bundle bundle)
void
triggerOnReadyForSpeech(Bundle bundle)
void
triggerOnResults(Bundle bundle)
void
triggerOnRmsChanged(float rmsdB)
void
triggerSupportError(int error)
void
triggerSupportResult(RecognitionSupport recognitionSupport)
-
Field Details
-
Constructor Details
-
ShadowSpeechRecognizer
public ShadowSpeechRecognizer()
-
-
Method Details
-
getLatestSpeechRecognizer
Returns the latest SpeechRecognizer. This method can only be called afterSpeechRecognizer#createSpeechRecognizer()
is called. -
getLastRecognizerIntent
Returns the argument passed to the last call toSpeechRecognizer.startListening(android.content.Intent)
. -
reset
-
createSpeechRecognizer
@Implementation protected static SpeechRecognizer createSpeechRecognizer(Context context, ComponentName serviceComponent) -
startListening
-
handleChangeListener
Handles changing the listener and allows access to the internal listener to trigger events and sets the latest SpeechRecognizer. -
triggerOnEndOfSpeech
public void triggerOnEndOfSpeech() -
triggerOnError
public void triggerOnError(int error) -
triggerOnReadyForSpeech
-
triggerOnPartialResults
-
triggerOnResults
-
triggerOnRmsChanged
public void triggerOnRmsChanged(float rmsdB) -
createOnDeviceSpeechRecognizer
@Implementation(minSdk=33) protected static SpeechRecognizer createOnDeviceSpeechRecognizer(Context context) -
isOnDeviceRecognitionAvailable
@Implementation(minSdk=33) protected static boolean isOnDeviceRecognitionAvailable(Context context) -
checkRecognitionSupport
@Implementation(minSdk=33) protected void checkRecognitionSupport(Intent recognizerIntent, Executor executor, RecognitionSupportCallback supportListener) -
triggerModelDownload
-
setIsOnDeviceRecognitionAvailable
public static void setIsOnDeviceRecognitionAvailable(boolean available) -
triggerSupportResult
-
triggerSupportError
public void triggerSupportError(int error) -
getLatestModelDownloadIntent
-