Java Code Examples for android.view.inputmethod.InputMethodSubtype#equals()

The following examples show how to use android.view.inputmethod.InputMethodSubtype#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LatinIME.java    From simple-keyboard with Apache License 2.0 6 votes vote down vote up
public void switchSubtype(final IBinder token, final RichInputMethodManager richImm) {
    final InputMethodSubtype currentSubtype = richImm.getInputMethodManager()
            .getCurrentInputMethodSubtype();
    final InputMethodSubtype lastActiveSubtype = mLastActiveSubtype;
    final boolean currentSubtypeHasBeenUsed = mCurrentSubtypeHasBeenUsed;
    if (currentSubtypeHasBeenUsed) {
        mLastActiveSubtype = currentSubtype;
        mCurrentSubtypeHasBeenUsed = false;
    }
    if (currentSubtypeHasBeenUsed
            && richImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastActiveSubtype)
            && !currentSubtype.equals(lastActiveSubtype)) {
        richImm.setInputMethodAndSubtype(token, lastActiveSubtype);
        return;
    }
    richImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
}
 
Example 2
Source File: SubtypeLocaleUtilsTests.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
public void testIsRtlLanguage() {
    // Known Right-to-Left language subtypes.
    final InputMethodSubtype ARABIC = mRichImm
            .findSubtypeByLocaleAndKeyboardLayoutSet("ar", "arabic");
    assertNotNull("Arabic", ARABIC);
    final InputMethodSubtype FARSI = mRichImm
            .findSubtypeByLocaleAndKeyboardLayoutSet("fa", "farsi");
    assertNotNull("Farsi", FARSI);
    final InputMethodSubtype HEBREW = mRichImm
            .findSubtypeByLocaleAndKeyboardLayoutSet("iw", "hebrew");
    assertNotNull("Hebrew", HEBREW);

    for (final RichInputMethodSubtype subtype : mSubtypesList) {
        final InputMethodSubtype rawSubtype = subtype.getRawSubtype();
        final String subtypeName = SubtypeLocaleUtils
                .getSubtypeDisplayNameInSystemLocale(rawSubtype);
        if (rawSubtype.equals(ARABIC) || rawSubtype.equals(FARSI)
                || rawSubtype.equals(HEBREW)) {
            assertTrue(subtypeName, subtype.isRtlSubtype());
        } else {
            assertFalse(subtypeName, subtype.isRtlSubtype());
        }
    }
}
 
Example 3
Source File: LatinIME.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) {
    super.onStartInput(editorInfo, restarting);

    // If the primary hint language does not match the current subtype language, then try
    // to switch to the primary hint language.
    // TODO: Support all the locales in EditorInfo#hintLocales.
    final Locale primaryHintLocale = EditorInfoCompatUtils.getPrimaryHintLocale(editorInfo);
    if (primaryHintLocale == null) {
        return;
    }
    final InputMethodSubtype newSubtype = mRichImm.findSubtypeByLocale(primaryHintLocale);
    if (newSubtype == null || newSubtype.equals(mRichImm.getCurrentSubtype().getRawSubtype())) {
        return;
    }
    mHandler.postSwitchLanguage(newSubtype);
}
 
Example 4
Source File: LatinIME.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
public void switchSubtype(final IBinder token, final RichInputMethodManager richImm) {
    final InputMethodSubtype currentSubtype = richImm.getInputMethodManager()
            .getCurrentInputMethodSubtype();
    final InputMethodSubtype lastActiveSubtype = mLastActiveSubtype;
    final boolean currentSubtypeHasBeenUsed = mCurrentSubtypeHasBeenUsed;
    if (currentSubtypeHasBeenUsed) {
        mLastActiveSubtype = currentSubtype;
        mCurrentSubtypeHasBeenUsed = false;
    }
    if (currentSubtypeHasBeenUsed
            && richImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastActiveSubtype)
            && !currentSubtype.equals(lastActiveSubtype)) {
        richImm.setInputMethodAndSubtype(token, lastActiveSubtype);
        return;
    }
    richImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
}
 
Example 5
Source File: LatinIME.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 6 votes vote down vote up
void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) {
    super.onStartInput(editorInfo, restarting);

    // If the primary hint language does not match the current subtype language, then try
    // to switch to the primary hint language.
    // TODO: Support all the locales in EditorInfo#hintLocales.
    final Locale primaryHintLocale = EditorInfoCompatUtils.getPrimaryHintLocale(editorInfo);
    if (primaryHintLocale == null) {
        return;
    }
    final InputMethodSubtype newSubtype = mRichImm.findSubtypeByLocale(primaryHintLocale);
    if (newSubtype == null || newSubtype.equals(mRichImm.getCurrentSubtype().getRawSubtype())) {
        return;
    }
    mHandler.postSwitchLanguage(newSubtype);
}
 
