diff options
Diffstat (limited to 'src')
3 files changed, 28 insertions, 11 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java index d0ff2a0..699a4a6 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java +++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java @@ -116,8 +116,11 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment final Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClass(getActivity(), SpellCheckersSettingsActivity.class); - ((SpellCheckersPreference)findPreference("spellcheckers_settings")).setFragmentIntent( - this, intent); + final SpellCheckersPreference scp = ((SpellCheckersPreference)findPreference( + "spellcheckers_settings")); + if (scp != null) { + scp.setFragmentIntent(this, intent); + } } private void updateInputMethodSelectorSummary(int value) { diff --git a/src/com/android/settings/inputmethod/SpellCheckerUtils.java b/src/com/android/settings/inputmethod/SpellCheckerUtils.java index 3cc256f..09f3a24 100644 --- a/src/com/android/settings/inputmethod/SpellCheckerUtils.java +++ b/src/com/android/settings/inputmethod/SpellCheckerUtils.java @@ -16,20 +16,28 @@ package com.android.settings.inputmethod; +import android.util.Log; import android.view.textservice.SpellCheckerInfo; +import android.view.textservice.TextServicesManager; public class SpellCheckerUtils { - public static void setSpellCheckersEnabled(boolean enable) { + private static final String TAG = SpellCheckerUtils.class.getSimpleName(); + private static final boolean DBG = false; + public static void setSpellCheckersEnabled(TextServicesManager tsm, boolean enable) { } - public static boolean getSpellCheckersEnabled() { + public static boolean getSpellCheckersEnabled(TextServicesManager tsm) { return true; } - public static void setCurrentSpellChecker(SpellCheckerInfo info) { + public static void setCurrentSpellChecker(TextServicesManager tsm, SpellCheckerInfo info) { } - public static SpellCheckerInfo getCurrentSpellChecker() { + public static SpellCheckerInfo getCurrentSpellChecker(TextServicesManager tsm) { return null; } - public static SpellCheckerInfo[] getEnabledSpellCheckers() { - return null; + public static SpellCheckerInfo[] getEnabledSpellCheckers(TextServicesManager tsm) { + final SpellCheckerInfo[] retval = tsm.getEnabledSpellCheckers(); + if (DBG) { + Log.d(TAG, "get spell checkers: " + retval.length); + } + return retval; } } diff --git a/src/com/android/settings/inputmethod/SpellCheckersSettings.java b/src/com/android/settings/inputmethod/SpellCheckersSettings.java index a36491f..9587e96 100644 --- a/src/com/android/settings/inputmethod/SpellCheckersSettings.java +++ b/src/com/android/settings/inputmethod/SpellCheckersSettings.java @@ -19,20 +19,24 @@ package com.android.settings.inputmethod; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; +import android.content.Context; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceScreen; import android.view.textservice.SpellCheckerInfo; +import android.view.textservice.TextServicesManager; public class SpellCheckersSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener { private SpellCheckerInfo mCurrentSci; private SpellCheckerInfo[] mEnabledScis; + private TextServicesManager mTsm; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); + mTsm = (TextServicesManager) getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE); addPreferencesFromResource(R.xml.spellchecker_prefs); updateScreen(); } @@ -49,16 +53,18 @@ public class SpellCheckersSettings extends SettingsPreferenceFragment @Override public void onResume() { + super.onResume(); updateScreen(); } @Override public void onPause() { + super.onPause(); saveState(); } private void saveState() { - SpellCheckerUtils.setCurrentSpellChecker(mCurrentSci); + SpellCheckerUtils.setCurrentSpellChecker(mTsm, mCurrentSci); } private void updateScreen() { @@ -67,8 +73,8 @@ public class SpellCheckersSettings extends SettingsPreferenceFragment } private void updateEnabledSpellCheckers() { - mCurrentSci = SpellCheckerUtils.getCurrentSpellChecker(); - mEnabledScis = SpellCheckerUtils.getEnabledSpellCheckers(); + mCurrentSci = SpellCheckerUtils.getCurrentSpellChecker(mTsm); + mEnabledScis = SpellCheckerUtils.getEnabledSpellCheckers(mTsm); if (mCurrentSci == null || mEnabledScis == null) { return; } |