aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@google.com>2015-09-25 10:25:58 -0700
committerDmitry Torokhov <dtor@google.com>2015-10-15 12:47:32 -0700
commit28e65858d9f7e8f94e0b298275624703fd74af05 (patch)
treebc6c9cdec979dbbe3bb5aca463f2cd2dc721de91 /java/src
parent1fdb8f31562eeef78167585a878eb0450310036b (diff)
downloadlatinime-28e65858d9f7e8f94e0b298275624703fd74af05.tar.gz
latinime-28e65858d9f7e8f94e0b298275624703fd74af05.tar.xz
latinime-28e65858d9f7e8f94e0b298275624703fd74af05.zip
Do not start in recents tab if we do not have recent emojis
If user has not used emojis we should not bring recents emoji tab on the first invocation of the on-screen keyboard as it is confusing to see an empty tab. We will still be showing recents tab even if it is empty if user actively switched to it when using on-screen keyboard. Bug: 24497650 Change-Id: I68b4bf64441590858d246168cc4733a2875a1357 (cherry picked from commit 24d67eba27cb23c0d3aca44236247ec12380daa5)
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
index a9711aed2..f2f52f85b 100644
--- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
+++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java
@@ -120,22 +120,29 @@ final class EmojiCategory {
mCategoryTabIconId[i] = emojiPaletteViewAttr.getResourceId(
sCategoryTabIconAttr[i], 0);
}
+
+ int defaultCategoryId = EmojiCategory.ID_SYMBOLS;
addShownCategoryId(EmojiCategory.ID_RECENTS);
if (BuildCompatUtils.EFFECTIVE_SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ defaultCategoryId = EmojiCategory.ID_PEOPLE;
addShownCategoryId(EmojiCategory.ID_PEOPLE);
addShownCategoryId(EmojiCategory.ID_OBJECTS);
addShownCategoryId(EmojiCategory.ID_NATURE);
addShownCategoryId(EmojiCategory.ID_PLACES);
- mCurrentCategoryId =
- Settings.readLastShownEmojiCategoryId(mPrefs, EmojiCategory.ID_PEOPLE);
- } else {
- mCurrentCategoryId =
- Settings.readLastShownEmojiCategoryId(mPrefs, EmojiCategory.ID_SYMBOLS);
}
addShownCategoryId(EmojiCategory.ID_SYMBOLS);
addShownCategoryId(EmojiCategory.ID_EMOTICONS);
- getKeyboard(EmojiCategory.ID_RECENTS, 0 /* cagetoryPageId */)
- .loadRecentKeys(mCategoryKeyboardMap.values());
+
+ DynamicGridKeyboard recentsKbd =
+ getKeyboard(EmojiCategory.ID_RECENTS, 0 /* cagetoryPageId */);
+ recentsKbd.loadRecentKeys(mCategoryKeyboardMap.values());
+
+ mCurrentCategoryId = Settings.readLastShownEmojiCategoryId(mPrefs, defaultCategoryId);
+ if (mCurrentCategoryId == EmojiCategory.ID_RECENTS &&
+ recentsKbd.getSortedKeys().isEmpty()) {
+ Log.i(TAG, "No recent emojis found, starting in category " + mCurrentCategoryId);
+ mCurrentCategoryId = defaultCategoryId;
+ }
}
private void addShownCategoryId(final int categoryId) {