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

Commit 27207eaa authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Pull up some common code again (A99)"

parents 722b0027 860a9f85
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -114,6 +114,15 @@ public class BinaryDictionary extends Dictionary {
        // TODO: toLowerCase in the native code
        final int[] prevWordCodePointArray = (null == prevWord)
                ? null : StringUtils.toCodePointArray(prevWord.toString());
        final int composerSize = composer.size();

        if (composerSize <= 1 || !composer.isBatchMode()) {
            if (composerSize > MAX_WORD_LENGTH - 1) return null;
            for (int i = 0; i < composerSize; i++) {
                mInputCodes[i] = composer.getCodeAt(i);
            }
        }

        final int count;
        if (composer.size() <= 1) {
            count = TextUtils.isEmpty(prevWord) ? -1 : getBigramsInternal(composer,
@@ -142,9 +151,6 @@ public class BinaryDictionary extends Dictionary {
    private int getBigramsInternal(final WordComposer codes,
            final int[] previousWord) {
        int codesSize = codes.size();
        if (codesSize > 0) {
            mInputCodes[0] = codes.getCodeAt(0);
        }

        int count = getBigramsNative(mNativeDict, previousWord, previousWord.length, mInputCodes,
                codesSize, mOutputChars, mOutputScores, MAX_WORD_LENGTH, MAX_BIGRAMS);
@@ -165,11 +171,6 @@ public class BinaryDictionary extends Dictionary {
            codesSize = ips.getPointerSize();
        } else {
            codesSize = codes.size();
            // Won't deal with really long words.
            if (codesSize > MAX_WORD_LENGTH - 1) return -1;
            for (int i = 0; i < codesSize; i++) {
                mInputCodes[i] = codes.getCodeAt(i);
            }
        }

        return getSuggestionsNative(mNativeDict, proximityInfo.getNativeProximityInfo(),