Sort keyboard layouts
At the moment it's not easy to find a layout in the physical keyboard layout list as they are not sorted; this CL will sort the keyboard layout list before it is presented to the user. Bug: 279281653 Test: Flashed on device, confirmed the layout list is sorted Change-Id: Ibc7e329190785cce9a8d9c33bc2fcaca6b8c169a
This commit is contained in:
@@ -83,6 +83,7 @@ public class NewKeyboardLayoutPickerController extends BasePreferenceController
|
|||||||
mFinalSelectedLayout = mLayout;
|
mFinalSelectedLayout = mLayout;
|
||||||
mKeyboardLayouts = mIm.getKeyboardLayoutListForInputDevice(
|
mKeyboardLayouts = mIm.getKeyboardLayoutListForInputDevice(
|
||||||
mInputDeviceIdentifier, mUserId, mInputMethodInfo, mInputMethodSubtype);
|
mInputDeviceIdentifier, mUserId, mInputMethodInfo, mInputMethodSubtype);
|
||||||
|
NewKeyboardSettingsUtils.sortKeyboardLayoutsByLabel(mKeyboardLayouts);
|
||||||
parent.getActivity().setTitle(mTitle);
|
parent.getActivity().setTitle(mTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,8 @@ import android.view.inputmethod.InputMethodManager;
|
|||||||
import android.view.inputmethod.InputMethodSubtype;
|
import android.view.inputmethod.InputMethodSubtype;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,4 +125,11 @@ public class NewKeyboardSettingsUtils {
|
|||||||
InputDeviceIdentifier identifier, InputMethodInfo info, InputMethodSubtype subtype) {
|
InputDeviceIdentifier identifier, InputMethodInfo info, InputMethodSubtype subtype) {
|
||||||
return inputManager.getKeyboardLayoutForInputDevice(identifier, userId, info, subtype);
|
return inputManager.getKeyboardLayoutForInputDevice(identifier, userId, info, subtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sortKeyboardLayoutsByLabel(KeyboardLayout[] keyboardLayouts) {
|
||||||
|
Arrays.sort(
|
||||||
|
keyboardLayouts,
|
||||||
|
Comparator.comparing(KeyboardLayout::getLabel)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user