summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorKenny Root <kroot@android.com>2010-08-10 15:38:41 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-08-10 15:38:41 -0700
commita27484f068047453af6345f2c2c58fcc1db899a5 (patch)
tree91f6d3284b2e4fa91a6c79c82323dc305b805b26 /services/java
parentd35498f6062410e777d6ad41a720db32336e2089 (diff)
parent6061af11cb2b59b6261d12f98b9e8dd395ea8ba7 (diff)
downloadframeworks_base-a27484f068047453af6345f2c2c58fcc1db899a5.zip
frameworks_base-a27484f068047453af6345f2c2c58fcc1db899a5.tar.gz
frameworks_base-a27484f068047453af6345f2c2c58fcc1db899a5.tar.bz2
am 6061af11: Merge "Sort the IME list before showing to user"
Merge commit '6061af11cb2b59b6261d12f98b9e8dd395ea8ba7' into gingerbread-plus-aosp * commit '6061af11cb2b59b6261d12f98b9e8dd395ea8ba7': Sort the IME list before showing to user
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java22
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 4d35bec..710d817 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -77,9 +77,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.
@@ -1506,21 +1509,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)) {