Package org.robolectric.shadows
Class ShadowSpeechRecognizer
java.lang.Object
org.robolectric.shadows.ShadowSpeechRecognizer
@Implements(value=android.speech.SpeechRecognizer.class,
looseSignatures=true)
public class ShadowSpeechRecognizer
extends Object
Robolectric shadow for SpeechRecognizer.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkRecognitionSupport
(Object recognizerIntent, Object executor, Object supportListener) protected static SpeechRecognizer
createOnDeviceSpeechRecognizer
(Context context) protected static SpeechRecognizer
createSpeechRecognizer
(Context context, ComponentName serviceComponent) protected void
destroy()
Returns the argument passed to the last call toSpeechRecognizer.startListening(android.content.Intent)
.static SpeechRecognizer
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.boolean
Returns true iff the destroy method of was invoked for the recognizer.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
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
(Object recognitionSupport)
-
Field Details
-
latestSpeechRecognizer
-
-
Constructor Details
-
ShadowSpeechRecognizer
public ShadowSpeechRecognizer()
-
-
Method Details
-
getLatestSpeechRecognizer
Returns the latest SpeechRecognizer. This method can only be called afterSpeechRecognizer.createSpeechRecognizer(Context)
is called. -
getLastRecognizerIntent
Returns the argument passed to the last call toSpeechRecognizer.startListening(android.content.Intent)
. -
isDestroyed
public boolean isDestroyed()Returns true iff the destroy method of was invoked for the recognizer. -
reset
-
destroy
-
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
-
checkRecognitionSupport
@RequiresApi(api=33) @Implementation(minSdk=33) protected void checkRecognitionSupport(Object recognizerIntent, Object executor, Object supportListener) -
triggerModelDownload
-
setIsOnDeviceRecognitionAvailable
public static void setIsOnDeviceRecognitionAvailable(boolean available) -
triggerSupportResult
-
triggerSupportError
-
getLatestModelDownloadIntent
-