Skip to content

Most visited

Recently visited

navigation

EmojiTextViewHelper

public final class EmojiTextViewHelper
extends Object

java.lang.Object
   ↳ android.support.text.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

From class java.lang.Object

Public constructors

EmojiTextViewHelper

EmojiTextViewHelper (TextView textView)

Default constructor.

Parameters
textView TextView: TextView instance

Public methods

getFilters

InputFilter[] getFilters (InputFilter[] filters)

Appends EmojiCompat InputFilters to the widget InputFilters. Should be called by setFilters(InputFilter[]) to update the InputFilters. When used on devices running API 18 or below, this method returns filters that is given as a parameter.

Parameters
filters InputFilter: InputFilter array passed to setFilters(InputFilter[])

Returns
InputFilter[] same copy if the array already contains EmojiCompat InputFilter. A new array copy if not.

setAllCaps

void setAllCaps (boolean allCaps)

Call when allCaps is set on TextView. When used on devices running API 18 or below, this method does nothing.

Parameters
allCaps boolean: allCaps parameter passed to setAllCaps(boolean)

updateTransformationMethod

void updateTransformationMethod ()

Updates widget's TransformationMethod so that the transformed text can be processed. Should be called in the widget constructor. When used on devices running API 18 or below, this method does nothing.

See also:

wrapTransformationMethod

TransformationMethod wrapTransformationMethod (TransformationMethod transformationMethod)

Returns transformation method that can update the transformed text to display emojis. When used on devices running API 18 or below, this method returns transformationMethod that is given as a parameter.

Parameters
transformationMethod TransformationMethod: instance to be wrapped

Returns
TransformationMethod

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.