diff options
author | 2010-02-23 19:01:43 -0800 | |
---|---|---|
committer | 2010-02-24 06:36:19 -0800 | |
commit | 6516d0fdfcbaa4eb809a8a69bd876293043a68a4 (patch) | |
tree | 944fa7d784339d9b8053f646cd2491a6fbc9205a /src/com/android/inputmethod/latin/InputLanguageSelection.java | |
parent | 4ca6d9dc09cf7635c9283e42f155957021b9f9ac (diff) | |
download | latinime-6516d0fdfcbaa4eb809a8a69bd876293043a68a4.tar.gz latinime-6516d0fdfcbaa4eb809a8a69bd876293043a68a4.tar.xz latinime-6516d0fdfcbaa4eb809a8a69bd876293043a68a4.zip |
Save and restore Auto Dictionary data.
Due to the addition of input language switching, the auto dictionary
will be re-created very frequently. We need to save it and restore it
during transitions, otherwise the data will be purged too often to be
of much use in the multi-lingual case.
This also fixes the case where a user frequently turns the phone off/on.
Auto dictionary data was not being saved in those situations either.
The dictionary will probably never grow too large since most of the
frequently used words will be moved to the user dictionary any way.
Also, now the input locale is different from the display locale, so
save the input locale in the UserDictionary class and insert words
into the user dictionary with the correct locale.
And NPE fix for bug: 2464573
Diffstat (limited to 'src/com/android/inputmethod/latin/InputLanguageSelection.java')
-rw-r--r-- | src/com/android/inputmethod/latin/InputLanguageSelection.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/inputmethod/latin/InputLanguageSelection.java b/src/com/android/inputmethod/latin/InputLanguageSelection.java index 2c5fec6e8..73298e33c 100644 --- a/src/com/android/inputmethod/latin/InputLanguageSelection.java +++ b/src/com/android/inputmethod/latin/InputLanguageSelection.java @@ -19,7 +19,6 @@ package com.android.inputmethod.latin; import java.text.Collator; import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import java.util.Locale; import android.content.SharedPreferences; @@ -29,7 +28,7 @@ import android.preference.CheckBoxPreference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.preference.PreferenceManager; -import android.util.Log; +import android.text.TextUtils; public class InputLanguageSelection extends PreferenceActivity { @@ -91,7 +90,9 @@ public class InputLanguageSelection extends PreferenceActivity { } private String get5Code(Locale locale) { - return locale.getLanguage() + "_" + locale.getCountry(); + String country = locale.getCountry(); + return locale.getLanguage() + + (TextUtils.isEmpty(country) ? "" : "_" + country); } @Override |