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

Commit 03c30184 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android (Google) Code Review
Browse files

Merge "Use additional proximity chars even when no key is detected."

parents f6d26b27 9025c55e
Loading
Loading
Loading
Loading
+36 −27
Original line number Original line Diff line number Diff line
@@ -180,9 +180,12 @@ public class KeyDetector {
        if (maxCodesSize <= numCodes) {
        if (maxCodesSize <= numCodes) {
            return;
            return;
        }
        }
        if (primaryCode != NOT_A_CODE) {

            final List<Integer> additionalChars =
        final int code = (primaryCode == NOT_A_CODE) ? allCodes[0] : primaryCode;
                    mKeyboard.getAdditionalProximityChars().get(primaryCode);
        if (code == NOT_A_CODE) {
            return;
        }
        final List<Integer> additionalChars = mKeyboard.getAdditionalProximityChars().get(code);
        if (additionalChars == null || additionalChars.size() == 0) {
        if (additionalChars == null || additionalChars.size() == 0) {
            return;
            return;
        }
        }
@@ -209,7 +212,6 @@ public class KeyDetector {
            }
            }
        }
        }
    }
    }
    }


    /**
    /**
     * Finds all possible nearby key codes around a touch event point and returns the nearest key.
     * Finds all possible nearby key codes around a touch event point and returns the nearest key.
@@ -257,10 +259,17 @@ public class KeyDetector {


    public static String printableCodes(int[] codes) {
    public static String printableCodes(int[] codes) {
        final StringBuilder sb = new StringBuilder();
        final StringBuilder sb = new StringBuilder();
        boolean addDelimiter = false;
        for (final int code : codes) {
        for (final int code : codes) {
            if (code == NOT_A_CODE) break;
            if (code == NOT_A_CODE) break;
            if (sb.length() > 0) sb.append(", ");
            if (code == ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE) {
                sb.append(" | ");
                addDelimiter = false;
            } else {
                if (addDelimiter) sb.append(", ");
                sb.append(code);
                sb.append(code);
                addDelimiter = true;
            }
        }
        }
        return "[" + sb + "]";
        return "[" + sb + "]";
    }
    }