@Override
  public void setText(@Nullable CharSequence text, BufferType type) {
    if (useSystemEmoji()) {
      super.setText(text, type);
      return;
    }

    source = EmojiProvider.getInstance(getContext()).emojify(text, this);
    setTextEllipsized(source);
  }
 @Override
 public CharSequence filter(
     CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
   char[] v = new char[end - start];
   TextUtils.getChars(source, start, end, v, 0);
   Spannable emojified = EmojiProvider.getInstance(view.getContext()).emojify(new String(v), view);
   if (source instanceof Spanned) {
     TextUtils.copySpansFrom((Spanned) source, start, end, null, emojified, 0);
   }
   view.getViewTreeObserver().addOnGlobalLayoutListener(this);
   if (view.getWidth() == 0 || view.getEllipsize() != TruncateAt.END) {
     return emojified;
   } else {
     return TextUtils.ellipsize(
         emojified,
         view.getPaint(),
         view.getWidth() - view.getPaddingRight() - view.getPaddingLeft(),
         TruncateAt.END);
   }
 }