Allow international characters input with apostrophe and double quotation

It has been reported that the behaviour of Android in US international
layout is not the same as Chromebook; according to Wikipedia, the
apostrophone and double quotation mark are "dead characters" that can
be used to enter characters with acute accents and umlauts:
https://en.wikipedia.org/wiki/QWERTY#/media/File:KB_US-International.svg

Since this seems to be the behavior in Mac and ChromeOS, this change
will align Android with the rest of the platforms. I decided to follow
the same pattern as MacOS, since typing the dead character twice will
input the actual character, and apostrophe/quotation mark are very
useful to have.

Bug: 259862772
Test: confirmed on device that it works as expected
Change-Id: Iaf326e07e9b07d07383be73ed65b1cac338ae0bf
This commit is contained in:
Josep del Rio
2022-12-07 18:23:46 +00:00
committed by Josep del Río
parent 8e023a00fe
commit d9c573d143
2 changed files with 12 additions and 6 deletions

View File

@@ -177,6 +177,8 @@ public class KeyCharacterMap implements Parcelable {
private static final int ACCENT_UMLAUT = '\u00A8';
private static final int ACCENT_VERTICAL_LINE_ABOVE = '\u02C8';
private static final int ACCENT_VERTICAL_LINE_BELOW = '\u02CC';
private static final int ACCENT_APOSTROPHE = '\'';
private static final int ACCENT_QUOTATION_MARK = '"';
/* Legacy dead key display characters used in previous versions of the API.
* We still support these characters by mapping them to their non-legacy version. */
@@ -204,8 +206,6 @@ public class KeyCharacterMap implements Parcelable {
addCombining('\u030A', ACCENT_RING_ABOVE);
addCombining('\u030B', ACCENT_DOUBLE_ACUTE);
addCombining('\u030C', ACCENT_CARON);
addCombining('\u030D', ACCENT_VERTICAL_LINE_ABOVE);
//addCombining('\u030E', ACCENT_DOUBLE_VERTICAL_LINE_ABOVE);
//addCombining('\u030F', ACCENT_DOUBLE_GRAVE);
//addCombining('\u0310', ACCENT_CANDRABINDU);
//addCombining('\u0311', ACCENT_INVERTED_BREVE);
@@ -229,11 +229,17 @@ public class KeyCharacterMap implements Parcelable {
sCombiningToAccent.append('\u0340', ACCENT_GRAVE);
sCombiningToAccent.append('\u0341', ACCENT_ACUTE);
sCombiningToAccent.append('\u0343', ACCENT_COMMA_ABOVE);
sCombiningToAccent.append('\u030D', ACCENT_APOSTROPHE);
sCombiningToAccent.append('\u030E', ACCENT_QUOTATION_MARK);
// One-way legacy mappings to preserve compatibility with older applications.
sAccentToCombining.append(ACCENT_GRAVE_LEGACY, '\u0300');
sAccentToCombining.append(ACCENT_CIRCUMFLEX_LEGACY, '\u0302');
sAccentToCombining.append(ACCENT_TILDE_LEGACY, '\u0303');
// One-way mappings to use the preferred accent
sAccentToCombining.append(ACCENT_APOSTROPHE, '\u0301');
sAccentToCombining.append(ACCENT_QUOTATION_MARK, '\u0308');
}
private static void addCombining(int combining, int accent) {

View File

@@ -292,10 +292,10 @@ key SEMICOLON {
key APOSTROPHE {
label: '\''
base: '\''
shift: '"'
ralt: '\u0301'
shift+ralt: '\u0308'
base: '\u030D'
shift: '\u030E'
ralt: '\u00B4'
shift+ralt: '\u00A8'
}
### ROW 4