Move Voice input/output settings to Language & keyboard
Bug: 3267042 Change-Id: I127a2e9d11fb70283812e68979bdde3976e32cf9
This commit is contained in:
@@ -301,6 +301,7 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<action android:name="android.settings.INPUT_METHOD_SETTINGS" />
|
<action android:name="android.settings.INPUT_METHOD_SETTINGS" />
|
||||||
|
<action android:name="com.android.settings.VOICE_INPUT_OUTPUT_SETTINGS" />
|
||||||
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="com.android.settings.SHORTCUT" />
|
<category android:name="com.android.settings.SHORTCUT" />
|
||||||
@@ -631,21 +632,6 @@
|
|||||||
android:resource="@id/accessibility_settings" />
|
android:resource="@id/accessibility_settings" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="Settings$VoiceInputOutputSettingsActivity"
|
|
||||||
android:theme="@android:style/Theme.Holo"
|
|
||||||
android:label="@string/voice_input_output_settings"
|
|
||||||
android:targetActivity="Settings">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<action android:name="com.android.settings.VOICE_INPUT_OUTPUT_SETTINGS" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
|
||||||
android:value="com.android.settings.VoiceInputOutputSettings" />
|
|
||||||
<meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
|
|
||||||
android:resource="@id/voice_input_output_settings" />
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name="TextToSpeechSettings" android:label="@string/tts_settings">
|
<activity android:name="TextToSpeechSettings" android:label="@string/tts_settings">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@@ -2181,7 +2181,7 @@ found in the list of installed applications.</string>
|
|||||||
|
|
||||||
<!-- Language Settings --> <skip />
|
<!-- Language Settings --> <skip />
|
||||||
<!-- Title of setting on main settings screen. This item will take the user to the screen to tweak settings realted to locale and text -->
|
<!-- Title of setting on main settings screen. This item will take the user to the screen to tweak settings realted to locale and text -->
|
||||||
<string name="language_settings">Language & keyboard</string>
|
<string name="language_settings">Language & input</string>
|
||||||
<!-- Title of Language and keyboard settings screen -->
|
<!-- Title of Language and keyboard settings screen -->
|
||||||
<string name="language_keyboard_settings_title">Language & keyboard settings</string>
|
<string name="language_keyboard_settings_title">Language & keyboard settings</string>
|
||||||
<!-- On Language & keyboard settings screen, heading. Inside the "Language & keyboard settings" screen, this is the header for settings that relate to language (select the system language, user dictionary for the language). -->
|
<!-- On Language & keyboard settings screen, heading. Inside the "Language & keyboard settings" screen, this is the header for settings that relate to language (select the system language, user dictionary for the language). -->
|
||||||
|
@@ -33,6 +33,28 @@
|
|||||||
android:summary="@string/user_dict_settings_summary">
|
android:summary="@string/user_dict_settings_summary">
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<PreferenceCategory android:key="voice_input_category"
|
||||||
|
android:title="@string/voice_input_category" >
|
||||||
|
|
||||||
|
<!-- entries, entryValues, and defaultValue will be populated programmatically. -->
|
||||||
|
<ListPreference
|
||||||
|
android:key="recognizer"
|
||||||
|
android:title="@string/recognizer_title"
|
||||||
|
android:dialogTitle="@string/recognizer_title" />
|
||||||
|
|
||||||
|
<!-- An intent for this preference will be populated programmatically. -->
|
||||||
|
<PreferenceScreen android:key="recognizer_settings"
|
||||||
|
android:title="@string/recognizer_settings_title" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory android:key="voice_output_category"
|
||||||
|
android:title="@string/voice_output_category" >
|
||||||
|
|
||||||
|
<PreferenceScreen android:key="tts_settings"
|
||||||
|
android:fragment="com.android.settings.TextToSpeechSettings"
|
||||||
|
android:title="@string/tts_settings_title" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:key="keyboard_settings_category"
|
<PreferenceCategory android:key="keyboard_settings_category"
|
||||||
android:title="@string/keyboard_settings_category">
|
android:title="@string/keyboard_settings_category">
|
||||||
|
|
||||||
|
@@ -119,14 +119,6 @@
|
|||||||
android:icon="@drawable/ic_settings_language"
|
android:icon="@drawable/ic_settings_language"
|
||||||
android:title="@string/language_settings" />
|
android:title="@string/language_settings" />
|
||||||
|
|
||||||
<!-- Voice input & output -->
|
|
||||||
|
|
||||||
<header
|
|
||||||
android:id="@+id/voice_input_output_settings"
|
|
||||||
android:fragment="com.android.settings.VoiceInputOutputSettings"
|
|
||||||
android:icon="@drawable/ic_settings_speech"
|
|
||||||
android:title="@string/voice_input_output_settings" />
|
|
||||||
|
|
||||||
<!-- Accessibility feedback -->
|
<!-- Accessibility feedback -->
|
||||||
|
|
||||||
<header
|
<header
|
||||||
|
@@ -1,41 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:title="@string/voice_input_output_settings_title"
|
|
||||||
android:key="parent">
|
|
||||||
|
|
||||||
<PreferenceCategory android:key="voice_input_category"
|
|
||||||
android:title="@string/voice_input_category" />
|
|
||||||
|
|
||||||
<!-- entries, entryValues, and defaultValue will be populated programmatically. -->
|
|
||||||
<ListPreference
|
|
||||||
android:key="recognizer"
|
|
||||||
android:title="@string/recognizer_title"
|
|
||||||
android:dialogTitle="@string/recognizer_title" />
|
|
||||||
|
|
||||||
<!-- An intent for this preference will be populated programmatically. -->
|
|
||||||
<PreferenceScreen android:key="recognizer_settings"
|
|
||||||
android:title="@string/recognizer_settings_title" />
|
|
||||||
|
|
||||||
<PreferenceCategory android:key="voice_output_category"
|
|
||||||
android:title="@string/voice_output_category" />
|
|
||||||
|
|
||||||
<PreferenceScreen android:key="tts_settings"
|
|
||||||
android:fragment="com.android.settings.TextToSpeechSettings"
|
|
||||||
android:title="@string/tts_settings_title" />
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
@@ -209,7 +209,6 @@ public class Settings extends PreferenceActivity {
|
|||||||
public static class PrivacySettingsActivity extends Settings { }
|
public static class PrivacySettingsActivity extends Settings { }
|
||||||
public static class DockSettingsActivity extends Settings { }
|
public static class DockSettingsActivity extends Settings { }
|
||||||
public static class RunningServicesActivity extends Settings { }
|
public static class RunningServicesActivity extends Settings { }
|
||||||
public static class VoiceInputOutputSettingsActivity extends Settings { }
|
|
||||||
public static class ManageAccountsSettingsActivity extends Settings { }
|
public static class ManageAccountsSettingsActivity extends Settings { }
|
||||||
public static class PowerUsageSummaryActivity extends Settings { }
|
public static class PowerUsageSummaryActivity extends Settings { }
|
||||||
public static class AccountSyncSettingsActivity extends Settings { }
|
public static class AccountSyncSettingsActivity extends Settings { }
|
||||||
|
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -28,7 +25,6 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.content.res.XmlResourceParser;
|
import android.content.res.XmlResourceParser;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceCategory;
|
import android.preference.PreferenceCategory;
|
||||||
@@ -45,15 +41,16 @@ import java.io.IOException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings screen for voice input/output.
|
* Settings screen for voice input/output.
|
||||||
*/
|
*/
|
||||||
public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
public class VoiceInputOutputSettings implements OnPreferenceChangeListener {
|
||||||
implements OnPreferenceChangeListener {
|
|
||||||
|
|
||||||
private static final String TAG = "VoiceInputOutputSettings";
|
private static final String TAG = "VoiceInputOutputSettings";
|
||||||
|
|
||||||
private static final String KEY_PARENT = "parent";
|
|
||||||
private static final String KEY_VOICE_INPUT_CATEGORY = "voice_input_category";
|
private static final String KEY_VOICE_INPUT_CATEGORY = "voice_input_category";
|
||||||
private static final String KEY_RECOGNIZER = "recognizer";
|
private static final String KEY_RECOGNIZER = "recognizer";
|
||||||
private static final String KEY_RECOGNIZER_SETTINGS = "recognizer_settings";
|
private static final String KEY_RECOGNIZER_SETTINGS = "recognizer_settings";
|
||||||
@@ -62,20 +59,22 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
private PreferenceCategory mVoiceInputCategory;
|
private PreferenceCategory mVoiceInputCategory;
|
||||||
private ListPreference mRecognizerPref;
|
private ListPreference mRecognizerPref;
|
||||||
private PreferenceScreen mSettingsPref;
|
private PreferenceScreen mSettingsPref;
|
||||||
|
private SettingsPreferenceFragment mFragment;
|
||||||
|
|
||||||
private HashMap<String, ResolveInfo> mAvailableRecognizersMap;
|
private HashMap<String, ResolveInfo> mAvailableRecognizersMap;
|
||||||
|
|
||||||
@Override
|
public VoiceInputOutputSettings(SettingsPreferenceFragment fragment) {
|
||||||
public void onCreate(Bundle icicle) {
|
mFragment = fragment;
|
||||||
super.onCreate(icicle);
|
}
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.voice_input_output_settings);
|
public void onCreate() {
|
||||||
|
|
||||||
mParent = (PreferenceGroup) findPreference(KEY_PARENT);
|
mParent = (PreferenceGroup) mFragment.getPreferenceScreen();
|
||||||
mVoiceInputCategory = (PreferenceCategory) mParent.findPreference(KEY_VOICE_INPUT_CATEGORY);
|
mVoiceInputCategory = (PreferenceCategory) mParent.findPreference(KEY_VOICE_INPUT_CATEGORY);
|
||||||
mRecognizerPref = (ListPreference) mParent.findPreference(KEY_RECOGNIZER);
|
mRecognizerPref = (ListPreference) mVoiceInputCategory.findPreference(KEY_RECOGNIZER);
|
||||||
mRecognizerPref.setOnPreferenceChangeListener(this);
|
mRecognizerPref.setOnPreferenceChangeListener(this);
|
||||||
mSettingsPref = (PreferenceScreen) mParent.findPreference(KEY_RECOGNIZER_SETTINGS);
|
mSettingsPref = (PreferenceScreen)
|
||||||
|
mVoiceInputCategory.findPreference(KEY_RECOGNIZER_SETTINGS);
|
||||||
|
|
||||||
mAvailableRecognizersMap = new HashMap<String, ResolveInfo>();
|
mAvailableRecognizersMap = new HashMap<String, ResolveInfo>();
|
||||||
|
|
||||||
@@ -83,19 +82,18 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void populateOrRemoveRecognizerPreference() {
|
private void populateOrRemoveRecognizerPreference() {
|
||||||
List<ResolveInfo> availableRecognitionServices = getPackageManager().queryIntentServices(
|
List<ResolveInfo> availableRecognitionServices =
|
||||||
|
mFragment.getPackageManager().queryIntentServices(
|
||||||
new Intent(RecognitionService.SERVICE_INTERFACE), PackageManager.GET_META_DATA);
|
new Intent(RecognitionService.SERVICE_INTERFACE), PackageManager.GET_META_DATA);
|
||||||
int numAvailable = availableRecognitionServices.size();
|
int numAvailable = availableRecognitionServices.size();
|
||||||
|
|
||||||
if (numAvailable == 0) {
|
if (numAvailable == 0) {
|
||||||
// No recognizer available - remove all related preferences.
|
// No recognizer available - remove all related preferences.
|
||||||
removePreference(mVoiceInputCategory);
|
mFragment.getPreferenceScreen().removePreference(mVoiceInputCategory);
|
||||||
removePreference(mRecognizerPref);
|
|
||||||
removePreference(mSettingsPref);
|
|
||||||
} else if (numAvailable == 1) {
|
} else if (numAvailable == 1) {
|
||||||
// Only one recognizer available, so don't show the list of choices, but do
|
// Only one recognizer available, so don't show the list of choices, but do
|
||||||
// set up the link to settings for the available recognizer.
|
// set up the link to settings for the available recognizer.
|
||||||
removePreference(mRecognizerPref);
|
mVoiceInputCategory.removePreference(mRecognizerPref);
|
||||||
|
|
||||||
// But first set up the available recognizers map with just the one recognizer.
|
// But first set up the available recognizers map with just the one recognizer.
|
||||||
ResolveInfo resolveInfo = availableRecognitionServices.get(0);
|
ResolveInfo resolveInfo = availableRecognitionServices.get(0);
|
||||||
@@ -106,7 +104,7 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
mAvailableRecognizersMap.put(recognizerComponent, resolveInfo);
|
mAvailableRecognizersMap.put(recognizerComponent, resolveInfo);
|
||||||
|
|
||||||
String currentSetting = Settings.Secure.getString(
|
String currentSetting = Settings.Secure.getString(
|
||||||
getContentResolver(), Settings.Secure.VOICE_RECOGNITION_SERVICE);
|
mFragment.getContentResolver(), Settings.Secure.VOICE_RECOGNITION_SERVICE);
|
||||||
updateSettingsLink(currentSetting);
|
updateSettingsLink(currentSetting);
|
||||||
} else {
|
} else {
|
||||||
// Multiple recognizers available, so show the full list of choices.
|
// Multiple recognizers available, so show the full list of choices.
|
||||||
@@ -114,12 +112,6 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removePreference(Preference pref) {
|
|
||||||
if (pref != null) {
|
|
||||||
mParent.removePreference(pref);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void populateRecognizerPreference(List<ResolveInfo> recognizers) {
|
private void populateRecognizerPreference(List<ResolveInfo> recognizers) {
|
||||||
int size = recognizers.size();
|
int size = recognizers.size();
|
||||||
CharSequence[] entries = new CharSequence[size];
|
CharSequence[] entries = new CharSequence[size];
|
||||||
@@ -127,7 +119,7 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
// Get the current value from the secure setting.
|
// Get the current value from the secure setting.
|
||||||
String currentSetting = Settings.Secure.getString(
|
String currentSetting = Settings.Secure.getString(
|
||||||
getContentResolver(), Settings.Secure.VOICE_RECOGNITION_SERVICE);
|
mFragment.getContentResolver(), Settings.Secure.VOICE_RECOGNITION_SERVICE);
|
||||||
|
|
||||||
// Iterate through all the available recognizers and load up their info to show
|
// Iterate through all the available recognizers and load up their info to show
|
||||||
// in the preference. Also build up a map of recognizer component names to their
|
// in the preference. Also build up a map of recognizer component names to their
|
||||||
@@ -140,7 +132,7 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
mAvailableRecognizersMap.put(recognizerComponent, resolveInfo);
|
mAvailableRecognizersMap.put(recognizerComponent, resolveInfo);
|
||||||
|
|
||||||
entries[i] = resolveInfo.loadLabel(getPackageManager());
|
entries[i] = resolveInfo.loadLabel(mFragment.getPackageManager());
|
||||||
values[i] = recognizerComponent;
|
values[i] = recognizerComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,13 +151,14 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
XmlResourceParser parser = null;
|
XmlResourceParser parser = null;
|
||||||
String settingsActivity = null;
|
String settingsActivity = null;
|
||||||
try {
|
try {
|
||||||
parser = si.loadXmlMetaData(getPackageManager(), RecognitionService.SERVICE_META_DATA);
|
parser = si.loadXmlMetaData(mFragment.getPackageManager(),
|
||||||
|
RecognitionService.SERVICE_META_DATA);
|
||||||
if (parser == null) {
|
if (parser == null) {
|
||||||
throw new XmlPullParserException("No " + RecognitionService.SERVICE_META_DATA +
|
throw new XmlPullParserException("No " + RecognitionService.SERVICE_META_DATA +
|
||||||
" meta-data for " + si.packageName);
|
" meta-data for " + si.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Resources res = getPackageManager().getResourcesForApplication(
|
Resources res = mFragment.getPackageManager().getResourcesForApplication(
|
||||||
si.applicationInfo);
|
si.applicationInfo);
|
||||||
|
|
||||||
AttributeSet attrs = Xml.asAttributeSet(parser);
|
AttributeSet attrs = Xml.asAttributeSet(parser);
|
||||||
@@ -200,12 +193,12 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
// No settings preference available - hide the preference.
|
// No settings preference available - hide the preference.
|
||||||
Log.w(TAG, "no recognizer settings available for " + si.packageName);
|
Log.w(TAG, "no recognizer settings available for " + si.packageName);
|
||||||
mSettingsPref.setIntent(null);
|
mSettingsPref.setIntent(null);
|
||||||
mParent.removePreference(mSettingsPref);
|
mVoiceInputCategory.removePreference(mSettingsPref);
|
||||||
} else {
|
} else {
|
||||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||||
i.setComponent(new ComponentName(si.packageName, settingsActivity));
|
i.setComponent(new ComponentName(si.packageName, settingsActivity));
|
||||||
mSettingsPref.setIntent(i);
|
mSettingsPref.setIntent(i);
|
||||||
mRecognizerPref.setSummary(currentRecognizer.loadLabel(getPackageManager()));
|
mRecognizerPref.setSummary(currentRecognizer.loadLabel(mFragment.getPackageManager()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,8 +207,7 @@ public class VoiceInputOutputSettings extends SettingsPreferenceFragment
|
|||||||
String setting = (String) newValue;
|
String setting = (String) newValue;
|
||||||
|
|
||||||
// Put the new value back into secure settings.
|
// Put the new value back into secure settings.
|
||||||
Settings.Secure.putString(
|
Settings.Secure.putString(mFragment.getContentResolver(),
|
||||||
getContentResolver(),
|
|
||||||
Settings.Secure.VOICE_RECOGNITION_SERVICE,
|
Settings.Secure.VOICE_RECOGNITION_SERVICE,
|
||||||
setting);
|
setting);
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@ package com.android.settings.inputmethod;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.VoiceInputOutputSettings;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -81,6 +82,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
mCheckboxes = new ArrayList<CheckBoxPreference>();
|
mCheckboxes = new ArrayList<CheckBoxPreference>();
|
||||||
onCreateIMM();
|
onCreateIMM();
|
||||||
|
|
||||||
|
new VoiceInputOutputSettings(this).onCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSystemIme(InputMethodInfo property) {
|
private boolean isSystemIme(InputMethodInfo property) {
|
||||||
|
Reference in New Issue
Block a user