aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
authorIan Pedowitz <ijpedowitz@google.com>2015-11-10 03:30:57 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-11-10 03:30:57 +0000
commit09a2d702e378480f6123c720997c74fbbebeff51 (patch)
tree4d01fea30728a70fd14927449cd914c2b7537b74 /java/src/com/android/inputmethod
parentc4056793626948585e8c477d704366aa9a5231e0 (diff)
parente1d501268396e58bfdd37a0a50dfeb2ac48139a8 (diff)
downloadlatinime-09a2d702e378480f6123c720997c74fbbebeff51.tar.gz
latinime-09a2d702e378480f6123c720997c74fbbebeff51.tar.xz
latinime-09a2d702e378480f6123c720997c74fbbebeff51.zip
Revert "Unicode 8.0 emoji changes to Google Keyboard."
am: e1d5012683 * commit 'e1d501268396e58bfdd37a0a50dfeb2ac48139a8': Revert "Unicode 8.0 emoji changes to Google Keyboard."
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardId.java22
-rw-r--r--java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java137
2 files changed, 19 insertions, 140 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
index 7352f911b..a1f7bf0e1 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,16 +60,6 @@ public final class KeyboardId {
public static final int ELEMENT_EMOJI_CATEGORY4 = 14;
public static final int ELEMENT_EMOJI_CATEGORY5 = 15;
public static final int ELEMENT_EMOJI_CATEGORY6 = 16;
- public static final int ELEMENT_EMOJI_CATEGORY7 = 17;
- public static final int ELEMENT_EMOJI_CATEGORY8 = 18;
- public static final int ELEMENT_EMOJI_CATEGORY9 = 19;
- public static final int ELEMENT_EMOJI_CATEGORY10 = 20;
- public static final int ELEMENT_EMOJI_CATEGORY11 = 21;
- public static final int ELEMENT_EMOJI_CATEGORY12 = 22;
- public static final int ELEMENT_EMOJI_CATEGORY13 = 23;
- public static final int ELEMENT_EMOJI_CATEGORY14 = 24;
- public static final int ELEMENT_EMOJI_CATEGORY15 = 25;
- public static final int ELEMENT_EMOJI_CATEGORY16 = 26;
public final RichInputMethodSubtype mSubtype;
public final int mWidth;
@@ -235,16 +225,6 @@ public final class KeyboardId {
case ELEMENT_EMOJI_CATEGORY4: return "emojiCategory4";
case ELEMENT_EMOJI_CATEGORY5: return "emojiCategory5";
case ELEMENT_EMOJI_CATEGORY6: return "emojiCategory6";
- case ELEMENT_EMOJI_CATEGORY7: return "emojiCategory7";
- case ELEMENT_EMOJI_CATEGORY8: return "emojiCategory8";
- case ELEMENT_EMOJI_CATEGORY9: return "emojiCategory9";
- case ELEMENT_EMOJI_CATEGORY10: return "emojiCategory10";
- case ELEMENT_EMOJI_CATEGORY11: return "emojiCategory11";
- case ELEMENT_EMOJI_CATEGORY12: return "emojiCategory12";
- case ELEMENT_EMOJI_CATEGORY13: return "emojiCategory13";
- case ELEMENT_EMOJI_CATEGORY14: return "emojiCategory14";
- case ELEMENT_EMOJI_CATEGORY15: return "emojiCategory15";
- case ELEMENT_EMOJI_CATEGORY16: return "emojiCategory16";
default: return null;
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
index 1f4fbe521..f2f52f85b 100644
--- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
+++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ package com.android.inputmethod.keyboard.emoji;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Build;
import android.util.Log;
@@ -51,16 +50,6 @@ final class EmojiCategory {
private static final int ID_PLACES = 4;
private static final int ID_SYMBOLS = 5;
private static final int ID_EMOTICONS = 6;
- private static final int ID_FLAGS = 7;
- private static final int ID_EIGHT_SMILEY_PEOPLE = 8;
- private static final int ID_EIGHT_ANIMALS_NATURE = 9;
- private static final int ID_EIGHT_FOOD_DRINK = 10;
- private static final int ID_EIGHT_TRAVEL_PLACES = 11;
- private static final int ID_EIGHT_ACTIVITY = 12;
- private static final int ID_EIGHT_OBJECTS = 13;
- private static final int ID_EIGHT_SYMBOLS = 14;
- private static final int ID_EIGHT_FLAGS = 15;
- private static final int ID_EIGHT_SMILEY_PEOPLE_BORING = 16;
public final class CategoryProperties {
public final int mCategoryId;
@@ -78,17 +67,7 @@ final class EmojiCategory {
"nature",
"places",
"symbols",
- "emoticons",
- "flags",
- "smiley & people",
- "animals & nature",
- "food & drink",
- "travel & places",
- "activity",
- "objects2",
- "symbols2",
- "flags2",
- "smiley & people2" };
+ "emoticons" };
private static final int[] sCategoryTabIconAttr = {
R.styleable.EmojiPalettesView_iconEmojiRecentsTab,
@@ -97,17 +76,7 @@ final class EmojiCategory {
R.styleable.EmojiPalettesView_iconEmojiCategory3Tab,
R.styleable.EmojiPalettesView_iconEmojiCategory4Tab,
R.styleable.EmojiPalettesView_iconEmojiCategory5Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory6Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory7Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory8Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory9Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory10Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory11Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory12Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory13Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory14Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory15Tab,
- R.styleable.EmojiPalettesView_iconEmojiCategory16Tab };
+ R.styleable.EmojiPalettesView_iconEmojiCategory6Tab };
private static final int[] sAccessibilityDescriptionResourceIdsForCategories = {
R.string.spoken_descrption_emoji_category_recents,
@@ -116,17 +85,7 @@ final class EmojiCategory {
R.string.spoken_descrption_emoji_category_nature,
R.string.spoken_descrption_emoji_category_places,
R.string.spoken_descrption_emoji_category_symbols,
- R.string.spoken_descrption_emoji_category_emoticons,
- R.string.spoken_descrption_emoji_category_flags,
- R.string.spoken_descrption_emoji_category_eight_smiley_people,
- R.string.spoken_descrption_emoji_category_eight_animals_nature,
- R.string.spoken_descrption_emoji_category_eight_food_drink,
- R.string.spoken_descrption_emoji_category_eight_travel_places,
- R.string.spoken_descrption_emoji_category_eight_activity,
- R.string.spoken_descrption_emoji_category_objects,
- R.string.spoken_descrption_emoji_category_symbols,
- R.string.spoken_descrption_emoji_category_flags,
- R.string.spoken_descrption_emoji_category_eight_smiley_people };
+ R.string.spoken_descrption_emoji_category_emoticons };
private static final int[] sCategoryElementId = {
KeyboardId.ELEMENT_EMOJI_RECENTS,
@@ -135,17 +94,7 @@ final class EmojiCategory {
KeyboardId.ELEMENT_EMOJI_CATEGORY3,
KeyboardId.ELEMENT_EMOJI_CATEGORY4,
KeyboardId.ELEMENT_EMOJI_CATEGORY5,
- KeyboardId.ELEMENT_EMOJI_CATEGORY6,
- KeyboardId.ELEMENT_EMOJI_CATEGORY7,
- KeyboardId.ELEMENT_EMOJI_CATEGORY8,
- KeyboardId.ELEMENT_EMOJI_CATEGORY9,
- KeyboardId.ELEMENT_EMOJI_CATEGORY10,
- KeyboardId.ELEMENT_EMOJI_CATEGORY11,
- KeyboardId.ELEMENT_EMOJI_CATEGORY12,
- KeyboardId.ELEMENT_EMOJI_CATEGORY13,
- KeyboardId.ELEMENT_EMOJI_CATEGORY14,
- KeyboardId.ELEMENT_EMOJI_CATEGORY15,
- KeyboardId.ELEMENT_EMOJI_CATEGORY16 };
+ KeyboardId.ELEMENT_EMOJI_CATEGORY6 };
private final SharedPreferences mPrefs;
private final Resources mRes;
@@ -175,37 +124,17 @@ final class EmojiCategory {
int defaultCategoryId = EmojiCategory.ID_SYMBOLS;
addShownCategoryId(EmojiCategory.ID_RECENTS);
if (BuildCompatUtils.EFFECTIVE_SDK_INT >= Build.VERSION_CODES.KITKAT) {
- if (canShowUnicodeEightEmoji()) {
- if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
- defaultCategoryId = EmojiCategory.ID_EIGHT_SMILEY_PEOPLE;
- addShownCategoryId(EmojiCategory.ID_EIGHT_SMILEY_PEOPLE);
- } else {
- defaultCategoryId = EmojiCategory.ID_EIGHT_SMILEY_PEOPLE_BORING;
- addShownCategoryId(EmojiCategory.ID_EIGHT_SMILEY_PEOPLE_BORING);
- }
- addShownCategoryId(EmojiCategory.ID_EIGHT_ANIMALS_NATURE);
- addShownCategoryId(EmojiCategory.ID_EIGHT_FOOD_DRINK);
- addShownCategoryId(EmojiCategory.ID_EIGHT_TRAVEL_PLACES);
- addShownCategoryId(EmojiCategory.ID_EIGHT_ACTIVITY);
- addShownCategoryId(EmojiCategory.ID_EIGHT_OBJECTS);
- addShownCategoryId(EmojiCategory.ID_EIGHT_SYMBOLS);
- addShownCategoryId(EmojiCategory.ID_FLAGS); // Exclude combinations without glyphs.
- } else {
- defaultCategoryId = EmojiCategory.ID_PEOPLE;
- addShownCategoryId(EmojiCategory.ID_PEOPLE);
- addShownCategoryId(EmojiCategory.ID_OBJECTS);
- addShownCategoryId(EmojiCategory.ID_NATURE);
- addShownCategoryId(EmojiCategory.ID_PLACES);
- addShownCategoryId(EmojiCategory.ID_SYMBOLS);
- if (canShowFlagEmoji()) {
- addShownCategoryId(EmojiCategory.ID_FLAGS);
- }
- }
+ defaultCategoryId = EmojiCategory.ID_PEOPLE;
+ addShownCategoryId(EmojiCategory.ID_PEOPLE);
+ addShownCategoryId(EmojiCategory.ID_OBJECTS);
+ addShownCategoryId(EmojiCategory.ID_NATURE);
+ addShownCategoryId(EmojiCategory.ID_PLACES);
}
+ addShownCategoryId(EmojiCategory.ID_SYMBOLS);
addShownCategoryId(EmojiCategory.ID_EMOTICONS);
DynamicGridKeyboard recentsKbd =
- getKeyboard(EmojiCategory.ID_RECENTS, 0 /* categoryPageId */);
+ getKeyboard(EmojiCategory.ID_RECENTS, 0 /* cagetoryPageId */);
recentsKbd.loadRecentKeys(mCategoryKeyboardMap.values());
mCurrentCategoryId = Settings.readLastShownEmojiCategoryId(mPrefs, defaultCategoryId);
@@ -218,7 +147,7 @@ final class EmojiCategory {
private void addShownCategoryId(final int categoryId) {
// Load a keyboard of categoryId
- getKeyboard(categoryId, 0 /* categoryPageId */);
+ getKeyboard(categoryId, 0 /* cagetoryPageId */);
final CategoryProperties properties =
new CategoryProperties(categoryId, getCategoryPageCount(categoryId));
mShownCategories.add(properties);
@@ -353,16 +282,16 @@ final class EmojiCategory {
public DynamicGridKeyboard getKeyboard(final int categoryId, final int id) {
synchronized (mCategoryKeyboardMap) {
- final Long categoryKeyboardMapKey = getCategoryKeyboardMapKey(categoryId, id);
- if (mCategoryKeyboardMap.containsKey(categoryKeyboardMapKey)) {
- return mCategoryKeyboardMap.get(categoryKeyboardMapKey);
+ final Long categotyKeyboardMapKey = getCategoryKeyboardMapKey(categoryId, id);
+ if (mCategoryKeyboardMap.containsKey(categotyKeyboardMapKey)) {
+ return mCategoryKeyboardMap.get(categotyKeyboardMapKey);
}
if (categoryId == EmojiCategory.ID_RECENTS) {
final DynamicGridKeyboard kbd = new DynamicGridKeyboard(mPrefs,
mLayoutSet.getKeyboard(KeyboardId.ELEMENT_EMOJI_RECENTS),
mMaxPageKeyCount, categoryId);
- mCategoryKeyboardMap.put(categoryKeyboardMapKey, kbd);
+ mCategoryKeyboardMap.put(categotyKeyboardMapKey, kbd);
return kbd;
}
@@ -382,7 +311,7 @@ final class EmojiCategory {
mCategoryKeyboardMap.put(
getCategoryKeyboardMapKey(categoryId, pageId), tempKeyboard);
}
- return mCategoryKeyboardMap.get(categoryKeyboardMapKey);
+ return mCategoryKeyboardMap.get(categotyKeyboardMapKey);
}
}
@@ -426,34 +355,4 @@ final class EmojiCategory {
}
return retval;
}
-
- private static boolean canShowFlagEmoji() {
- Paint paint = new Paint();
- String switzerland = "\uD83C\uDDE8\uD83C\uDDED"; // U+1F1E8 U+1F1ED Flag for Switzerland
- try {
- return paint.hasGlyph(switzerland);
- } catch (NoSuchMethodError e) {
- // Compare display width of single-codepoint emoji to width of flag emoji to determine
- // whether flag is rendered as single glyph or two adjacent regional indicator symbols.
- float flagWidth = paint.measureText(switzerland);
- float standardWidth = paint.measureText("\uD83D\uDC27"); // U+1F427 Penguin
- return flagWidth < standardWidth * 1.25;
- // This assumes that a valid glyph for the flag emoji must be less than 1.25 times
- // the width of the penguin.
- }
- }
-
- private static boolean canShowUnicodeEightEmoji() {
- Paint paint = new Paint();
- String cheese = "\uD83E\uDDC0"; // U+1F9C0 Cheese wedge
- try {
- return paint.hasGlyph(cheese);
- } catch (NoSuchMethodError e) {
- float cheeseWidth = paint.measureText(cheese);
- float tofuWidth = paint.measureText("\uFFFE");
- return cheeseWidth > tofuWidth;
- // This assumes that a valid glyph for the cheese wedge must be greater than the width
- // of the noncharacter.
- }
- }
}