EmojiTextViewHelper

public final class EmojiTextViewHelper
extends Object

java.lang.Object
   ↳ androidx.emoji.widget.EmojiTextViewHelper


Utility class to enhance custom TextView widgets with EmojiCompat.

 public class MyEmojiTextView extends TextView {
     public MyEmojiTextView(Context context) {
         super(context);
         init();
     }
     // ..
     private void init() {
         getEmojiTextViewHelper().updateTransformationMethod();
     }

     @Override
     public void setFilters(InputFilter[] filters) {
         super.setFilters(getEmojiTextViewHelper().getFilters(filters));
     }

     @Override
     public void setAllCaps(boolean allCaps) {
         super.setAllCaps(allCaps);
         getEmojiTextViewHelper().setAllCaps(allCaps);
     }

     private EmojiTextViewHelper getEmojiTextViewHelper() {
         if (mEmojiTextViewHelper == null) {
             mEmojiTextViewHelper = new EmojiTextViewHelper(this);
         }
         return mEmojiTextViewHelper;
     }
 }
 

Summary

Public constructors

EmojiTextViewHelper(TextView textView)

Default constructor.

Public methods

InputFilter[] getFilters(InputFilter[] filters)

Appends EmojiCompat InputFilters to the widget InputFilters.

void setAllCaps(boolean allCaps)

Call when allCaps is set on TextView.

void updateTransformationMethod()

Updates widget's TransformationMethod so that the transformed text can be processed.

TransformationMethod wrapTransformationMethod(TransformationMethod transformationMethod)

Returns transformation method that can update the transformed text to display emojis.

Inherited methods

Public constructors

EmojiTextViewHelper

public EmojiTextViewHelper (