summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@google.com>2015-10-16 21:56:09 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-10-16 21:56:09 +0000
commitb1cd4006027af90db427839b3c477930ab6aee31 (patch)
treef69f42875a516126ea37d5f8ad7f4e437a9e4806
parent1194ad63ee11ccccab4cd6bdeaa0dc85852008a9 (diff)
parent28e65858d9f7e8f94e0b298275624703fd74af05 (diff)
downloadandroid_packages_inputmethods_LatinIME-b1cd4006027af90db427839b3c477930ab6aee31.tar.gz
android_packages_inputmethods_LatinIME-b1cd4006027af90db427839b3c477930ab6aee31.tar.bz2
android_packages_inputmethods_LatinIME-b1cd4006027af90db427839b3c477930ab6aee31.zip
am 28e65858: Do not start in recents tab if we do not have recent emojis
* commit '28e65858d9f7e8f94e0b298275624703fd74af05': Do not start in recents tab if we do not have recent emojis
-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) {