diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index b1e5ec6f6..de4ac610c 100644
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -8,7 +8,7 @@
-
+
-
+
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index 4ee60da51..a38182197 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -25,7 +25,7 @@
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index d3302fd6f..88e7ad5d0 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -17,8 +17,8 @@
package com.android.inputmethod.keyboard;
import com.android.inputmethod.latin.LatinIME;
-import com.android.inputmethod.latin.LatinIMESettings;
-import com.android.inputmethod.latin.LatinIMEUtil;
+import com.android.inputmethod.latin.Settings;
+import com.android.inputmethod.latin.Utils;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SubtypeSwitcher;
@@ -562,20 +562,20 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
newLayout = Integer.valueOf(DEFAULT_LAYOUT_ID);
}
- LatinIMEUtil.GCUtils.getInstance().reset();
+ Utils.GCUtils.getInstance().reset();
boolean tryGC = true;
- for (int i = 0; i < LatinIMEUtil.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
+ for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
try {
mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater(
).inflate(THEMES[newLayout], null);
tryGC = false;
} catch (OutOfMemoryError e) {
Log.w(TAG, "load keyboard failed: " + e);
- tryGC = LatinIMEUtil.GCUtils.getInstance().tryGCOrWait(
+ tryGC = Utils.GCUtils.getInstance().tryGCOrWait(
mLayoutId + "," + newLayout, e);
} catch (InflateException e) {
Log.w(TAG, "load keyboard failed: " + e);
- tryGC = LatinIMEUtil.GCUtils.getInstance().tryGCOrWait(
+ tryGC = Utils.GCUtils.getInstance().tryGCOrWait(
mLayoutId + "," + newLayout, e);
}
}
@@ -603,7 +603,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
sharedPreferences.getString(key, DEFAULT_LAYOUT_ID));
createInputViewInternal(layoutId, false);
postSetInputView();
- } else if (LatinIMESettings.PREF_SETTINGS_KEY.equals(key)) {
+ } else if (Settings.PREF_SETTINGS_KEY.equals(key)) {
mHasSettingsKey = getSettingsKeyMode(sharedPreferences, mInputMethodService);
createInputViewInternal(mLayoutId, true);
postSetInputView();
@@ -629,13 +629,13 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
final boolean showSettingsKeyOption = resources.getBoolean(
R.bool.config_enable_show_settings_key_option);
if (showSettingsKeyOption) {
- final String settingsKeyMode = prefs.getString(LatinIMESettings.PREF_SETTINGS_KEY,
+ final String settingsKeyMode = prefs.getString(Settings.PREF_SETTINGS_KEY,
resources.getString(DEFAULT_SETTINGS_KEY_MODE));
// We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or
// 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system
if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW))
|| (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_AUTO))
- && LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(
+ && Utils.hasMultipleEnabledIMEsOrSubtypes(
((InputMethodManager) context.getSystemService(
Context.INPUT_METHOD_SERVICE))))) {
return true;
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 5c1c62b05..79b0cbf52 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -16,7 +16,7 @@
package com.android.inputmethod.keyboard;
-import com.android.inputmethod.latin.LatinIMEUtil;
+import com.android.inputmethod.latin.Utils;
import com.android.inputmethod.voice.VoiceIMEConnector;
import android.content.Context;
@@ -330,14 +330,14 @@ public class LatinKeyboardView extends KeyboardView {
@Override
public void draw(Canvas c) {
- LatinIMEUtil.GCUtils.getInstance().reset();
+ Utils.GCUtils.getInstance().reset();
boolean tryGC = true;
- for (int i = 0; i < LatinIMEUtil.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
+ for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
try {
super.draw(c);
tryGC = false;
} catch (OutOfMemoryError e) {
- tryGC = LatinIMEUtil.GCUtils.getInstance().tryGCOrWait("LatinKeyboardView", e);
+ tryGC = Utils.GCUtils.getInstance().tryGCOrWait("LatinKeyboardView", e);
}
}
if (DEBUG_AUTO_PLAY) {
diff --git a/java/src/com/android/inputmethod/latin/LatinIMEBackupAgent.java b/java/src/com/android/inputmethod/latin/BackupAgent.java
similarity index 94%
rename from java/src/com/android/inputmethod/latin/LatinIMEBackupAgent.java
rename to java/src/com/android/inputmethod/latin/BackupAgent.java
index a14a4751f..ee070af75 100644
--- a/java/src/com/android/inputmethod/latin/LatinIMEBackupAgent.java
+++ b/java/src/com/android/inputmethod/latin/BackupAgent.java
@@ -22,7 +22,7 @@ import android.app.backup.SharedPreferencesBackupHelper;
/**
* Backs up the Latin IME shared preferences.
*/
-public class LatinIMEBackupAgent extends BackupAgentHelper {
+public class BackupAgent extends BackupAgentHelper {
@Override
public void onCreate() {
diff --git a/java/src/com/android/inputmethod/latin/LatinIMEDebugSettings.java b/java/src/com/android/inputmethod/latin/DebugSettings.java
similarity index 95%
rename from java/src/com/android/inputmethod/latin/LatinIMEDebugSettings.java
rename to java/src/com/android/inputmethod/latin/DebugSettings.java
index 68738eca1..03211f36b 100644
--- a/java/src/com/android/inputmethod/latin/LatinIMEDebugSettings.java
+++ b/java/src/com/android/inputmethod/latin/DebugSettings.java
@@ -24,10 +24,10 @@ import android.preference.CheckBoxPreference;
import android.preference.PreferenceActivity;
import android.util.Log;
-public class LatinIMEDebugSettings extends PreferenceActivity
+public class DebugSettings extends PreferenceActivity
implements SharedPreferences.OnSharedPreferenceChangeListener {
- private static final String TAG = "LatinIMEDebugSettings";
+ private static final String TAG = "DebugSettings";
private static final String DEBUG_MODE_KEY = "debug_mode";
private CheckBoxPreference mDebugMode;
diff --git a/java/src/com/android/inputmethod/latin/InputLanguageSelection.java b/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
index ad3f1db9b..a55821659 100644
--- a/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
+++ b/java/src/com/android/inputmethod/latin/InputLanguageSelection.java
@@ -69,7 +69,7 @@ public class InputLanguageSelection extends PreferenceActivity {
addPreferencesFromResource(R.xml.language_prefs);
// Get the settings preferences
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
- mSelectedLanguages = mPrefs.getString(LatinIME.PREF_SELECTED_LANGUAGES, "");
+ mSelectedLanguages = mPrefs.getString(Settings.PREF_SELECTED_LANGUAGES, "");
String[] languageList = mSelectedLanguages.split(",");
mAvailableLanguages = getUniqueLocales();
PreferenceGroup parent = getPreferenceScreen();
@@ -143,7 +143,7 @@ public class InputLanguageSelection extends PreferenceActivity {
}
if (checkedLanguages.length() < 1) checkedLanguages = null; // Save null
Editor editor = mPrefs.edit();
- editor.putString(LatinIME.PREF_SELECTED_LANGUAGES, checkedLanguages);
+ editor.putString(Settings.PREF_SELECTED_LANGUAGES, checkedLanguages);
SharedPreferencesCompat.apply(editor);
}
diff --git a/java/src/com/android/inputmethod/latin/LanguageSwitcher.java b/java/src/com/android/inputmethod/latin/LanguageSwitcher.java
index fc725bf1b..6faf7f95e 100644
--- a/java/src/com/android/inputmethod/latin/LanguageSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/LanguageSwitcher.java
@@ -52,8 +52,8 @@ public class LanguageSwitcher {
* @return whether there was any change
*/
public boolean loadLocales(SharedPreferences sp) {
- String selectedLanguages = sp.getString(LatinIME.PREF_SELECTED_LANGUAGES, null);
- String currentLanguage = sp.getString(LatinIME.PREF_INPUT_LANGUAGE, null);
+ String selectedLanguages = sp.getString(Settings.PREF_SELECTED_LANGUAGES, null);
+ String currentLanguage = sp.getString(Settings.PREF_INPUT_LANGUAGE, null);
if (selectedLanguages == null || selectedLanguages.length() < 1) {
loadDefaults();
if (mLocales.size() == 0) {
@@ -187,7 +187,7 @@ public class LanguageSwitcher {
public void persist(SharedPreferences prefs) {
Editor editor = prefs.edit();
- editor.putString(LatinIME.PREF_INPUT_LANGUAGE, getInputLanguage());
+ editor.putString(Settings.PREF_INPUT_LANGUAGE, getInputLanguage());
SharedPreferencesCompat.apply(editor);
}
}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index ed5ce6bb8..27af98e40 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -22,7 +22,7 @@ import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.LatinKeyboardView;
-import com.android.inputmethod.latin.LatinIMEUtil.RingCharBuffer;
+import com.android.inputmethod.latin.Utils.RingCharBuffer;
import com.android.inputmethod.voice.VoiceIMEConnector;
import org.xmlpull.v1.XmlPullParserException;
@@ -88,18 +88,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private static final boolean DEBUG = false;
private static final boolean TRACE = false;
- private static final String PREF_SOUND_ON = "sound_on";
- private static final String PREF_POPUP_ON = "popup_on";
- private static final String PREF_AUTO_CAP = "auto_cap";
- private static final String PREF_QUICK_FIXES = "quick_fixes";
- private static final String PREF_SHOW_SUGGESTIONS_SETTING = "show_suggestions_setting";
- private static final String PREF_AUTO_COMPLETION_THRESHOLD = "auto_completion_threshold";
- private static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion";
-
- public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
- public static final String PREF_INPUT_LANGUAGE = "input_language";
- private static final String PREF_RECORRECTION_ENABLED = "recorrection_enabled";
-
private static final int DELAY_UPDATE_SUGGESTIONS = 180;
private static final int DELAY_UPDATE_OLD_SUGGESTIONS = 300;
private static final int DELAY_UPDATE_SHIFT_STATE = 300;
@@ -346,17 +334,17 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final Configuration conf = mResources.getConfiguration();
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
mKeyboardSwitcher = KeyboardSwitcher.getInstance();
- mReCorrectionEnabled = prefs.getBoolean(PREF_RECORRECTION_ENABLED,
+ mReCorrectionEnabled = prefs.getBoolean(Settings.PREF_RECORRECTION_ENABLED,
getResources().getBoolean(R.bool.default_recorrection_enabled));
- LatinIMEUtil.GCUtils.getInstance().reset();
+ Utils.GCUtils.getInstance().reset();
boolean tryGC = true;
- for (int i = 0; i < LatinIMEUtil.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
+ for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
try {
initSuggest();
tryGC = false;
} catch (OutOfMemoryError e) {
- tryGC = LatinIMEUtil.GCUtils.getInstance().tryGCOrWait("InitSuggest", e);
+ tryGC = Utils.GCUtils.getInstance().tryGCOrWait("InitSuggest", e);
}
}
@@ -419,7 +407,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mSuggest.close();
}
final SharedPreferences prefs = mPrefs;
- mQuickFixes = prefs.getBoolean(PREF_QUICK_FIXES, true);
+ mQuickFixes = prefs.getBoolean(Settings.PREF_QUICK_FIXES, true);
int[] dictionaries = getDictionary(orig);
mSuggest = new Suggest(this, dictionaries);
@@ -1063,7 +1051,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void onSettingsKeyPressed() {
if (!isShowingOptionDialog()) {
- if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
+ if (Utils.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
showOptionsMenu();
} else {
launchSettings();
@@ -1073,7 +1061,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void onSettingsKeyLongPressed() {
if (!isShowingOptionDialog()) {
- if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
+ if (Utils.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
mImm.showInputMethodPicker();
} else {
launchSettings();
@@ -1898,10 +1886,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
mSubtypeSwitcher.onSharedPreferenceChanged(sharedPreferences, key);
- if (PREF_SELECTED_LANGUAGES.equals(key)) {
+ if (Settings.PREF_SELECTED_LANGUAGES.equals(key)) {
mRefreshKeyboardRequired = true;
- } else if (PREF_RECORRECTION_ENABLED.equals(key)) {
- mReCorrectionEnabled = sharedPreferences.getBoolean(PREF_RECORRECTION_ENABLED,
+ } else if (Settings.PREF_RECORRECTION_ENABLED.equals(key)) {
+ mReCorrectionEnabled = sharedPreferences.getBoolean(
+ Settings.PREF_RECORRECTION_ENABLED,
getResources().getBoolean(R.bool.default_recorrection_enabled));
}
}
@@ -2071,8 +2060,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void updateSuggestionVisibility(SharedPreferences prefs) {
final String suggestionVisiblityStr = prefs.getString(
- PREF_SHOW_SUGGESTIONS_SETTING, mResources.getString(
- R.string.prefs_suggestion_visibility_default_value));
+ Settings.PREF_SHOW_SUGGESTIONS_SETTING,
+ mResources.getString(R.string.prefs_suggestion_visibility_default_value));
for (int visibility : SUGGESTION_VISIBILITY_VALUE_ARRAY) {
if (suggestionVisiblityStr.equals(mResources.getString(visibility))) {
mSuggestionVisibility = visibility;
@@ -2082,11 +2071,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
protected void launchSettings() {
- launchSettings(LatinIMESettings.class);
+ launchSettings(Settings.class);
}
public void launchDebugSettings() {
- launchSettings(LatinIMEDebugSettings.class);
+ launchSettings(DebugSettings.class);
}
protected void launchSettings(Class extends PreferenceActivity> settingsClass) {
@@ -2102,12 +2091,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final SharedPreferences prefs = mPrefs;
Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
mVibrateOn = vibrator != null && vibrator.hasVibrator()
- && prefs.getBoolean(LatinIMESettings.PREF_VIBRATE_ON, false);
- mSoundOn = prefs.getBoolean(PREF_SOUND_ON, false);
- mPopupOn = prefs.getBoolean(PREF_POPUP_ON,
+ && prefs.getBoolean(Settings.PREF_VIBRATE_ON, false);
+ mSoundOn = prefs.getBoolean(Settings.PREF_SOUND_ON, false);
+ mPopupOn = prefs.getBoolean(Settings.PREF_POPUP_ON,
mResources.getBoolean(R.bool.default_popup_preview));
- mAutoCap = prefs.getBoolean(PREF_AUTO_CAP, true);
- mQuickFixes = prefs.getBoolean(PREF_QUICK_FIXES, true);
+ mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true);
+ mQuickFixes = prefs.getBoolean(Settings.PREF_QUICK_FIXES, true);
mAutoCorrectEnabled = isAutoCorrectEnabled(prefs);
mBigramSuggestionEnabled = mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs);
@@ -2131,7 +2120,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// When auto completion setting is turned off, the threshold is ignored.
if (!isAutoCorrectEnabled(sp)) return;
- final String currentAutoCompletionSetting = sp.getString(PREF_AUTO_COMPLETION_THRESHOLD,
+ final String currentAutoCompletionSetting = sp.getString(
+ Settings.PREF_AUTO_COMPLETION_THRESHOLD,
mResources.getString(R.string.auto_completion_threshold_mode_value_modest));
final String[] autoCompletionThresholdValues = mResources.getStringArray(
R.array.auto_complete_threshold_values);
@@ -2159,7 +2149,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
private boolean isAutoCorrectEnabled(SharedPreferences sp) {
- final String currentAutoCompletionSetting = sp.getString(PREF_AUTO_COMPLETION_THRESHOLD,
+ final String currentAutoCompletionSetting = sp.getString(
+ Settings.PREF_AUTO_COMPLETION_THRESHOLD,
mResources.getString(R.string.auto_completion_threshold_mode_value_modest));
final String autoCompletionOff = mResources.getString(
R.string.auto_completion_threshold_mode_value_off);
@@ -2168,7 +2159,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private boolean isBigramSuggestionEnabled(SharedPreferences sp) {
// TODO: Define default value instead of 'true'.
- return sp.getBoolean(PREF_BIGRAM_SUGGESTIONS, true);
+ return sp.getBoolean(Settings.PREF_BIGRAM_SUGGESTIONS, true);
}
private void initSuggestPuncList() {
diff --git a/java/src/com/android/inputmethod/latin/LatinIMESettings.java b/java/src/com/android/inputmethod/latin/Settings.java
similarity index 84%
rename from java/src/com/android/inputmethod/latin/LatinIMESettings.java
rename to java/src/com/android/inputmethod/latin/Settings.java
index 3aa89dd59..9c7c5aa71 100644
--- a/java/src/com/android/inputmethod/latin/LatinIMESettings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -39,19 +39,26 @@ import android.widget.TextView;
import java.util.Locale;
-public class LatinIMESettings extends PreferenceActivity
+public class Settings extends PreferenceActivity
implements SharedPreferences.OnSharedPreferenceChangeListener,
DialogInterface.OnDismissListener {
+ private static final String TAG = "Settings";
- private static final String QUICK_FIXES_KEY = "quick_fixes";
- private static final String PREDICTION_SETTINGS_KEY = "prediction_settings";
- private static final String VOICE_SETTINGS_KEY = "voice_mode";
- private static final String PREF_AUTO_COMPLETION_THRESHOLD = "auto_completion_threshold";
- private static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion";
+ public static final String PREF_VIBRATE_ON = "vibrate_on";
+ public static final String PREF_SOUND_ON = "sound_on";
+ public static final String PREF_POPUP_ON = "popup_on";
+ public static final String PREF_RECORRECTION_ENABLED = "recorrection_enabled";
+ public static final String PREF_AUTO_CAP = "auto_cap";
public static final String PREF_SETTINGS_KEY = "settings_key";
- /* package */ static final String PREF_VIBRATE_ON = "vibrate_on";
+ public static final String PREF_VOICE_SETTINGS_KEY = "voice_mode";
+ public static final String PREF_INPUT_LANGUAGE = "input_language";
+ public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
- private static final String TAG = "LatinIMESettings";
+ public static final String PREF_PREDICTION_SETTINGS_KEY = "prediction_settings";
+ public static final String PREF_QUICK_FIXES = "quick_fixes";
+ public static final String PREF_SHOW_SUGGESTIONS_SETTING = "show_suggestions_setting";
+ public static final String PREF_AUTO_COMPLETION_THRESHOLD = "auto_completion_threshold";
+ public static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion";
// Dialog ids
private static final int VOICE_INPUT_CONFIRM_DIALOG = 0;
@@ -80,14 +87,15 @@ public class LatinIMESettings extends PreferenceActivity
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs);
- mQuickFixes = (CheckBoxPreference) findPreference(QUICK_FIXES_KEY);
- mVoicePreference = (ListPreference) findPreference(VOICE_SETTINGS_KEY);
+ mQuickFixes = (CheckBoxPreference) findPreference(PREF_QUICK_FIXES);
+ mVoicePreference = (ListPreference) findPreference(PREF_VOICE_SETTINGS_KEY);
mSettingsKeyPreference = (ListPreference) findPreference(PREF_SETTINGS_KEY);
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
prefs.registerOnSharedPreferenceChangeListener(this);
mVoiceModeOff = getString(R.string.voice_mode_off);
- mVoiceOn = !(prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff).equals(mVoiceModeOff));
+ mVoiceOn = !(prefs.getString(PREF_VOICE_SETTINGS_KEY, mVoiceModeOff)
+ .equals(mVoiceModeOff));
mLogger = VoiceInputLogger.getLogger(this);
mAutoCompletionThreshold = (ListPreference) findPreference(PREF_AUTO_COMPLETION_THRESHOLD);
@@ -118,7 +126,7 @@ public class LatinIMESettings extends PreferenceActivity
super.onResume();
int autoTextSize = AutoText.getSize(getListView());
if (autoTextSize < 1) {
- ((PreferenceGroup) findPreference(PREDICTION_SETTINGS_KEY))
+ ((PreferenceGroup) findPreference(PREF_PREDICTION_SETTINGS_KEY))
.removePreference(mQuickFixes);
}
if (!VoiceIMEConnector.VOICE_INSTALLED
@@ -141,14 +149,15 @@ public class LatinIMESettings extends PreferenceActivity
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
(new BackupManager(this)).dataChanged();
// If turning on voice input, show dialog
- if (key.equals(VOICE_SETTINGS_KEY) && !mVoiceOn) {
- if (!prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff)
+ if (key.equals(PREF_VOICE_SETTINGS_KEY) && !mVoiceOn) {
+ if (!prefs.getString(PREF_VOICE_SETTINGS_KEY, mVoiceModeOff)
.equals(mVoiceModeOff)) {
showVoiceConfirmation();
}
}
ensureConsistencyOfAutoCompletionSettings();
- mVoiceOn = !(prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff).equals(mVoiceModeOff));
+ mVoiceOn = !(prefs.getString(PREF_VOICE_SETTINGS_KEY, mVoiceModeOff)
+ .equals(mVoiceModeOff));
updateVoiceModeSummary();
updateSettingsKeySummary();
}
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index 3ee4eb891..b67dd22fd 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -316,7 +316,7 @@ public class SubtypeSwitcher {
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (USE_SPACEBAR_LANGUAGE_SWITCHER) {
- if (LatinIME.PREF_SELECTED_LANGUAGES.equals(key)) {
+ if (Settings.PREF_SELECTED_LANGUAGES.equals(key)) {
mLanguageSwitcher.loadLocales(sharedPreferences);
}
}
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 2f188879c..a6df187e6 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -284,7 +284,7 @@ public class Suggest implements Dictionary.WordCallback {
&& mSuggestions.size() > 0 && mPriorities.length > 0) {
// TODO: when the normalized score of the first suggestion is nearly equals to
// the normalized score of the second suggestion, behave less aggressive.
- final double normalizedScore = LatinIMEUtil.calcNormalizedScore(
+ final double normalizedScore = Utils.calcNormalizedScore(
mOriginalWord, mSuggestions.get(0), mPriorities[0]);
if (LatinImeLogger.sDBG) {
Log.d(TAG, "Normalized " + mOriginalWord + "," + mSuggestions.get(0) + ","
diff --git a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java b/java/src/com/android/inputmethod/latin/Utils.java
similarity index 99%
rename from java/src/com/android/inputmethod/latin/LatinIMEUtil.java
rename to java/src/com/android/inputmethod/latin/Utils.java
index f508b9ab8..0a73dde08 100644
--- a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java
+++ b/java/src/com/android/inputmethod/latin/Utils.java
@@ -35,7 +35,7 @@ import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
-public class LatinIMEUtil {
+public class Utils {
/**
* Cancel an {@link AsyncTask}.
diff --git a/tests/src/com/android/inputmethod/latin/EditDistanceTests.java b/tests/src/com/android/inputmethod/latin/EditDistanceTests.java
index a9ed89df7..75bd04938 100644
--- a/tests/src/com/android/inputmethod/latin/EditDistanceTests.java
+++ b/tests/src/com/android/inputmethod/latin/EditDistanceTests.java
@@ -37,7 +37,7 @@ public class EditDistanceTests extends AndroidTestCase {
* sitting
*/
public void testExample1() {
- final int dist = LatinIMEUtil.editDistance("kitten", "sitting");
+ final int dist = Utils.editDistance("kitten", "sitting");
assertEquals("edit distance between 'kitten' and 'sitting' is 3",
3, dist);
}
@@ -50,26 +50,26 @@ public class EditDistanceTests extends AndroidTestCase {
* S--unday
*/
public void testExample2() {
- final int dist = LatinIMEUtil.editDistance("Saturday", "Sunday");
+ final int dist = Utils.editDistance("Saturday", "Sunday");
assertEquals("edit distance between 'Saturday' and 'Sunday' is 3",
3, dist);
}
public void testBothEmpty() {
- final int dist = LatinIMEUtil.editDistance("", "");
+ final int dist = Utils.editDistance("", "");
assertEquals("when both string are empty, no edits are needed",
0, dist);
}
public void testFirstArgIsEmpty() {
- final int dist = LatinIMEUtil.editDistance("", "aaaa");
+ final int dist = Utils.editDistance("", "aaaa");
assertEquals("when only one string of the arguments is empty,"
+ " the edit distance is the length of the other.",
4, dist);
}
public void testSecoondArgIsEmpty() {
- final int dist = LatinIMEUtil.editDistance("aaaa", "");
+ final int dist = Utils.editDistance("aaaa", "");
assertEquals("when only one string of the arguments is empty,"
+ " the edit distance is the length of the other.",
4, dist);
@@ -78,27 +78,27 @@ public class EditDistanceTests extends AndroidTestCase {
public void testSameStrings() {
final String arg1 = "The quick brown fox jumps over the lazy dog.";
final String arg2 = "The quick brown fox jumps over the lazy dog.";
- final int dist = LatinIMEUtil.editDistance(arg1, arg2);
+ final int dist = Utils.editDistance(arg1, arg2);
assertEquals("when same strings are passed, distance equals 0.",
0, dist);
}
public void testSameReference() {
final String arg = "The quick brown fox jumps over the lazy dog.";
- final int dist = LatinIMEUtil.editDistance(arg, arg);
+ final int dist = Utils.editDistance(arg, arg);
assertEquals("when same string references are passed, the distance equals 0.",
0, dist);
}
public void testNullArg() {
try {
- LatinIMEUtil.editDistance(null, "aaa");
+ Utils.editDistance(null, "aaa");
fail("IllegalArgumentException should be thrown.");
} catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
try {
- LatinIMEUtil.editDistance("aaa", null);
+ Utils.editDistance("aaa", null);
fail("IllegalArgumentException should be thrown.");
} catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException);