
org.robolectric.shadows.ShadowTextToSpeech Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of framework Show documentation
Show all versions of framework Show documentation
An alternative Android testing framework.
The newest version!
package org.robolectric.shadows;
import android.content.Context;
import android.speech.tts.TextToSpeech;
import java.util.HashMap;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
@Implements(TextToSpeech.class)
public class ShadowTextToSpeech {
private Context context;
private TextToSpeech.OnInitListener listener;
private String lastSpokenText;
private boolean shutdown = false;
private int queueMode = -1;
public void __constructor__(Context context, TextToSpeech.OnInitListener listener) {
this.context = context;
this.listener = listener;
}
@Implementation
public int speak(final String text, final int queueMode, final HashMap params) {
lastSpokenText = text;
this.queueMode = queueMode;
return TextToSpeech.SUCCESS;
}
@Implementation
public void shutdown() {
shutdown = true;
}
public Context getContext() {
return context;
}
public TextToSpeech.OnInitListener getOnInitListener() {
return listener;
}
public String getLastSpokenText() {
return lastSpokenText;
}
public void clearLastSpokenText() {
lastSpokenText = null;
}
public boolean isShutdown() {
return shutdown;
}
public int getQueueMode() {
return queueMode;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy