Exemplo n.º 1
0
 public static InputMethodSubtype findSubtypeByLocaleAndKeyboardLayoutSet(
     Context context, String localeString, String keyboardLayoutSetName) {
   final InputMethodInfo imi = getInputMethodInfoOfThisIme(context);
   final int count = imi.getSubtypeCount();
   for (int i = 0; i < count; i++) {
     final InputMethodSubtype subtype = imi.getSubtypeAt(i);
     final String layoutName = SubtypeLocale.getKeyboardLayoutSetName(subtype);
     if (localeString.equals(subtype.getLocale()) && keyboardLayoutSetName.equals(layoutName)) {
       return subtype;
     }
   }
   return null;
 }
 public void setSubtype(InputMethodSubtype subtype) {
   mPreviousSubtype = mSubtype;
   mSubtype = subtype;
   if (isIncomplete()) {
     setTitle(null);
     setDialogTitle(R.string.add_style);
     setKey(KEY_NEW_SUBTYPE);
   } else {
     final String displayName =
         SubtypeLocale.getSubtypeDisplayName(subtype, getContext().getResources());
     setTitle(displayName);
     setDialogTitle(displayName);
     setKey(
         KEY_PREFIX
             + subtype.getLocale()
             + "_"
             + SubtypeLocale.getKeyboardLayoutSetName(subtype));
   }
 }
 private InputMethodSubtype findDuplicatedSubtype(InputMethodSubtype subtype) {
   final String localeString = subtype.getLocale();
   final String keyboardLayoutSetName = SubtypeLocale.getKeyboardLayoutSetName(subtype);
   return ImfUtils.findSubtypeByLocaleAndKeyboardLayoutSet(
       getActivity(), localeString, keyboardLayoutSetName);
 }
 public KeyboardLayoutSetItem(InputMethodSubtype subtype) {
   super(
       SubtypeLocale.getKeyboardLayoutSetName(subtype),
       SubtypeLocale.getKeyboardLayoutSetDisplayName(subtype));
 }