diff options
author | 2015-10-16 22:14:28 +0000 | |
---|---|---|
committer | 2015-10-16 22:14:28 +0000 | |
commit | b3a29efec0ea31008de058263b75838cb4f3be61 (patch) | |
tree | 5a9f9a8f13fdda365348e83363a950536d473ad6 /java/src/com/android/inputmethod | |
parent | 27eb56fdc25f586581ca791fe28eb1809555bfef (diff) | |
parent | 54c66d4f550388f1f04724936a17b12549394b14 (diff) | |
download | latinime-b3a29efec0ea31008de058263b75838cb4f3be61.tar.gz latinime-b3a29efec0ea31008de058263b75838cb4f3be61.tar.xz latinime-b3a29efec0ea31008de058263b75838cb4f3be61.zip |
am 54c66d4f: am 0b20a8d2: am b1cd4006: am 28e65858: Do not start in recents tab if we do not have recent emojis
* commit '54c66d4f550388f1f04724936a17b12549394b14':
Do not start in recents tab if we do not have recent emojis
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/emoji/EmojiCategory.java | 21 |
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) { |