@@ -0,0 +1,2299 @@
+package com.rainliu.emojipanel.span;%0A%0Aimport android.content.Context;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Paint;%0Aimport android.graphics.drawable.Drawable;%0Aimport android.text.style.DynamicDrawableSpan;%0A%0Aimport java.lang.ref.WeakReference;%0A%0Apublic class EmojiSpan extends DynamicDrawableSpan %7B%0A%0A  private Context mContext;%0A  %0A  private int mIconId;%0A  %0A  private Drawable mDrawable;%0A%0A  private int mSize = 50; // Should not be hard-coded%0A%0A  public EmojiSpan(Context context, int resourceId, int size) %7B%0A    this.mContext = context;%0A    this.mIconId = resourceId;%0A    mSize = size;%0A  %7D%0A%0A  @Override%0A  public Drawable getDrawable() %7B%0A    if (null == this.mDrawable) %7B%0A      this.mDrawable = this.mContext.getResources().getDrawable(this.mIconId);%0A      this.mDrawable.setBounds(0, 0, mSize, mSize);%0A    %7D%0A%0A    return this.mDrawable;%0A  %7D%0A%0A  @Override public int getSize(final Paint paint, final CharSequence text, final int start,%0A                               final int end, final Paint.FontMetricsInt fontMetrics) %7B%0A    if (fontMetrics != null) %7B%0A      final Paint.FontMetrics paintFontMetrics = paint.getFontMetrics();%0A      fontMetrics.top = (int) paintFontMetrics.top;%0A      fontMetrics.bottom = (int) paintFontMetrics.bottom;%0A    %7D%0A%0A    return (int) mSize;%0A  %7D%0A%0A  @Override public void draw(final Canvas canvas, final CharSequence text, final int start,%0A                             final int end, final float x, final int top, final int y,%0A                             final int bottom, final Paint paint) %7B%0A    final Drawable drawable = getDrawable();%0A    final Paint.FontMetrics paintFontMetrics = paint.getFontMetrics();%0A    final float fontHeight = paintFontMetrics.descent - paintFontMetrics.ascent;%0A    final float centerY = y + paintFontMetrics.descent - fontHeight / 2;%0A    final float transitionY = centerY - mSize / 2;%0A%0A    canvas.save();%0A    canvas.translate(x, transitionY);%0A    drawable.draw(canvas);%0A    canvas.restore();%0A  %7D%0A  %0A  private Drawable getCachedDrawable() %7B%0A    WeakReference%3CDrawable%3E wr = mDrawableRef;%0A    Drawable d = null;%0A%0A    if (wr != null)%0A        d = wr.get();%0A%0A    if (d == null) %7B%0A        d = getDrawable();%0A        mDrawableRef = new WeakReference%3CDrawable%3E(d);%0A    %7D%0A%0A    return d;%0A%7D%0A%0A  private WeakReference%3CDrawable%3E mDrawableRef;%0A%7D%0A

Move a copy to emojipicker library where there should be one