Make sure the TTS example in the TTS Settings loads a supported language.
This fixes the issue where the example wouldn't play when the UI is in Japanese in bug 2088099.
This commit is contained in:
@@ -265,6 +265,12 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
if (status == TextToSpeech.SUCCESS) {
|
if (status == TextToSpeech.SUCCESS) {
|
||||||
Log.v(TAG, "TTS engine for settings screen initialized.");
|
Log.v(TAG, "TTS engine for settings screen initialized.");
|
||||||
mEnableDemo = true;
|
mEnableDemo = true;
|
||||||
|
// check to see if the current locale is supported
|
||||||
|
if (mTts.isLanguageAvailable(Locale.getDefault()) == TextToSpeech.LANG_NOT_SUPPORTED) {
|
||||||
|
mTts.setLanguage(Locale.US);
|
||||||
|
} else {
|
||||||
|
mTts.setLanguage(Locale.getDefault());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "TTS engine for settings screen failed to initialize successfully.");
|
Log.v(TAG, "TTS engine for settings screen failed to initialize successfully.");
|
||||||
mEnableDemo = false;
|
mEnableDemo = false;
|
||||||
@@ -282,7 +288,6 @@ public class TextToSpeechSettings extends PreferenceActivity implements
|
|||||||
Log.v(TAG, "Voice data check passed");
|
Log.v(TAG, "Voice data check passed");
|
||||||
if (mTts == null) {
|
if (mTts == null) {
|
||||||
mTts = new TextToSpeech(this, this);
|
mTts = new TextToSpeech(this, this);
|
||||||
mTts.setLanguage(Locale.getDefault());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.v(TAG, "Voice data check failed");
|
Log.v(TAG, "Voice data check failed");
|
||||||
|
Reference in New Issue
Block a user