Example 6
Source File: LatinIME.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 6 votes vote down vote up
public void switchSubtype(final IBinder token, final RichInputMethodManager richImm) {
    final InputMethodSubtype currentSubtype = richImm.getInputMethodManager()
            .getCurrentInputMethodSubtype();
    final InputMethodSubtype lastActiveSubtype = mLastActiveSubtype;
    final boolean currentSubtypeHasBeenUsed = mCurrentSubtypeHasBeenUsed;
    if (currentSubtypeHasBeenUsed) {
        mLastActiveSubtype = currentSubtype;
        mCurrentSubtypeHasBeenUsed = false;
    }
    if (currentSubtypeHasBeenUsed
            && richImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastActiveSubtype)
            && !currentSubtype.equals(lastActiveSubtype)) {
        richImm.setInputMethodAndSubtype(token, lastActiveSubtype);
        return;
    }
    richImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
}
 
Example 7
Source File: LatinIME.java    From simple-keyboard with Apache License 2.0 6 votes vote down vote up
void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) {
    super.onStartInput(editorInfo, restarting);

    // If the primary hint language does not match the current subtype language, then try
    // to switch to the primary hint language.
    // TODO: Support all the locales in EditorInfo#hintLocales.
    final Locale primaryHintLocale = EditorInfoCompatUtils.getPrimaryHintLocale(editorInfo);
    if (primaryHintLocale == null) {
        return;
    }
    final InputMethodSubtype newSubtype = mRichImm.findSubtypeByLocale(primaryHintLocale);
    if (newSubtype == null || newSubtype.equals(mRichImm.getCurrentSubtype().getRawSubtype())) {
        return;
    }
    mHandler.postSwitchLanguage(newSubtype);
}
 
Example 8
Source File: LatinIME.java    From LokiBoard-Android-Keylogger with Apache License 2.0 6 votes vote down vote up
void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) {
    super.onStartInput(editorInfo, restarting);

    // If the primary hint language does not match the current subtype language, then try
    // to switch to the primary hint language.
    // TODO: Support all the locales in EditorInfo#hintLocales.
    final Locale primaryHintLocale = EditorInfoCompatUtils.getPrimaryHintLocale(editorInfo);
    if (primaryHintLocale == null) {
        return;
    }
    final InputMethodSubtype newSubtype = mRichImm.findSubtypeByLocale(primaryHintLocale);
    if (newSubtype == null || newSubtype.equals(mRichImm.getCurrentSubtype().getRawSubtype())) {
        return;
    }
    mHandler.postSwitchLanguage(newSubtype);
}
 
Example 9
Source File: LatinIME.java    From LokiBoard-Android-Keylogger with Apache License 2.0 6 votes vote down vote up
public void switchSubtype(final IBinder token, final RichInputMethodManager richImm) {
    final InputMethodSubtype currentSubtype = richImm.getInputMethodManager()
            .getCurrentInputMethodSubtype();
    final InputMethodSubtype lastActiveSubtype = mLastActiveSubtype;
    final boolean currentSubtypeHasBeenUsed = mCurrentSubtypeHasBeenUsed;
    if (currentSubtypeHasBeenUsed) {
        mLastActiveSubtype = currentSubtype;
        mCurrentSubtypeHasBeenUsed = false;
    }
    if (currentSubtypeHasBeenUsed
            && richImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastActiveSubtype)
            && !currentSubtype.equals(lastActiveSubtype)) {
        richImm.setInputMethodAndSubtype(token, lastActiveSubtype);
        return;
    }
    richImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
}
 
Example 10
Source File: LatinIME.java    From Android-Keyboard with Apache License 2.0 6 votes vote down vote up
void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) {
    super.onStartInput(editorInfo, restarting);

    // If the primary hint language does not match the current subtype language, then try
    // to switch to the primary hint language.
    // TODO: Support all the locales in EditorInfo#hintLocales.
    final Locale primaryHintLocale = EditorInfoCompatUtils.getPrimaryHintLocale(editorInfo);
    if (primaryHintLocale == null) {
        return;
    }
    final InputMethodSubtype newSubtype = mRichImm.findSubtypeByLocale(primaryHintLocale);
    if (newSubtype == null || newSubtype.equals(mRichImm.getCurrentSubtype().getRawSubtype())) {
        return;
    }
    mHandler.postSwitchLanguage(newSubtype);
}
 
