summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-07-26 06:20:28 +0900
committersatok <satok@google.com>2011-07-26 06:51:46 +0900
commitc0b569c317fad96abbf0ea23d07eb6d19f634ccf (patch)
tree9f3a1d6a8dc66c5bd3c3dec1fc2bab505ffdd761 /src/com
parent672b3c6576efa9e8e4ad0ebbea7f0c36ecf77d9b (diff)
downloadpackages_apps_settings-c0b569c317fad96abbf0ea23d07eb6d19f634ccf.zip
packages_apps_settings-c0b569c317fad96abbf0ea23d07eb6d19f634ccf.tar.gz
packages_apps_settings-c0b569c317fad96abbf0ea23d07eb6d19f634ccf.tar.bz2
[step6] Apply api and fix crush in spell checker settings.
Change-Id: Ie430ca7ff4147c530aae895d1d13a40a01c63b98
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java7
-rw-r--r--src/com/android/settings/inputmethod/SpellCheckerUtils.java20
-rw-r--r--src/com/android/settings/inputmethod/SpellCheckersSettings.java12
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;
}