Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

EmojiTextViewHelper

class EmojiTextViewHelper
kotlin.Any
   ↳ 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
<init>(@NonNull textView: TextView)

Default constructor.

Public methods
Array<InputFilter!>
getFilters(@NonNull filters: Array<InputFilter!>)

Appends EmojiCompat InputFilters to the widget InputFilters.

Unit
setAllCaps(allCaps: Boolean)

Call when allCaps is set on TextView.

Unit

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

TransformationMethod?
wrapTransformationMethod(@Nullable transformationMethod: TransformationMethod?)

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

Public constructors

<init>

EmojiTextViewHelper(@NonNull textView: TextView)

Default constructor.

Parameters
textView TextView: TextView instance

Public methods

getFilters

@NonNull fun getFilters(@NonNull filters: Array<InputFilter!>): Array<InputFilter!>

Appends EmojiCompat InputFilters to the widget InputFilters. Should be called by 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 Array<InputFilter!>: InputFilter array passed to TextView#setFilters(InputFilter[])
Return
Array<InputFilter!> same copy if the array already contains EmojiCompat InputFilter. A new array copy if not.

setAllCaps

fun setAllCaps(allCaps: Boolean): Unit

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 TextView#setAllCaps(boolean)

updateTransformationMethod

fun updateTransformationMethod(): Unit

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.

wrapTransformationMethod

@Nullable fun wrapTransformationMethod(@Nullable transformationMethod: 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