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
This commit is contained in:
@ -77,9 +77,12 @@ import android.view.inputmethod.EditorInfo;
|
|||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides a system service that manages input methods.
|
* This class provides a system service that manages input methods.
|
||||||
@ -1506,21 +1509,22 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
hideInputMethodMenuLocked();
|
hideInputMethodMenuLocked();
|
||||||
|
|
||||||
int N = immis.size();
|
int N = immis.size();
|
||||||
|
|
||||||
mItems = new CharSequence[N];
|
final Map<CharSequence, InputMethodInfo> imMap =
|
||||||
mIms = new InputMethodInfo[N];
|
new TreeMap<CharSequence, InputMethodInfo>(Collator.getInstance());
|
||||||
|
|
||||||
int j = 0;
|
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
InputMethodInfo property = immis.get(i);
|
InputMethodInfo property = immis.get(i);
|
||||||
if (property == null) {
|
if (property == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mItems[j] = property.loadLabel(pm);
|
imMap.put(property.loadLabel(pm), property);
|
||||||
mIms[j] = property;
|
|
||||||
j++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
N = imMap.size();
|
||||||
|
mItems = imMap.keySet().toArray(new CharSequence[N]);
|
||||||
|
mIms = imMap.values().toArray(new InputMethodInfo[N]);
|
||||||
|
|
||||||
int checkedItem = 0;
|
int checkedItem = 0;
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
if (mIms[i].getId().equals(lastInputMethodId)) {
|
if (mIms[i].getId().equals(lastInputMethodId)) {
|
||||||
|
Reference in New Issue
Block a user