diff options
author | Kenny Root <kroot@android.com> | 2010-08-10 15:22:13 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2010-08-10 15:22:13 -0700 |
commit | 6061af11cb2b59b6261d12f98b9e8dd395ea8ba7 (patch) | |
tree | 0d64d1121343985413e6011422ff67dbf9eb183a | |
parent | 0f0dd448ea54ddb760ed77e7d9167b7d7ad1b916 (diff) | |
parent | cf06e2cfcdddc0ca086ba5b03aa26a69de949e69 (diff) | |
download | frameworks_base-6061af11cb2b59b6261d12f98b9e8dd395ea8ba7.zip frameworks_base-6061af11cb2b59b6261d12f98b9e8dd395ea8ba7.tar.gz frameworks_base-6061af11cb2b59b6261d12f98b9e8dd395ea8ba7.tar.bz2 |
Merge "Sort the IME list before showing to user"
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 5bf66e4..0e74169 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -78,9 +78,12 @@ import android.view.inputmethod.EditorInfo; import java.io.FileDescriptor; import java.io.IOException; import java.io.PrintWriter; +import java.text.Collator; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.TreeMap; /** * This class provides a system service that manages input methods. @@ -1513,21 +1516,22 @@ public class InputMethodManagerService extends IInputMethodManager.Stub hideInputMethodMenuLocked(); int N = immis.size(); - - mItems = new CharSequence[N]; - mIms = new InputMethodInfo[N]; - - int j = 0; + + final Map<CharSequence, InputMethodInfo> imMap = + new TreeMap<CharSequence, InputMethodInfo>(Collator.getInstance()); + for (int i = 0; i < N; ++i) { InputMethodInfo property = immis.get(i); if (property == null) { continue; } - mItems[j] = property.loadLabel(pm); - mIms[j] = property; - j++; + imMap.put(property.loadLabel(pm), property); } - + + N = imMap.size(); + mItems = imMap.keySet().toArray(new CharSequence[N]); + mIms = imMap.values().toArray(new InputMethodInfo[N]); + int checkedItem = 0; for (int i = 0; i < N; ++i) { if (mIms[i].getId().equals(lastInputMethodId)) { |