From 9d0a23bb1c2119c897f8df33439d5064df3ab0c5 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Mon, 11 Feb 2013 01:00:06 +0000 Subject: [PATCH] TtsService.java: also report TextToSpeech.LANG_MISSING_DATA if the base resources are not found or the data can be upgraded. --- android/src/com/reecedunn/espeak/TtsService.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/android/src/com/reecedunn/espeak/TtsService.java b/android/src/com/reecedunn/espeak/TtsService.java index fe233541..c0a5dfb6 100644 --- a/android/src/com/reecedunn/espeak/TtsService.java +++ b/android/src/com/reecedunn/espeak/TtsService.java @@ -114,15 +114,13 @@ public class TtsService extends TextToSpeechService { @Override protected int onIsLanguageAvailable(String language, String country, String variant) { - if (!mEngineInitialized) { + Context context = getApplicationContext(); + if (!mEngineInitialized || + !CheckVoiceData.hasBaseResources(context) || + CheckVoiceData.canUpgradeResources(context)) { return TextToSpeech.LANG_MISSING_DATA; } - if (mAvailableVoices == null) { - Log.e(TAG, "Attempted to check language availability before loading voices!"); - return TextToSpeech.LANG_NOT_SUPPORTED; - } - final Locale query = new Locale(language, country, variant); Voice languageVoice = null;