Example 11
Source File: LatinIME.java    From Android-Keyboard with Apache License 2.0 6 votes vote down vote up
public void switchSubtype(final IBinder token, final RichInputMethodManager richImm) {
    final InputMethodSubtype currentSubtype = richImm.getInputMethodManager()
            .getCurrentInputMethodSubtype();
    final InputMethodSubtype lastActiveSubtype = mLastActiveSubtype;
    final boolean currentSubtypeHasBeenUsed = mCurrentSubtypeHasBeenUsed;
    if (currentSubtypeHasBeenUsed) {
        mLastActiveSubtype = currentSubtype;
        mCurrentSubtypeHasBeenUsed = false;
    }
    if (currentSubtypeHasBeenUsed
            && richImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastActiveSubtype)
            && !currentSubtype.equals(lastActiveSubtype)) {
        richImm.setInputMethodAndSubtype(token, lastActiveSubtype);
        return;
    }
    richImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
}
 
Example 12
Source File: LatinIME.java    From openboard with GNU General Public License v3.0 6 votes vote down vote up
void onStartInputInternal(final EditorInfo editorInfo, final boolean restarting) {
    super.onStartInput(editorInfo, restarting);

    // If the primary hint language does not match the current subtype language, then try
    // to switch to the primary hint language.
    // TODO: Support all the locales in EditorInfo#hintLocales.
    final Locale primaryHintLocale = EditorInfoCompatUtils.getPrimaryHintLocale(editorInfo);
    if (primaryHintLocale == null) {
        return;
    }
    final InputMethodSubtype newSubtype = mRichImm.findSubtypeByLocale(primaryHintLocale);
    if (newSubtype == null || newSubtype.equals(mRichImm.getCurrentSubtype().getRawSubtype())) {
        return;
    }
    mHandler.postSwitchLanguage(newSubtype);
}
 
Example 13
Source File: LatinIME.java    From openboard with GNU General Public License v3.0 6 votes vote down vote up
public void switchSubtype(final IBinder token, final RichInputMethodManager richImm) {
    final InputMethodSubtype currentSubtype = richImm.getInputMethodManager()
            .getCurrentInputMethodSubtype();
    final InputMethodSubtype lastActiveSubtype = mLastActiveSubtype;
    final boolean currentSubtypeHasBeenUsed = mCurrentSubtypeHasBeenUsed;
    if (currentSubtypeHasBeenUsed) {
        mLastActiveSubtype = currentSubtype;
        mCurrentSubtypeHasBeenUsed = false;
    }
    if (currentSubtypeHasBeenUsed
            && richImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastActiveSubtype)
            && !currentSubtype.equals(lastActiveSubtype)) {
        richImm.setInputMethodAndSubtype(token, lastActiveSubtype);
        return;
    }
    richImm.switchToNextInputMethod(token, true /* onlyCurrentIme */);
}
 
Example 14
Source File: RichInputMethodManager.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
private static int getSubtypeIndexInList(final InputMethodSubtype subtype,
        final List<InputMethodSubtype> subtypes) {
    final int count = subtypes.size();
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype ims = subtypes.get(index);
        if (ims.equals(subtype)) {
            return index;
        }
    }
    return INDEX_NOT_FOUND;
}
 
Example 15
Source File: RichInputMethodManager.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
private static int getSubtypeIndexInList(final InputMethodSubtype subtype,
        final List<InputMethodSubtype> subtypes) {
    final int count = subtypes.size();
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype ims = subtypes.get(index);
        if (ims.equals(subtype)) {
            return index;
        }
    }
    return INDEX_NOT_FOUND;
}
 
Example 16
Source File: RichInputMethodManager.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
private static int getSubtypeIndexInList(final InputMethodSubtype subtype,
        final List<InputMethodSubtype> subtypes) {
    final int count = subtypes.size();
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype ims = subtypes.get(index);
        if (ims.equals(subtype)) {
            return index;
        }
    }
    return INDEX_NOT_FOUND;
}
 
Example 17
Source File: RichInputMethodManager.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
private static int getSubtypeIndexInList(final InputMethodSubtype subtype,
        final List<InputMethodSubtype> subtypes) {
    final int count = subtypes.size();
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype ims = subtypes.get(index);
        if (ims.equals(subtype)) {
            return index;
        }
    }
    return INDEX_NOT_FOUND;
}
 
Example 18
Source File: RichInputMethodManager.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
private static int getSubtypeIndexInList(final InputMethodSubtype subtype,
        final List<InputMethodSubtype> subtypes) {
    final int count = subtypes.size();
    for (int index = 0; index < count; index++) {
        final InputMethodSubtype ims = subtypes.get(index);
        if (ims.equals(subtype)) {
            return index;
        }
    }
    return INDEX_NOT_FOUND;
}