com.vanniktech.emoji.listeners.OnEmojiClickListener Java Examples

The following examples show how to use com.vanniktech.emoji.listeners.OnEmojiClickListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmojiPagerAdapter.java    From Emoji with Apache License 2.0 5 votes vote down vote up
EmojiPagerAdapter(final OnEmojiClickListener listener,
                  final OnEmojiLongClickListener longListener,
                  final RecentEmoji recentEmoji, final VariantEmoji variantManager) {
  this.listener = listener;
  this.longListener = longListener;
  this.recentEmoji = recentEmoji;
  this.variantManager = variantManager;
  this.recentEmojiGridView = null;
}
 
Example #2
Source File: RecentEmojiGridView.java    From Emoji with Apache License 2.0 5 votes vote down vote up
public RecentEmojiGridView init(@Nullable final OnEmojiClickListener onEmojiClickListener,
    @Nullable final OnEmojiLongClickListener onEmojiLongClickListener,
    @NonNull final RecentEmoji recentEmoji) {
  recentEmojis = recentEmoji;

  final Collection<Emoji> emojis = recentEmojis.getRecentEmojis();
  emojiArrayAdapter = new EmojiArrayAdapter(getContext(), emojis.toArray(new Emoji[0]), null,
          onEmojiClickListener, onEmojiLongClickListener);

  setAdapter(emojiArrayAdapter);

  return this;
}
 
Example #3
Source File: EmojiGridView.java    From Emoji with Apache License 2.0 5 votes vote down vote up
public EmojiGridView init(@Nullable final OnEmojiClickListener onEmojiClickListener,
    @Nullable final OnEmojiLongClickListener onEmojiLongClickListener,
    @NonNull final EmojiCategory category, @NonNull final VariantEmoji variantManager) {
  emojiArrayAdapter = new EmojiArrayAdapter(getContext(), category.getEmojis(), variantManager,
          onEmojiClickListener, onEmojiLongClickListener);

  setAdapter(emojiArrayAdapter);

  return this;
}
 
Example #4
Source File: EmojiArrayAdapter.java    From Emoji with Apache License 2.0 5 votes vote down vote up
EmojiArrayAdapter(@NonNull final Context context, @NonNull final Emoji[] emojis, @Nullable final VariantEmoji variantManager,
                  @Nullable final OnEmojiClickListener listener, @Nullable final OnEmojiLongClickListener longListener) {
  super(context, 0, asListWithoutDuplicates(emojis));

  this.variantManager = variantManager;
  this.listener = listener;
  this.longListener = longListener;
}
 
Example #5
Source File: ProfileEditActivity.java    From FaceT with Mozilla Public License 2.0 5 votes vote down vote up
private void setUpEmojiPopup() {
    emojiPopup = EmojiPopup.Builder.fromRootView(rootView)
            .setOnEmojiBackspaceClickListener(new OnEmojiBackspaceClickListener() {
                @Override public void onEmojiBackspaceClick(final View v) {
                    Log.d(TAG, "Clicked on Backspace");
                }
            })
            .setOnEmojiClickListener(new OnEmojiClickListener() {
                @Override public void onEmojiClick(@NonNull final EmojiImageView imageView, @NonNull final Emoji emoji) {
                    Log.d(TAG, "Clicked on emoji");
                }
            })
            .setOnEmojiPopupShownListener(new OnEmojiPopupShownListener() {
                @Override
                public void onEmojiPopupShown() {
                    emojiButton.setImageResource(R.drawable.ic_keyboard);
                }
            })
            .setOnSoftKeyboardOpenListener(new OnSoftKeyboardOpenListener() {
                @Override
                public void onKeyboardOpen(final int keyBoardHeight) {
                    Log.d(TAG, "Opened soft keyboard");
                }
            })
            .setOnEmojiPopupDismissListener(new OnEmojiPopupDismissListener() {
                @Override
                public void onEmojiPopupDismiss() {
                    emojiPopup.dismiss();
                    emojiButton.setImageResource(R.drawable.emoji_one_category_people);
                }
            })
            .setOnSoftKeyboardCloseListener(new OnSoftKeyboardCloseListener() {
                @Override
                public void onKeyboardClose() {
                    emojiPopup.dismiss();
                    Log.d(TAG, "Closed soft keyboard");
                }
            })
            .build(aboutMeEdittext);
}
 
