From 14413a02e3ce8a2f128ec8eccdb648420e0b9297 Mon Sep 17 00:00:00 2001 From: satok Date: Wed, 31 Aug 2011 21:15:53 +0900 Subject: [PATCH] Add a functionality to disable the spell checker Change-Id: I2c2663e8232c5ba4b7499fd17a173c8c65252cf3 --- .../inputmethod/CheckBoxAndSettingsPreference.java | 4 ++-- .../inputmethod/SpellCheckersPreference.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/inputmethod/CheckBoxAndSettingsPreference.java b/src/com/android/settings/inputmethod/CheckBoxAndSettingsPreference.java index f983f59a0d2..952146d94d7 100644 --- a/src/com/android/settings/inputmethod/CheckBoxAndSettingsPreference.java +++ b/src/com/android/settings/inputmethod/CheckBoxAndSettingsPreference.java @@ -52,7 +52,7 @@ public class CheckBoxAndSettingsPreference extends CheckBoxPreference { new OnClickListener() { @Override public void onClick(View arg0) { - onCheckBoxClicked(arg0); + onCheckBoxClicked(); } }); mSetingsButton = (ImageView)view.findViewById(R.id.inputmethod_settings); @@ -80,7 +80,7 @@ public class CheckBoxAndSettingsPreference extends CheckBoxPreference { mSettingsIntent = intent; } - protected void onCheckBoxClicked(View view) { + protected void onCheckBoxClicked() { if (isChecked()) { setChecked(false); } else { diff --git a/src/com/android/settings/inputmethod/SpellCheckersPreference.java b/src/com/android/settings/inputmethod/SpellCheckersPreference.java index 7d2eec855d0..5e4ebba1518 100644 --- a/src/com/android/settings/inputmethod/SpellCheckersPreference.java +++ b/src/com/android/settings/inputmethod/SpellCheckersPreference.java @@ -18,10 +18,22 @@ package com.android.settings.inputmethod; import android.content.Context; import android.util.AttributeSet; +import android.view.textservice.TextServicesManager; public class SpellCheckersPreference extends CheckBoxAndSettingsPreference { + private final TextServicesManager mTsm; public SpellCheckersPreference(Context context, AttributeSet attrs) { super(context, attrs); + mTsm = (TextServicesManager) context.getSystemService( + Context.TEXT_SERVICES_MANAGER_SERVICE); + setChecked(mTsm.isSpellCheckerEnabled()); + } + + @Override + protected void onCheckBoxClicked() { + super.onCheckBoxClicked(); + final boolean checked = isChecked(); + mTsm.setSpellCheckerEnabled(checked); } }