summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2013-10-04 18:16:54 +0900
committerSatoshi Kataoka <satok@google.com>2013-10-04 20:01:00 +0900
commite7ed5cae44b52f22d866e60f5e3c7e87f1375a1f (patch)
tree5bd0cdea52bc60464244b8f4880bc0d0752bfa65 /java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java
parent0b4d75c2faa1dcafc050d5b21034962557261eaa (diff)
Fix emoji recent key behavior
Bug: 10538430 Change-Id: I91e03a8e7914628cdc8e57c124c95e5e6e8ea2a6
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java b/java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java
index eb48d01f6..db7c845bc 100644
--- a/java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java
@@ -580,10 +580,18 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
}
private void setCurrentCategoryId(final int categoryId, final boolean force) {
- if (mEmojiCategory.getCurrentCategoryId() == categoryId && !force) {
+ final int oldCategoryId = mEmojiCategory.getCurrentCategoryId();
+ if (oldCategoryId == categoryId && !force) {
return;
}
+ if (oldCategoryId == CATEGORY_ID_RECENTS) {
+ // Needs to save pending updates for recent keys when we get out of the recents
+ // category because we don't want to move the recent emojis around while the user
+ // is in the recents category.
+ mEmojiKeyboardAdapter.flushPendingRecentKeys();
+ }
+
mEmojiCategory.setCurrentCategoryId(categoryId);
final int newTabId = mEmojiCategory.getTabIdFromCategoryId(categoryId);
final int newCategoryPageId = mEmojiCategory.getPageIdFromCategoryId(categoryId);
@@ -612,8 +620,18 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
mRecentsKeyboard = mEmojiCategory.getKeyboard(CATEGORY_ID_RECENTS, 0);
}
+ public void flushPendingRecentKeys() {
+ mRecentsKeyboard.flushPendingRecentKeys();
+ final KeyboardView recentKeyboardView =
+ mActiveKeyboardView.get(mEmojiCategory.getRecentTabId());
+ if (recentKeyboardView != null) {
+ recentKeyboardView.invalidateAllKeys();
+ }
+ }
+
public void addRecentKey(final Key key) {
if (mEmojiCategory.isInRecentTab()) {
+ mRecentsKeyboard.addPendingKey(key);
return;
}
mRecentsKeyboard.addKeyFirst(key);