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

Commit bc1bf620 authored by Josep del Río's avatar Josep del Río Committed by Android (Google) Code Review
Browse files

Merge "Support dead characters when key presses are shown" into main

parents 6014fdd8 2a721827
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -578,6 +578,17 @@ public class KeyCharacterMap implements Parcelable {
        return combined;
    }

    /**
     * Get the combining character that corresponds with the provided accent.
     *
     * @param accent The accent character.  eg. '`'
     * @return The combining character
     * @hide
     */
    public static int getCombiningChar(int accent) {
        return sAccentToCombining.get(accent);
    }

    /**
     * Describes the character mappings associated with a key.
     *
+10 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.util.Slog;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.InputDevice;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.RoundedCorner;
@@ -335,7 +336,15 @@ public class FocusEventDebugView extends RelativeLayout {

        final int unicodeChar = event.getUnicodeChar();
        if (unicodeChar != 0) {
            return new String(Character.toChars(unicodeChar));
            if ((unicodeChar & KeyCharacterMap.COMBINING_ACCENT) != 0) {
                // Show combining character
                final int combiningChar = KeyCharacterMap.getCombiningChar(
                        unicodeChar & KeyCharacterMap.COMBINING_ACCENT_MASK);
                // Return the Unicode dotted circle as part of the label as it is used is used to
                // illustrate the effect of a combining marks
                return "\u25cc" + String.valueOf((char) combiningChar);
            }
            return String.valueOf((char) unicodeChar);
        }

        final var label = KeyEvent.keyCodeToString(event.getKeyCode());