diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/CustomEmojiPopupKeyboard.java b/mastodon/src/main/java/org/joinmastodon/android/ui/CustomEmojiPopupKeyboard.java index 16a1ae52e1..e976a3d1c2 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/CustomEmojiPopupKeyboard.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/CustomEmojiPopupKeyboard.java @@ -111,12 +111,13 @@ public int getSpanSize(int position){ list.setPadding(V.dp(16), 0, V.dp(16), 0); imgLoader=new ListImageLoaderWrapper(activity, list, new RecyclerViewDelegate(list), null); - List recentEmoji=new ArrayList<>(lp.recentCustomEmoji); - if(!recentEmoji.isEmpty()) - adapter.addAdapter(new SingleCategoryAdapter(recentEmojiCategory=new EmojiCategory(activity.getString(R.string.mo_emoji_recent), recentEmoji))); - - for(EmojiCategory category:emojis) - adapter.addAdapter(new SingleCategoryAdapter(category)); + if (!forReaction){ + List recentEmoji=new ArrayList<>(lp.recentCustomEmoji); + if(!recentEmoji.isEmpty()) + adapter.addAdapter(new SingleCategoryAdapter(recentEmojiCategory=new EmojiCategory(activity.getString(R.string.mo_emoji_recent), recentEmoji))); + for(EmojiCategory category : emojis) + adapter.addAdapter(new SingleCategoryAdapter(category)); + } list.setAdapter(adapter); list.addItemDecoration(new RecyclerView.ItemDecoration(){ @Override @@ -229,6 +230,17 @@ public void onEmojiUpdated(EmojiUpdatedEvent ev){ } } + public void customToggleKeyboardPopup(){ + if (adapter.getAdapterCount() == 0){ + List recentEmoji=new ArrayList<>(lp.recentCustomEmoji); + if(!recentEmoji.isEmpty()) + adapter.addAdapter(new SingleCategoryAdapter(recentEmojiCategory=new EmojiCategory(activity.getString(R.string.mo_emoji_recent), recentEmoji))); + for(EmojiCategory category : emojis) + adapter.addAdapter(new SingleCategoryAdapter(category)); + } + super.toggleKeyboardPopup(null); + } + private class SingleCategoryAdapter extends UsableRecyclerView.Adapter implements ImageLoaderRecyclerAdapter, Filterable{ private EmojiCategory category; diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java index 3eece84482..8838fd4a81 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java @@ -265,7 +265,7 @@ private void addEmojiReaction(String emoji, Emoji info) { public void onBackspace() {} private void onReactClick(View v){ - emojiKeyboard.toggleKeyboardPopup(null); + emojiKeyboard.customToggleKeyboardPopup(); v.setSelected(emojiKeyboard.isVisible()); space.setVisibility(emojiKeyboard.isVisible() ? View.VISIBLE : View.GONE); DisplayMetrics displayMetrics = new DisplayMetrics();