From 4c2ffc580c2c920ee172af8e2d0624492c42b159 Mon Sep 17 00:00:00 2001 From: Mike LeBeau Date: Fri, 12 Feb 2010 14:47:48 -0800 Subject: [PATCH] Make the one-recognizer case actually work. :) The settings item wasn't actually getting linked to the recognizer's settings in that case. Also add a summary line to the line for choosing the recognizer, so you can see which one is currently selected, in the case that more than one is installed. Fix the TTS settings strings to match what we do for voice input. --- res/values/strings.xml | 6 ++---- .../settings/VoiceInputOutputSettings.java | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 7dd365d9189..2d9cbdcf688 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2084,11 +2084,9 @@ found in the list of installed applications. - Text-to-speech - - Set text-to-speech options + Text-to-speech settings - Text-to-speech + Text-to-speech settings Always use my settings diff --git a/src/com/android/settings/VoiceInputOutputSettings.java b/src/com/android/settings/VoiceInputOutputSettings.java index 62c909f7a23..4011038e21d 100644 --- a/src/com/android/settings/VoiceInputOutputSettings.java +++ b/src/com/android/settings/VoiceInputOutputSettings.java @@ -92,8 +92,20 @@ public class VoiceInputOutputSettings extends PreferenceActivity removePreference(mRecognizerPref); removePreference(mSettingsPref); } else if (numAvailable == 1) { - // Only one recognizer available, so don't show the list of choices. + // Only one recognizer available, so don't show the list of choices, but do + // set up the link to settings for the available recognizer. removePreference(mRecognizerPref); + + // But first set up the available recognizers map with just the one recognizer. + ResolveInfo resolveInfo = availableRecognitionServices.get(0); + String recognizerComponent = + new ComponentName(resolveInfo.serviceInfo.packageName, + resolveInfo.serviceInfo.name).flattenToString(); + mAvailableRecognizersMap.put(recognizerComponent, resolveInfo); + + String currentSetting = Settings.Secure.getString( + getContentResolver(), Settings.Secure.VOICE_RECOGNITION_SERVICE); + updateSettingsLink(currentSetting); } else { // Multiple recognizers available, so show the full list of choices. populateRecognizerPreference(availableRecognitionServices); @@ -186,6 +198,7 @@ public class VoiceInputOutputSettings extends PreferenceActivity Intent i = new Intent(Intent.ACTION_MAIN); i.setComponent(new ComponentName(si.packageName, settingsActivity)); mSettingsPref.setIntent(i); + mRecognizerPref.setSummary(currentRecognizer.loadLabel(getPackageManager())); } }