Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only construct RecentEmojiManager if one hasn’t already been set #478

Merged
merged 2 commits into from
Oct 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions emoji/src/main/java/com/vanniktech/emoji/EmojiPopup.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,12 @@ public static final class Builder {
@Nullable OnEmojiBackspaceClickListener onEmojiBackspaceClickListener;
@Nullable OnEmojiClickListener onEmojiClickListener;
@Nullable OnEmojiPopupDismissListener onEmojiPopupDismissListener;
@NonNull RecentEmoji recentEmoji;
@Nullable RecentEmoji recentEmoji;
@NonNull VariantEmoji variantEmoji;
int popupWindowHeight;

private Builder(final View rootView) {
this.rootView = checkNotNull(rootView, "The root View can't be null");
this.recentEmoji = new RecentEmojiManager(rootView.getContext());
this.variantEmoji = new VariantEmojiManager(rootView.getContext());
}

Expand Down Expand Up @@ -482,6 +481,10 @@ private Builder(final View rootView) {
EmojiManager.getInstance().verifyInstalled();
checkNotNull(editText, "EditText can't be null");

if (recentEmoji == null) {
recentEmoji = new RecentEmojiManager(rootView.getContext());
}

final EmojiPopup emojiPopup = new EmojiPopup(this, editText);
emojiPopup.onSoftKeyboardCloseListener = onSoftKeyboardCloseListener;
emojiPopup.onEmojiClickListener = onEmojiClickListener;
Expand Down