android.speech.tts.TextToSpeech.OnUtteranceCompletedListener Java Examples

The following examples show how to use android.speech.tts.TextToSpeech.OnUtteranceCompletedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnouncementPeriodicTaskTest.java    From mytracks with Apache License 2.0 5 votes vote down vote up
@Override
public int setOnUtteranceCompletedListener(
    OnUtteranceCompletedListener listener) {
  if (tts == null) {
    return super.setOnUtteranceCompletedListener(listener);
  }
  return tts.setOnUtteranceCompletedListener(listener);
}
 
Example #2
Source File: AnnouncementPeriodicTaskTest.java    From mytracks with Apache License 2.0 5 votes vote down vote up
public void testRun() throws Exception {
  // Expect service data calls
  TripStatistics stats = new TripStatistics();

  // Expect announcement building call
  expect(mockTask.getAnnouncement(same(stats))).andStubReturn(ANNOUNCEMENT);

  // Put task in "ready" state
  startTask(TextToSpeech.SUCCESS);

  expect(tts.isLanguageAvailable(DEFAULT_LOCALE)).andStubReturn(TextToSpeech.LANG_AVAILABLE);
  expect(tts.setLanguage(DEFAULT_LOCALE)).andReturn(TextToSpeech.LANG_AVAILABLE);
  expect(tts.setSpeechRate(AnnouncementPeriodicTask.TTS_SPEECH_RATE)).andReturn(
      TextToSpeech.SUCCESS);
  expect(tts.setOnUtteranceCompletedListener((OnUtteranceCompletedListener) EasyMock.anyObject()))
      .andReturn(0);

  // Expect actual announcement call
  expect(
      tts.speak(eq(ANNOUNCEMENT), eq(TextToSpeech.QUEUE_FLUSH),
          eq(AnnouncementPeriodicTask.SPEECH_PARAMS))).andReturn(0);

  // Run the announcement
  AndroidMock.replay(tts);
  task.announce(stats);
  AndroidMock.verify(mockTask, tts);
}
 
Example #3
Source File: AnnouncementPeriodicTaskTest.java    From mytracks with Apache License 2.0 votes vote down vote up
int setOnUtteranceCompletedListener(OnUtteranceCompletedListener listener);