Example #6
Source File: ProductDetailActivity.java    From FaceT with Mozilla Public License 2.0 5 votes vote down vote up
private void setUpEmojiPopup() {
    emojiPopup = EmojiPopup.Builder.fromRootView(activity_product_detail_layout)
            .setOnEmojiBackspaceClickListener(new OnEmojiBackspaceClickListener() {
                @Override public void onEmojiBackspaceClick(final View v) {
                    Log.d(TAG, "Clicked on Backspace");
                }
            })
            .setOnEmojiClickListener(new OnEmojiClickListener() {
                @Override public void onEmojiClick(@NonNull final EmojiImageView imageView, @NonNull final Emoji emoji) {
                    Log.d(TAG, "Clicked on emoji");
                }
            })
            .setOnEmojiPopupShownListener(new OnEmojiPopupShownListener() {
                @Override
                public void onEmojiPopupShown() {
                    emojiButton.setBackground(ContextCompat.getDrawable(ProductDetailActivity.this, R.drawable.ic_keyboard));
                }
            })
            .setOnSoftKeyboardOpenListener(new OnSoftKeyboardOpenListener() {
                @Override
                public void onKeyboardOpen(final int keyBoardHeight) {
                    Log.d(TAG, "Opened soft keyboard");
                }
            })
            .setOnEmojiPopupDismissListener(new OnEmojiPopupDismissListener() {
                @Override
                public void onEmojiPopupDismiss() {
                    emojiButton.setBackground(ContextCompat.getDrawable(ProductDetailActivity.this, R.drawable.emoji_one_category_people));
                }
            })
            .setOnSoftKeyboardCloseListener(new OnSoftKeyboardCloseListener() {
                @Override
                public void onKeyboardClose() {
                    emojiPopup.dismiss();
                    Log.d(TAG, "Closed soft keyboard");
                }
            })
            .build(commentEmojiconEditText);
}
 
Example #7
Source File: MessageListActivity.java    From chat21-android-sdk with GNU Affero General Public License v3.0 4 votes vote down vote up
private void setUpEmojiPopup() {
        emojiPopup = EmojiPopup.Builder.fromRootView(rootView)
                .setOnEmojiBackspaceClickListener(new OnEmojiBackspaceClickListener() {
                    @Override
                    public void onEmojiBackspaceClick(final View v) {
                        Log.d(TAG, "Clicked on Backspace");
                    }
                })
                .setOnEmojiClickListener(new OnEmojiClickListener() {
                    @Override
                    public void onEmojiClick(@NonNull final EmojiImageView imageView, @NonNull final Emoji emoji) {
                        Log.d(TAG, "Clicked on emoji");
                    }
                })
                .setOnEmojiPopupShownListener(new OnEmojiPopupShownListener() {
                    @Override
                    public void onEmojiPopupShown() {
                        emojiButton.setImageResource(R.drawable.ic_keyboard_24dp);
                    }
                })
                .setOnSoftKeyboardOpenListener(new OnSoftKeyboardOpenListener() {
                    @Override
                    public void onKeyboardOpen(@Px final int keyBoardHeight) {
                        Log.d(TAG, "Opened soft keyboard");
                    }
                })
//                .setOnEmojiPopupDismissListener(new OnEmojiPopupDismissListener() {
//                    @Override
//                    public void onEmojiPopupDismiss() {
//                        emojiButton.setImageResource(R.drawable.emoji_ios_category_people);
//                    }
//                })

                .setOnEmojiPopupDismissListener(new OnEmojiPopupDismissListener() {
                    @Override
                    public void onEmojiPopupDismiss() {
                        emojiButton.setImageResource(R.drawable.emoji_ios_category_people);
                    }
                })
                .setOnSoftKeyboardCloseListener(new OnSoftKeyboardCloseListener() {
                    @Override
                    public void onKeyboardClose() {
                        Log.d(TAG, "Closed soft keyboard");
                    }
                })
                .build(editText);
    }
 
