Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35b5a7ba authored by satok's avatar satok Committed by Android (Google) Code Review
Browse files

Merge "Add isDictionaryAvailable to SubtypeSwitcher"

parents 0f87ca72 cf6b2099
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -104,8 +104,9 @@ public class SuggestionSpanUtils {
    }

    public static CharSequence getTextWithSuggestionSpan(Context context,
            CharSequence pickedWord, SuggestedWords suggestedWords) {
        if (TextUtils.isEmpty(pickedWord) || CONSTRUCTOR_SuggestionSpan == null
            CharSequence pickedWord, SuggestedWords suggestedWords, boolean dictionaryAvailable) {
        if (!dictionaryAvailable || TextUtils.isEmpty(pickedWord)
                || CONSTRUCTOR_SuggestionSpan == null
                || suggestedWords == null || suggestedWords.size() == 0
                || OBJ_SUGGESTIONS_MAX_SIZE == null) {
            return pickedWord;
+2 −1
Original line number Diff line number Diff line
@@ -1895,7 +1895,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
            if (mSettingsValues.mEnableSuggestionSpanInsertion) {
                final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions();
                ic.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan(
                        this, bestWord, suggestedWords), 1);
                        this, bestWord, suggestedWords, mSubtypeSwitcher.isDictionaryAvailable()),
                        1);
            } else {
                ic.commitText(bestWord, 1);
            }
+6 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public class SubtypeSwitcher {
    /*-----------------------------------------------------------*/
    // Variants which should be changed only by reload functions.
    private boolean mNeedsToDisplayLanguage;
    private boolean mIsDictionaryAvailable;
    private boolean mIsSystemLanguageSameAsInputLanguage;
    private InputMethodInfo mShortcutInputMethodInfo;
    private InputMethodSubtype mShortcutSubtype;
@@ -260,6 +261,7 @@ public class SubtypeSwitcher {
                getInputLocale().getLanguage());
        mNeedsToDisplayLanguage = !(getEnabledKeyboardLocaleCount() <= 1
                && mIsSystemLanguageSameAsInputLanguage);
        mIsDictionaryAvailable = DictionaryFactory.isDictionaryAvailable(mService, mInputLocale);
    }

    ////////////////////////////
@@ -379,6 +381,10 @@ public class SubtypeSwitcher {
        }
    }

    public boolean isDictionaryAvailable() {
        return mIsDictionaryAvailable;
    }

    // TODO: Remove this method
    private boolean isKeyboardMode() {
        return KEYBOARD_MODE.equals(getCurrentSubtypeMode());