congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
InputMethodSubtype
Code IndexAdd Tabnine to your IDE (free)

How to use
InputMethodSubtype
in
android.view.inputmethod

Best Java code snippets using android.view.inputmethod.InputMethodSubtype (Showing top 20 results out of 315)

origin: stackoverflow.com

 InputMethodSubtype subtype = mInputMethodManager.getCurrentInputMethodSubtype();
switch(subtype.getLocale()) {
  case "fa_IR":
    setLatinKeyboard(mPersianKeyboard);
    break;
  case "en_US":
    setLatinKeyboard(mQwertyKeyboard);
    break;
}
origin: stackoverflow.com

 private void printInputLanguages() {
  InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
  List<InputMethodInfo> ims = imm.getEnabledInputMethodList();

  for (InputMethodInfo method : ims) {
    List<InputMethodSubtype> submethods = imm.getEnabledInputMethodSubtypeList(method, true);
    for (InputMethodSubtype submethod : submethods) {
     if (submethod.getMode().equals("keyboard")) {
       String currentLocale = submethod.getLocale();
       Log.i(TAG, "Available input method locale: " + currentLocale);
     }
    }
  }
}
origin: crvv/android_wubi_input

private static String getReplacementString(final InputMethodSubtype subtype,
    final Locale displayLocale) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
      && subtype.containsExtraValueKey(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME)) {
    return subtype.getExtraValueOf(UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME);
  } else {
    return getSubtypeLocaleDisplayNameInternal(subtype.getLocale(), displayLocale);
  }
}
origin: crvv/android_wubi_input

public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) {
  String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
  if (keyboardLayoutSet == null) {
    // This subtype doesn't have a keyboardLayoutSet extra value, so lookup its keyboard
    // layout set in sLocaleAndExtraValueToKeyboardLayoutSetMap to keep it compatible with
    // pre-JellyBean.
    final String key = subtype.getLocale() + ":" + subtype.getExtraValue();
    keyboardLayoutSet = sLocaleAndExtraValueToKeyboardLayoutSetMap.get(key);
  }
  // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
  // fixed.
  if (keyboardLayoutSet == null) {
    android.util.Log.w(TAG, "KeyboardLayoutSet not found, use QWERTY: " +
        "locale=" + subtype.getLocale() + " extraValue=" + subtype.getExtraValue());
    return QWERTY;
  }
  return keyboardLayoutSet;
}
origin: crvv/android_wubi_input

  @Override
  protected String job(final Resources res) {
    try {
      return res.getString(nameResId, replacementString);
    } catch (Resources.NotFoundException e) {
      // TODO: Remove this catch when InputMethodManager.getCurrentInputMethodSubtype
      // is fixed.
      Log.w(TAG, "Unknown subtype: mode=" + subtype.getMode()
          + " nameResId=" + subtype.getNameResId()
          + " locale=" + subtype.getLocale()
          + " extra=" + subtype.getExtraValue()
          + "\n" + DebugLogUtils.getStackTrace());
      return "";
    }
  }
};
origin: rkkr/simple-keyboard

  if (subtype.isAuxiliary()) {
    ++auxCount;
if (KEYBOARD_MODE.equals(subtype.getMode())) {
  ++keyboardCount;
origin: stackoverflow.com

String id = Settings.Secure.getString(context.getContentResolver(),
     Settings.Secure.DEFAULT_INPUT_METHOD
 );
 List<InputMethodInfo> enabledInputMethodList = inputMethodManager.getEnabledInputMethodList();
 for (InputMethodInfo inputMethodInfo : enabledInputMethodList) {
   if (inputMethodInfo.getId().equals(id)) {
     List<InputMethodSubtype> enabledInputMethodSubtypeList = inputMethodManager.getEnabledInputMethodSubtypeList(inputMethodInfo, true);
     for (InputMethodSubtype subtype : enabledInputMethodSubtypeList) {
       if (subtype.getLocale().equals(locale)) {                                   
         Settings.Secure.putInt(context.getContentResolver(),
         Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE, subtype.hashCode());
       }
     }
   }
 }
origin: rkkr/simple-keyboard

public static String getPrefSubtype(final InputMethodSubtype subtype) {
  final String localeString = subtype.getLocale();
  final String keyboardLayoutSetName = SubtypeLocaleUtils.getKeyboardLayoutSetName(subtype);
  final String layoutExtraValue = KEYBOARD_LAYOUT_SET + "=" + keyboardLayoutSetName;
  final String extraValue = StringUtils.removeFromCommaSplittableTextIfExists(
      layoutExtraValue, StringUtils.removeFromCommaSplittableTextIfExists(
          IS_ADDITIONAL_SUBTYPE, subtype.getExtraValue()));
  final String basePrefSubtype = localeString + LOCALE_AND_LAYOUT_SEPARATOR
      + keyboardLayoutSetName;
  return extraValue.isEmpty() ? basePrefSubtype
      : basePrefSubtype + LOCALE_AND_LAYOUT_SEPARATOR + extraValue;
}
origin: rkkr/simple-keyboard

  public static Locale getLocaleObject(final InputMethodSubtype subtype) {
    // Locale.forLanguageTag() is available only in Android L and later.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
      final String languageTag = subtype.getLanguageTag();
      if (!TextUtils.isEmpty(languageTag)) {
        return Locale.forLanguageTag(languageTag);
      }
    }
    return LocaleUtils.constructLocaleFromString(subtype.getLocale());
  }
}
origin: rkkr/simple-keyboard

