mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-02-17 09:37:50 +01:00
DroidFish: Workaround for bug in Samsung text to speech implementation.
This commit is contained in:
parent
e1ea35409e
commit
140b4957fe
|
@ -68,7 +68,13 @@ public class Speech {
|
||||||
initialized = true;
|
initialized = true;
|
||||||
int toast = -1;
|
int toast = -1;
|
||||||
if (status == TextToSpeech.SUCCESS) {
|
if (status == TextToSpeech.SUCCESS) {
|
||||||
int code = tts.setLanguage(loc);
|
int code = TextToSpeech.LANG_NOT_SUPPORTED;
|
||||||
|
try {
|
||||||
|
code = tts.setLanguage(loc);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
// Some Samsung devices are broken and throw an
|
||||||
|
// exception if the language is not supported
|
||||||
|
}
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case TextToSpeech.LANG_AVAILABLE:
|
case TextToSpeech.LANG_AVAILABLE:
|
||||||
case TextToSpeech.LANG_COUNTRY_AVAILABLE:
|
case TextToSpeech.LANG_COUNTRY_AVAILABLE:
|
||||||
|
@ -216,7 +222,7 @@ public class Speech {
|
||||||
case EN:
|
case EN:
|
||||||
return Locale.US;
|
return Locale.US;
|
||||||
case DE:
|
case DE:
|
||||||
return Locale.GERMAN;
|
return Locale.GERMANY;
|
||||||
case NONE:
|
case NONE:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user