Package org.robolectric.shadows
Class ShadowTextToSpeech
- java.lang.Object
-
- org.robolectric.shadows.ShadowTextToSpeech
-
@Implements(android.speech.tts.TextToSpeech.class) public class ShadowTextToSpeech extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ShadowTextToSpeech()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void__constructor__(android.content.Context context, android.speech.tts.TextToSpeech.OnInitListener listener)static voidaddLanguageAvailability(java.util.Locale locale)MakeLocalean available language returned byTextToSpeech.isLanguageAvailable(Locale).static voidclearLanguageAvailabilities()voidclearLastSpokenText()android.content.ContextgetContext()java.util.LocalegetCurrentLanguage()ReturnsLocaleset usingTextToSpeech.setLanguage(Locale)or null if not set.java.lang.StringgetLastSpokenText()java.lang.StringgetLastSynthesizeToFileText()Returns last textCharSequencepassed toTextToSpeech.synthesizeToFile(CharSequence, Bundle, File, String).android.speech.tts.TextToSpeech.OnInitListenergetOnInitListener()intgetQueueMode()protected intisLanguageAvailable(java.util.Locale lang)booleanisShutdown()booleanisStopped()protected intsetLanguage(java.util.Locale locale)protected voidshutdown()protected intspeak(java.lang.CharSequence text, int queueMode, android.os.Bundle params, java.lang.String utteranceId)protected intspeak(java.lang.String text, int queueMode, java.util.HashMap<java.lang.String,java.lang.String> params)Speaks the string using the specified queuing strategy and speech parameters.protected intstop()protected intsynthesizeToFile(java.lang.CharSequence text, android.os.Bundle params, java.io.File file, java.lang.String utteranceId)Storestextand returnsTextToSpeech.SUCCESS.
-
-
-
Method Detail
-
__constructor__
@Implementation protected void __constructor__(android.content.Context context, android.speech.tts.TextToSpeech.OnInitListener listener)
-
speak
@Implementation protected int speak(java.lang.String text, int queueMode, java.util.HashMap<java.lang.String,java.lang.String> params)Speaks the string using the specified queuing strategy and speech parameters.- Parameters:
params- The real implementation converts the hashmap into a bundle, but the bundle argument is not used in the shadow implementation.
-
speak
@Implementation(minSdk=21) protected int speak(java.lang.CharSequence text, int queueMode, android.os.Bundle params, java.lang.String utteranceId)
-
shutdown
@Implementation protected void shutdown()
-
stop
@Implementation protected int stop()
-
isLanguageAvailable
@Implementation protected int isLanguageAvailable(java.util.Locale lang)
-
setLanguage
@Implementation protected int setLanguage(java.util.Locale locale)
-
synthesizeToFile
@Implementation(minSdk=21) protected int synthesizeToFile(java.lang.CharSequence text, android.os.Bundle params, java.io.File file, java.lang.String utteranceId)Storestextand returnsTextToSpeech.SUCCESS.- See Also:
getLastSynthesizeToFileText()
-
getContext
public android.content.Context getContext()
-
getOnInitListener
public android.speech.tts.TextToSpeech.OnInitListener getOnInitListener()
-
getLastSpokenText
public java.lang.String getLastSpokenText()
-
clearLastSpokenText
public void clearLastSpokenText()
-
isShutdown
public boolean isShutdown()
-
isStopped
public boolean isStopped()
- Returns:
trueif the TTS is stopped.
-
getQueueMode
public int getQueueMode()
-
getCurrentLanguage
public java.util.Locale getCurrentLanguage()
ReturnsLocaleset usingTextToSpeech.setLanguage(Locale)or null if not set.
-
getLastSynthesizeToFileText
public java.lang.String getLastSynthesizeToFileText()
Returns last textCharSequencepassed toTextToSpeech.synthesizeToFile(CharSequence, Bundle, File, String).
-
addLanguageAvailability
public static void addLanguageAvailability(java.util.Locale locale)
MakeLocalean available language returned byTextToSpeech.isLanguageAvailable(Locale). The value returned byisLanguageAvailable(Locale)will vary depending on language, country, and variant.
-
clearLanguageAvailabilities
@Resetter public static void clearLanguageAvailabilities()
-
-