Skip to content

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

@yccheok

Description

@yccheok

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions