From c7e6f3dbc3758c3b0150212456cdce203ba27dbd Mon Sep 17 00:00:00 2001 From: Satoshi Kataoka Date: Tue, 1 Oct 2013 20:45:45 +0900 Subject: [PATCH] Unfortunately, hide some broken "emoji"s Bug: 10923117 Change-Id: I27ba38e5f388cc15ae331fd05d63db4e4a41cbbf --- java/res/values-v19/emoji-categories.xml | 42 +++++++++---------- .../keyboard/internal/CodesArrayParser.java | 32 +++++++++++--- .../keyboard/internal/KeyboardBuilder.java | 8 ++++ 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/java/res/values-v19/emoji-categories.xml b/java/res/values-v19/emoji-categories.xml index 658bbfa83..0d5aa1aa1 100644 --- a/java/res/values-v19/emoji-categories.xml +++ b/java/res/values-v19/emoji-categories.xml @@ -204,18 +204,18 @@ name="emoji_symbols" format="string" > - fe82e|0031,20e3 - fe82f|0032,20e3 - fe830|0033,20e3 - fe831|0034,20e3 - fe832|0035,20e3 - fe833|0036,20e3 - fe834|0037,20e3 - fe835|0038,20e3 - fe836|0039,20e3 - fe837|0030,20e3 + fe82e|0031,20e3|99 + fe82f|0032,20e3|99 + fe830|0033,20e3|99 + fe831|0034,20e3|99 + fe832|0035,20e3|99 + fe833|0036,20e3|99 + fe834|0037,20e3|99 + fe835|0038,20e3|99 + fe836|0039,20e3|99 + fe837|0030,20e3|99 1f51f - fe82c|0023,20e3 + fe82c|0023,20e3|99 1f51d 1f519 1f51b @@ -875,16 +875,16 @@ 1f48e 1f490 1f492 - fe4e5|1f1ef,1f1f5 - fe4e6|1f1fa,1f1f8 - fe4e7|1f1eb,1f1f7 - fe4e8|1f1e9,1f1ea - fe4e9|1f1ee,1f1f9 - fe4ea|1f1ec,1f1e7 - fe4eb|1f1ea,1f1f8 - fe4ec|1f1f7,1f1fa - fe4ed|1f1e8,1f1f3 - fe4ee|1f1f0,1f1f7 + fe4e5|1f1ef,1f1f5|99 + fe4e6|1f1fa,1f1f8|99 + fe4e7|1f1eb,1f1f7|99 + fe4e8|1f1e9,1f1ea|99 + fe4e9|1f1ee,1f1f9|99 + fe4ea|1f1ec,1f1e7|99 + fe4eb|1f1ea,1f1f8|99 + fe4ec|1f1f7,1f1fa|99 + fe4ed|1f1e8,1f1f3|99 + fe4ee|1f1f0,1f1f7|99 . The attribute codesArray is an * array of string. @@ -34,7 +36,7 @@ import com.android.inputmethod.latin.Constants; public final class CodesArrayParser { // Constants for parsing. private static final char COMMA = ','; - private static final char VERTICAL_BAR = '|'; + private static final String VERTICAL_BAR_STRING = "\\|"; private static final String COMMA_STRING = ","; private static final int BASE_HEX = 16; @@ -43,8 +45,11 @@ public final class CodesArrayParser { } private static String getLabelSpec(final String codesArraySpec) { - final int pos = codesArraySpec.indexOf(VERTICAL_BAR); - return (pos < 0) ? codesArraySpec : codesArraySpec.substring(0, pos); + final String[] strs = codesArraySpec.split(VERTICAL_BAR_STRING, -1); + if (strs.length <= 1) { + return codesArraySpec; + } + return strs[0]; } public static String parseLabel(final String codesArraySpec) { @@ -58,8 +63,25 @@ public final class CodesArrayParser { } private static String getCodeSpec(final String codesArraySpec) { - final int pos = codesArraySpec.indexOf(VERTICAL_BAR); - return (pos < 0) ? codesArraySpec : codesArraySpec.substring(pos + 1); + final String[] strs = codesArraySpec.split(VERTICAL_BAR_STRING, -1); + if (strs.length <= 1) { + return codesArraySpec; + } + return TextUtils.isEmpty(strs[1]) ? strs[0] : strs[1]; + } + + // codesArraySpec consists of: + //