From ec05e716ad4c0aad7ff4873421680e9ab9ba833b Mon Sep 17 00:00:00 2001 From: Charles Chen Date: Thu, 18 Feb 2010 15:06:26 -0800 Subject: [PATCH] Added a default fallback message for cases where the TTS plugin does not provide a sample string. --- src/com/android/settings/TextToSpeechSettings.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/com/android/settings/TextToSpeechSettings.java b/src/com/android/settings/TextToSpeechSettings.java index 2182894ca3d..4fafa25062e 100644 --- a/src/com/android/settings/TextToSpeechSettings.java +++ b/src/com/android/settings/TextToSpeechSettings.java @@ -350,18 +350,11 @@ public class TextToSpeechSettings extends PreferenceActivity implements updateWidgetState(); } else if (requestCode == GET_SAMPLE_TEXT) { if (resultCode == TextToSpeech.LANG_AVAILABLE) { - if (data == null){ - // The GET_SAMPLE_TEXT activity for the plugin did not run properly; - // return without doing anything. - return; + String sample = getString(R.string.tts_demo); + if ((data != null) && (data.getStringExtra("sampleText") != null)) { + sample = data.getStringExtra("sampleText"); } if (mTts != null) { - String sample = data.getStringExtra("sampleText"); - if (sample == null){ - // The GET_SAMPLE_TEXT activity for the plugin did not run properly; - // return without doing anything. - return; - } mTts.speak(sample, TextToSpeech.QUEUE_FLUSH, null); } } else {