Fix custom emoji size (#407)
Now custom emoji images adapt to the font size.
This commit is contained in:
parent
d9bbb1be71
commit
938229d7d4
1 changed files with 4 additions and 5 deletions
|
@ -524,15 +524,16 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
}
|
||||
|
||||
public void setCallback(Callback callback) {
|
||||
this.callbackWeakReference = new WeakReference<Callback>(callback);
|
||||
this.callbackWeakReference = new WeakReference<>(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize(@NonNull Paint paint, CharSequence text, int start, int end,
|
||||
@Nullable Paint.FontMetricsInt fm) {
|
||||
if (imageDrawable == null) return 0;
|
||||
Rect sizeRect = imageDrawable.getBounds();
|
||||
return sizeRect.right;
|
||||
int textSize = (int) paint.getTextSize();
|
||||
imageDrawable.setBounds(0, 0, textSize, textSize);
|
||||
return textSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -550,8 +551,6 @@ class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
@Override
|
||||
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
|
||||
imageDrawable = new BitmapDrawable(bitmap);
|
||||
imageDrawable.setBounds(0, 0, imageDrawable.getIntrinsicWidth() + 10,
|
||||
imageDrawable.getIntrinsicHeight() + 10);
|
||||
if (callbackWeakReference != null) {
|
||||
Callback cb = callbackWeakReference.get();
|
||||
if (cb != null) cb.onSuccess();
|
||||
|
|
Loading…
Reference in a new issue