aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/speech/SpeechService.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/speech/SpeechService.java')
-rw-r--r--main/src/cgeo/geocaching/speech/SpeechService.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/speech/SpeechService.java b/main/src/cgeo/geocaching/speech/SpeechService.java
index ae289ed..1907bfc 100644
--- a/main/src/cgeo/geocaching/speech/SpeechService.java
+++ b/main/src/cgeo/geocaching/speech/SpeechService.java
@@ -1,7 +1,9 @@
package cgeo.geocaching.speech;
import cgeo.geocaching.DirectionProvider;
+import cgeo.geocaching.R;
import cgeo.geocaching.cgeoapplication;
+import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.GeoDirHandler;
@@ -14,6 +16,7 @@ import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.speech.tts.TextToSpeech;
+import android.speech.tts.TextToSpeech.Engine;
import android.speech.tts.TextToSpeech.OnInitListener;
import java.util.Locale;
@@ -144,11 +147,19 @@ public class SpeechService extends Service implements OnInitListener {
return;
}
- int switchLocale = tts.setLanguage(Locale.getDefault());
+ Locale locale = Locale.getDefault();
+ if (Settings.isUseEnglish()) {
+ locale = Locale.ENGLISH;
+ }
+
+ int switchLocale = tts.setLanguage(locale);
- if (switchLocale == TextToSpeech.LANG_MISSING_DATA
- || switchLocale == TextToSpeech.LANG_NOT_SUPPORTED) {
+ if (switchLocale == TextToSpeech.LANG_MISSING_DATA) {
+ startingActivity.startActivity(new Intent(Engine.ACTION_INSTALL_TTS_DATA));
+ return;
+ } else if (switchLocale == TextToSpeech.LANG_NOT_SUPPORTED) {
Log.e("Current languge not supported by text to speech.");
+ ActivityMixin.showToast(startingActivity, R.string.err_tts_lang_not_supported);
return;
}