public boolean hasBeenModified() {
  return mSubtype != null && !mSubtype.equals(mPreviousSubtype);
}
origin: rkkr/simple-keyboard

private static String getEnabledSubtypesLabel(
    Context context, InputMethodManager imm, InputMethodInfo imi) {
  if (context == null || imm == null || imi == null) return null;
  final List<InputMethodSubtype> subtypes = imm.getEnabledInputMethodSubtypeList(imi, true);
  final StringBuilder sb = new StringBuilder();
  final int N = subtypes.size();
  for (int i = 0; i < N; ++i) {
    final InputMethodSubtype subtype = subtypes.get(i);
    if (sb.length() > 0) {
      sb.append(", ");
    }
    sb.append(subtype.getDisplayName(context, imi.getPackageName(),
        imi.getServiceInfo().applicationInfo));
  }
  return sb.toString();
}
/**
origin: rkkr/simple-keyboard

    ? "<null>" : mShortcutInputMethodInfo.getId()) + ", "
+ (mShortcutSubtype == null ? "<null>" : (
    mShortcutSubtype.getLocale() + ", " + mShortcutSubtype.getMode())));
    ? "<null>" : mShortcutInputMethodInfo.getId()) + ", "
+ (mShortcutSubtype == null ? "<null>" : (
    mShortcutSubtype.getLocale() + ", " + mShortcutSubtype.getMode())));
origin: crvv/android_wubi_input

  public static String getCombiningRulesExtraValue(final InputMethodSubtype subtype) {
    return subtype.getExtraValueOf(Constants.Subtype.ExtraValue.COMBINING_RULES);
  }
}
origin: rkkr/simple-keyboard

public static InputMethodSubtype[] createAdditionalSubtypesArray(final String prefSubtypes) {
  if (TextUtils.isEmpty(prefSubtypes)) {
    return EMPTY_SUBTYPE_ARRAY;
  }
  final String[] prefSubtypeArray = prefSubtypes.split(PREF_SUBTYPE_SEPARATOR);
  final ArrayList<InputMethodSubtype> subtypesList = new ArrayList<>(prefSubtypeArray.length);
  for (final String prefSubtype : prefSubtypeArray) {
    final String elems[] = prefSubtype.split(LOCALE_AND_LAYOUT_SEPARATOR);
    if (elems.length != LENGTH_WITHOUT_EXTRA_VALUE
        && elems.length != LENGTH_WITH_EXTRA_VALUE) {
      Log.w(TAG, "Unknown additional subtype specified: " + prefSubtype + " in "
          + prefSubtypes);
      continue;
    }
    final String localeString = elems[INDEX_OF_LOCALE];
    final String keyboardLayoutSetName = elems[INDEX_OF_KEYBOARD_LAYOUT];
    // Here we assume that all the additional subtypes have AsciiCapable and EmojiCapable.
    // This is actually what the setting dialog for additional subtype is doing.
    final InputMethodSubtype subtype = createAsciiEmojiCapableAdditionalSubtype(
        localeString, keyboardLayoutSetName);
    if (subtype.getNameResId() == SubtypeLocaleUtils.UNKNOWN_KEYBOARD_LAYOUT) {
      // Skip unknown keyboard layout subtype. This may happen when predefined keyboard
      // layout has been removed.
      continue;
    }
    subtypesList.add(subtype);
  }
  return subtypesList.toArray(new InputMethodSubtype[subtypesList.size()]);
}
origin: crvv/android_wubi_input

private static boolean isAuxiliaryIme(final InputMethodInfo imi) {
  final int count = imi.getSubtypeCount();
  if (count == 0) {
    return false;
  }
  for (int index = 0; index < count; index++) {
    final InputMethodSubtype subtype = imi.getSubtypeAt(index);
    if (!subtype.isAuxiliary()) {
      return false;
    }
  }
  return true;
}
origin: rkkr/simple-keyboard

@Override
public int hashCode() {
  return mSubtype.hashCode() + mLocale.hashCode();
}
origin: crvv/android_wubi_input

public static boolean isAsciiCapable(final InputMethodSubtype subtype) {
  return isAsciiCapableWithAPI(subtype)
      || subtype.containsExtraValueKey(Constants.Subtype.ExtraValue.ASCII_CAPABLE);
}
origin: rkkr/simple-keyboard

  @Override
  protected String job(final Resources res) {
    try {
      return res.getString(nameResId, replacementString);
    } catch (Resources.NotFoundException e) {
      // TODO: Remove this catch when InputMethodManager.getCurrentInputMethodSubtype
      // is fixed.
      Log.w(TAG, "Unknown subtype: mode=" + subtype.getMode()
          + " nameResId=" + subtype.getNameResId()
          + " locale=" + subtype.getLocale()
          + " extra=" + subtype.getExtraValue()
          + "\n" + DebugLogUtils.getStackTrace());
      return "";
    }
  }
};
origin: rkkr/simple-keyboard

  @NonNull
  public static String getKeyboardLayoutSetName(final InputMethodSubtype subtype) {
    String keyboardLayoutSet = subtype.getExtraValueOf(KEYBOARD_LAYOUT_SET);
    if (keyboardLayoutSet == null) {
      // This subtype doesn't have a keyboardLayoutSet extra value, so lookup its keyboard
      // layout set in sLocaleAndExtraValueToKeyboardLayoutSetMap to keep it compatible with
      // pre-JellyBean.
      final String key = subtype.getLocale() + ":" + subtype.getExtraValue();
      keyboardLayoutSet = sLocaleAndExtraValueToKeyboardLayoutSetMap.get(key);
    }
    // TODO: Remove this null check when InputMethodManager.getCurrentInputMethodSubtype is
    // fixed.
    if (keyboardLayoutSet == null) {
      android.util.Log.w(TAG, "KeyboardLayoutSet not found, use QWERTY: " +
          "locale=" + subtype.getLocale() + " extraValue=" + subtype.getExtraValue());
      return QWERTY;
    }
    return keyboardLayoutSet;
  }
}
origin: crvv/android_wubi_input

  if (subtype.isAuxiliary()) {
    ++auxCount;
if (KEYBOARD_MODE.equals(subtype.getMode())) {
  ++keyboardCount;
android.view.inputmethodInputMethodSubtype

Most used methods

  • getLocale
  • getMode
  • getDisplayName
  • containsExtraValueKey
  • equals
  • getExtraValue
  • getExtraValueOf
  • getNameResId
  • hashCode
  • isAuxiliary
  • <init>
  • getLanguageTag
  • <init>,
  • getLanguageTag,
  • isAsciiCapable

Popular in Java

  • Finding current android device location
  • compareTo (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Permission (java.security)
    Legacy security code; do not use.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JOptionPane (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now