Example #8
Source File: EmojiView.java    From Emoji with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("PMD.CyclomaticComplexity") public EmojiView(final Context context,
    final OnEmojiClickListener onEmojiClickListener,
    final OnEmojiLongClickListener onEmojiLongClickListener, @NonNull final EmojiPopup.Builder builder) {
  super(context);

  View.inflate(context, R.layout.emoji_view, this);

  setOrientation(VERTICAL);
  setBackgroundColor(builder.backgroundColor != 0 ? builder.backgroundColor : Utils.resolveColor(context, R.attr.emojiBackground, R.color.emoji_background));
  themeIconColor = builder.iconColor != 0 ? builder.iconColor : Utils.resolveColor(context, R.attr.emojiIcons, R.color.emoji_icons);

  final TypedValue value = new TypedValue();
  context.getTheme().resolveAttribute(R.attr.colorAccent, value, true);
  themeAccentColor = builder.selectedIconColor != 0 ? builder.selectedIconColor : value.data;

  final ViewPager emojisPager = findViewById(R.id.emojiViewPager);
  final View emojiDivider = findViewById(R.id.emojiViewDivider);
  emojiDivider.setBackgroundColor(builder.dividerColor != 0 ? builder.dividerColor : Utils.resolveColor(context, R.attr.emojiDivider, R.color.emoji_divider));

  if (builder.pageTransformer != null) {
    emojisPager.setPageTransformer(true, builder.pageTransformer);
  }

  final LinearLayout emojisTab = findViewById(R.id.emojiViewTab);
  emojisPager.addOnPageChangeListener(this);

  final EmojiCategory[] categories = EmojiManager.getInstance().getCategories();

  emojiTabs = new ImageButton[categories.length + 2];
  emojiTabs[0] = inflateButton(context, R.drawable.emoji_recent, R.string.emoji_category_recent, emojisTab);
  for (int i = 0; i < categories.length; i++) {
    emojiTabs[i + 1] = inflateButton(context, categories[i].getIcon(), categories[i].getCategoryName(), emojisTab);
  }
  emojiTabs[emojiTabs.length - 1] = inflateButton(context, R.drawable.emoji_backspace, R.string.emoji_backspace, emojisTab);

  handleOnClicks(emojisPager);

  emojiPagerAdapter = new EmojiPagerAdapter(onEmojiClickListener, onEmojiLongClickListener, builder.recentEmoji, builder.variantEmoji);
  emojisPager.setAdapter(emojiPagerAdapter);

  final int startIndex = emojiPagerAdapter.numberOfRecentEmojis() > 0 ? 0 : 1;
  emojisPager.setCurrentItem(startIndex);
  onPageSelected(startIndex);
}
 
Example #9
Source File: EmojiImageView.java    From Emoji with Apache License 2.0 4 votes vote down vote up
void setOnEmojiClickListener(@Nullable final OnEmojiClickListener listener) {
  this.clickListener = listener;
}
 
Example #10
Source File: EmojiVariantPopup.java    From Emoji with Apache License 2.0 4 votes vote down vote up
public EmojiVariantPopup(@NonNull final View rootView, @Nullable final OnEmojiClickListener listener) {
  this.rootView = rootView;
  this.listener = listener;
}
 
Example #11
Source File: EmojiPopup.java    From Emoji with Apache License 2.0 4 votes vote down vote up
@CheckResult public Builder setOnEmojiClickListener(@Nullable final OnEmojiClickListener listener) {
  onEmojiClickListener = listener;
  return this;
}