Class ShadowTextToSpeech


  • @Implements(android.speech.tts.TextToSpeech.class)
    public class ShadowTextToSpeech
    extends java.lang.Object
    • 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 void addLanguageAvailability​(java.util.Locale locale)
      Make Locale an available language returned by TextToSpeech.isLanguageAvailable(Locale).
      static void clearLanguageAvailabilities()  
      void clearLastSpokenText()  
      android.content.Context getContext()  
      java.util.Locale getCurrentLanguage()
      Returns Locale set using TextToSpeech.setLanguage(Locale) or null if not set.
      java.lang.String getLastSpokenText()  
      java.lang.String getLastSynthesizeToFileText()
      Returns last text CharSequence passed to TextToSpeech.synthesizeToFile(CharSequence, Bundle, File, String).
      android.speech.tts.TextToSpeech.OnInitListener getOnInitListener()  
      int getQueueMode()  
      protected int isLanguageAvailable​(java.util.Locale lang)  
      boolean isShutdown()  
      boolean isStopped()  
      protected int setLanguage​(java.util.Locale locale)  
      protected void shutdown()  
      protected int speak​(java.lang.CharSequence text, int queueMode, android.os.Bundle params, java.lang.String utteranceId)  
      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.
      protected int stop()  
      protected int synthesizeToFile​(java.lang.CharSequence text, android.os.Bundle params, java.io.File file, java.lang.String utteranceId)
      Stores text and returns TextToSpeech.SUCCESS.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShadowTextToSpeech

        public ShadowTextToSpeech()
    • 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)
        Stores text and returns TextToSpeech.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:
        true if the TTS is stopped.
      • getQueueMode

        public int getQueueMode()
      • getCurrentLanguage

        public java.util.Locale getCurrentLanguage()
        Returns Locale set using TextToSpeech.setLanguage(Locale) or null if not set.
      • getLastSynthesizeToFileText

        public java.lang.String getLastSynthesizeToFileText()
        Returns last text CharSequence passed to TextToSpeech.synthesizeToFile(CharSequence, Bundle, File, String).
      • addLanguageAvailability

        public static void addLanguageAvailability​(java.util.Locale locale)
        Make Locale an available language returned by TextToSpeech.isLanguageAvailable(Locale). The value returned by isLanguageAvailable(Locale) will vary depending on language, country, and variant.
      • clearLanguageAvailabilities

        @Resetter
        public static void clearLanguageAvailabilities()