aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/speech/SpeechService.java
diff options
context:
space:
mode:
authorrsudev <rasch@munin-soft.de>2013-08-25 17:08:54 +0200
committerrsudev <rasch@munin-soft.de>2013-08-25 17:08:54 +0200
commit56963a80c6992f5f111470852b13e32c59c95be8 (patch)
treeccb8cd5e58a1487d1e3ca1948aba4afb6533727c /main/src/cgeo/geocaching/speech/SpeechService.java
parent2f791d1a60f2ac41647ee75d7b0a3ef8365a7e31 (diff)
downloadcgeo-56963a80c6992f5f111470852b13e32c59c95be8.zip
cgeo-56963a80c6992f5f111470852b13e32c59c95be8.tar.gz
cgeo-56963a80c6992f5f111470852b13e32c59c95be8.tar.bz2
Fixes #2770, TTS not starting
Fixes #3177, TTS talking compass does not uses force English as well - moving checks to SpeechService, avoiding calling the intent - set requested locale to 'en' if 'forceEnglish'
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;
}