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

Is it feasible, to use TextView in AXEmojiRecyclerAdapter, if we only intent to support Google emoji in Android only? #39

Open
yccheok opened this issue Jan 31, 2023 · 0 comments

Comments

@yccheok
Copy link

yccheok commented Jan 31, 2023

Thank you for providing such useful framework.

Currently, our requirements are

  • Providing an emoji picker
  • Support Google emoji only
  • Will only run in Android

I notice by using AXEmojiView-GoogleProvider, it can full-fill our requirement. However, the project itself come with >3000 PNG files, with total size >15MB.

We only plan to use TextView and EditText for rendering.

We prefer not to use a predefined PNG image files in our case. Not only it consumes more space, it will also outdated, if Google ever change their emoji look n feel, in future Android release.

I was wondering, is it feasible for us, to use TextView in AXEmojiRecyclerAdapter?

For instance, changing the code from

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
    FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
    AXEmojiImageView emojiView = new AXEmojiImageView(viewGroup.getContext());
    int cw = Utils.getColumnWidth(viewGroup.getContext());
    frameLayout.setLayoutParams(new FrameLayout.LayoutParams(cw, cw));
    frameLayout.addView(emojiView);

    int dp6 = Utils.dpToPx(viewGroup.getContext(), 6);
    emojiView.setPadding(dp6, dp6, dp6, dp6);

    return new ViewHolder(frameLayout);
}

@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
    FrameLayout frameLayout = (FrameLayout) viewHolder.itemView;
    final AXEmojiImageView emojiView = (AXEmojiImageView) frameLayout.getChildAt(0);

    Emoji emoji = emojis.get(i);
    emojiView.setEmoji(variantEmoji.getVariant(emoji));
    //ImageLoadingTask currentTask = new ImageLoadingTask(emojiView);
    //currentTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, emoji, null, null);
    emojiView.setOnEmojiActions(events, false);

}

to

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
    FrameLayout frameLayout = new FrameLayout(viewGroup.getContext());
    AXEmojiImageView emojiView = new AXEmojiImageView(viewGroup.getContext());
    int cw = Utils.getColumnWidth(viewGroup.getContext());
    frameLayout.setLayoutParams(new FrameLayout.LayoutParams(cw, cw));
    //frameLayout.addView(emojiView);

    TextView textView = new TextView(viewGroup.getContext());
    textView.setTextColor(Color.BLACK);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24);
    frameLayout.addView(textView);

    int dp6 = Utils.dpToPx(viewGroup.getContext(), 6);
    emojiView.setPadding(dp6, dp6, dp6, dp6);

    return new ViewHolder(frameLayout);
}

@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
    FrameLayout frameLayout = (FrameLayout) viewHolder.itemView;
    final TextView emojiView = (TextView) frameLayout.getChildAt(0);

    Emoji emoji = emojis.get(i);
    emojiView.setText(variantEmoji.getVariant(emoji).getUnicode());

    //ImageLoadingTask currentTask = new ImageLoadingTask(emojiView);
    //currentTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, emoji, null, null);
    //emojiView.setOnEmojiActions(events, false);

}

(I know the code is not yet handle hasVariants. But, this is the basic idea)

I was wondering, is it feasible, to use TextView in AXEmojiRecyclerAdapter, if we only intent to support Google emoji in Android only? It seems possible from initial testing. But, I may be missing out something.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant