Add edit personal dictionary settings menu

Bug: 8600958
Change-Id: I303adfbe25a56cc9b5ee9f3b5169a5bca0ad6c4a
main
Tadashi G. Takaoka 2013-04-15 18:46:57 +09:00
parent 508ab24875
commit 4f2535398a
4 changed files with 24 additions and 0 deletions

View File

@ -107,6 +107,9 @@
<!-- Description for option to enable auto capitalization of sentences -->
<string name="auto_cap_summary">Capitalize the first word of each sentence</string>
<!-- Option to edit personal dictionary. [CHAR_LIMIT=30]-->
<string name="edit_personal_dictionary">Personal dictionary</string>
<!-- Option to configure dictionaries -->
<string name="configure_dictionaries_title">Add-on dictionaries</string>
<!-- Name of the main dictionary, as opposed to auxiliary dictionaries (medical/entertainment/sports...) -->

View File

@ -53,6 +53,11 @@
<PreferenceCategory
android:title="@string/correction_category"
android:key="correction_settings">
<PreferenceScreen
android:key="edit_personal_dictionary"
android:title="@string/edit_personal_dictionary">
<intent android:action="android.settings.USER_DICTIONARY_SETTINGS" />
</PreferenceScreen>
<PreferenceScreen
android:key="configure_dictionaries_key"
android:title="@string/configure_dictionaries_title">

View File

@ -36,6 +36,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_POPUP_ON = "popup_on";
public static final String PREF_VOICE_MODE = "voice_mode";
public static final String PREF_CORRECTION_SETTINGS = "correction_settings";
public static final String PREF_EDIT_PERSONAL_DICTIONARY = "edit_personal_dictionary";
public static final String PREF_CONFIGURE_DICTIONARIES_KEY = "configure_dictionaries_key";
public static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold";
public static final String PREF_SHOW_SUGGESTIONS_SETTING = "show_suggestions_setting";

View File

@ -20,6 +20,8 @@ import android.app.backup.BackupManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.media.AudioManager;
import android.os.Bundle;
@ -29,6 +31,7 @@ import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.util.Log;
import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.dictionarypack.DictionarySettingsActivity;
@ -38,6 +41,8 @@ import com.android.inputmethodcommon.InputMethodSettingsFragment;
public final class SettingsFragment extends InputMethodSettingsFragment
implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = SettingsFragment.class.getSimpleName();
private ListPreference mVoicePreference;
private ListPreference mShowCorrectionSuggestionsPreference;
private ListPreference mAutoCorrectionThresholdPreference;
@ -183,6 +188,16 @@ public final class SettingsFragment extends InputMethodSettingsFragment
textCorrectionGroup.removePreference(dictionaryLink);
}
final Preference editPersonalDictionary =
findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY);
final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent();
final ResolveInfo ri = context.getPackageManager().resolveActivity(
editPersonalDictionaryIntent, PackageManager.MATCH_DEFAULT_ONLY);
if (ri == null) {
// TODO: Set a intent that invokes our own edit personal dictionary activity.
Log.w(TAG, "No activity that responds to " + editPersonalDictionaryIntent.getAction());
}
if (!Settings.readFromBuildConfigIfGestureInputEnabled(res)) {
removePreference(Settings.PREF_GESTURE_SETTINGS, getPreferenceScreen());
}