aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/deprecated
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-04-27 17:23:05 +0900
committersatok <satok@google.com>2011-04-27 17:23:05 +0900
commit31da2ea24bee6124feebb5fd1a010fc6c62946a0 (patch)
tree755fde89fe654f00eae61eb792bfe72661af385d /java/src/com/android/inputmethod/deprecated
parent0dbb7e26d1e719251f66bf2f5034330e13bb5c3f (diff)
parent19bfef6cb0714a46a276abe45329e4abb661f76e (diff)
downloadlatinime-31da2ea24bee6124feebb5fd1a010fc6c62946a0.tar.gz
latinime-31da2ea24bee6124feebb5fd1a010fc6c62946a0.tar.xz
latinime-31da2ea24bee6124feebb5fd1a010fc6c62946a0.zip
Merge remote-tracking branch 'goog/master' into merge
Diffstat (limited to 'java/src/com/android/inputmethod/deprecated')
-rw-r--r--java/src/com/android/inputmethod/deprecated/VoiceProxy.java12
-rw-r--r--java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java24
-rw-r--r--java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java5
-rw-r--r--java/src/com/android/inputmethod/deprecated/voice/VoiceInputLogger.java1
4 files changed, 11 insertions, 31 deletions
diff --git a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java
index 0d0591bd0..753dceead 100644
--- a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java
+++ b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java
@@ -754,15 +754,15 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public static class VoiceLoggerWrapper {
- private static final VoiceLoggerWrapper sInstance = new VoiceLoggerWrapper();
+ private static final VoiceLoggerWrapper sLoggerWrapperInstance = new VoiceLoggerWrapper();
private VoiceInputLogger mLogger;
public static VoiceLoggerWrapper getInstance(Context context) {
- if (sInstance.mLogger == null) {
+ if (sLoggerWrapperInstance.mLogger == null) {
// Not thread safe, but it's ok.
- sInstance.mLogger = VoiceInputLogger.getLogger(context);
+ sLoggerWrapperInstance.mLogger = VoiceInputLogger.getLogger(context);
}
- return sInstance;
+ return sLoggerWrapperInstance;
}
// private for the singleton
@@ -795,10 +795,10 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public static class VoiceInputWrapper {
- private static final VoiceInputWrapper sInstance = new VoiceInputWrapper();
+ private static final VoiceInputWrapper sInputWrapperInstance = new VoiceInputWrapper();
private VoiceInput mVoiceInput;
public static VoiceInputWrapper getInstance() {
- return sInstance;
+ return sInputWrapperInstance;
}
public void setVoiceInput(VoiceInput voiceInput, SubtypeSwitcher switcher) {
if (mVoiceInput == null && voiceInput != null) {
diff --git a/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java b/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java
index ce576d0cc..a1b49b475 100644
--- a/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java
+++ b/java/src/com/android/inputmethod/deprecated/languageswitcher/InputLanguageSelection.java
@@ -17,19 +17,17 @@
package com.android.inputmethod.deprecated.languageswitcher;
import com.android.inputmethod.keyboard.KeyboardParser;
-import com.android.inputmethod.latin.BinaryDictionary;
+import com.android.inputmethod.latin.DictionaryFactory;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.Settings;
import com.android.inputmethod.latin.SharedPreferencesCompat;
import com.android.inputmethod.latin.SubtypeSwitcher;
-import com.android.inputmethod.latin.Suggest;
import com.android.inputmethod.latin.Utils;
import org.xmlpull.v1.XmlPullParserException;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
-import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
@@ -123,24 +121,11 @@ public class InputLanguageSelection extends PreferenceActivity {
private Pair<Boolean, Boolean> hasDictionaryOrLayout(Locale locale) {
if (locale == null) return new Pair<Boolean, Boolean>(false, false);
final Resources res = getResources();
- final Configuration conf = res.getConfiguration();
- final Locale saveLocale = conf.locale;
- conf.locale = locale;
- res.updateConfiguration(conf, res.getDisplayMetrics());
- boolean hasDictionary = false;
+ final Locale saveLocale = Utils.setSystemLocale(res, locale);
+ final boolean hasDictionary = DictionaryFactory.isDictionaryAvailable(this, locale);
boolean hasLayout = false;
try {
- BinaryDictionary bd = BinaryDictionary.initDictionaryFromManager(this, Suggest.DIC_MAIN,
- locale, Utils.getMainDictionaryResourceId(res));
-
- // Is the dictionary larger than a placeholder? Arbitrarily chose a lower limit of
- // 4000-5000 words, whereas the LARGE_DICTIONARY is about 20000+ words.
- if (bd.getSize() > Suggest.LARGE_DICTIONARY_THRESHOLD / 4) {
- hasDictionary = true;
- }
- bd.close();
-
final String localeStr = locale.toString();
final String[] layoutCountryCodes = KeyboardParser.parseKeyboardLocale(
this, R.xml.kbd_qwerty).split(",", -1);
@@ -155,8 +140,7 @@ public class InputLanguageSelection extends PreferenceActivity {
} catch (XmlPullParserException e) {
} catch (IOException e) {
}
- conf.locale = saveLocale;
- res.updateConfiguration(conf, res.getDisplayMetrics());
+ Utils.setSystemLocale(res, saveLocale);
return new Pair<Boolean, Boolean>(hasDictionary, hasLayout);
}
diff --git a/java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java b/java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java
index 1a606eaaf..5ef236e31 100644
--- a/java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java
+++ b/java/src/com/android/inputmethod/deprecated/languageswitcher/LanguageSwitcher.java
@@ -16,7 +16,6 @@
package com.android.inputmethod.deprecated.languageswitcher;
-import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.Settings;
@@ -38,6 +37,7 @@ import java.util.Locale;
public class LanguageSwitcher {
private static final String TAG = LanguageSwitcher.class.getSimpleName();
+ @SuppressWarnings("unused")
private static final String KEYBOARD_MODE = "keyboard";
private static final String[] EMPTY_STIRNG_ARRAY = new String[0];
@@ -154,7 +154,6 @@ public class LanguageSwitcher {
/**
* Returns the currently selected input locale, or the display locale if no specific
* locale was selected for input.
- * @return
*/
public Locale getInputLocale() {
if (getLocaleCount() == 0) return mDefaultInputLocale;
@@ -175,7 +174,6 @@ public class LanguageSwitcher {
/**
* Returns the next input locale in the list. Wraps around to the beginning of the
* list if we're at the end of the list.
- * @return
*/
public Locale getNextInputLocale() {
if (getLocaleCount() == 0) return mDefaultInputLocale;
@@ -201,7 +199,6 @@ public class LanguageSwitcher {
/**
* Returns the previous input locale in the list. Wraps around to the end of the
* list if we're at the beginning of the list.
- * @return
*/
public Locale getPrevInputLocale() {
if (getLocaleCount() == 0) return mDefaultInputLocale;
diff --git a/java/src/com/android/inputmethod/deprecated/voice/VoiceInputLogger.java b/java/src/com/android/inputmethod/deprecated/voice/VoiceInputLogger.java
index dcd124f70..87b943426 100644
--- a/java/src/com/android/inputmethod/deprecated/voice/VoiceInputLogger.java
+++ b/java/src/com/android/inputmethod/deprecated/voice/VoiceInputLogger.java
@@ -17,7 +17,6 @@
package com.android.inputmethod.deprecated.voice;
import com.android.common.speech.LoggingEvents;
-import com.android.common.userhappiness.UserHappinessSignals;
import com.android.inputmethod.deprecated.compat.VoiceInputLoggerCompatUtils;
import android.content.Context;