Commit 24b7b728 authored by Grigory Fedorov's avatar Grigory Fedorov

Emojicon size corrected.

parent 967435a8
......@@ -16,8 +16,6 @@
package github.ankushsachdeva.emojicon;
import github.ankushsachdeva.emojicon.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
......@@ -31,7 +29,7 @@ public class EmojiconEditText extends EditText {
public EmojiconEditText(Context context) {
super(context);
mEmojiconSize = (int) getTextSize();
mEmojiconSize = getLineHeight();
}
......@@ -47,7 +45,7 @@ public class EmojiconEditText extends EditText {
private void init(AttributeSet attrs) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getLineHeight());
a.recycle();
setText(getText());
}
......
......@@ -15,10 +15,11 @@
*/
package github.ankushsachdeva.emojicon;
import github.ankushsachdeva.emojicon.R;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.style.DynamicDrawableSpan;
import android.text.style.ImageSpan;
import android.util.SparseIntArray;
/**
......@@ -1508,7 +1509,10 @@ public final class EmojiconHandler {
}
if (icon > 0) {
text.setSpan(new EmojiconSpan(context, icon, emojiSize), i, i + skip, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Drawable myIcon = context.getResources().getDrawable(icon);
myIcon.setBounds(0, 0, emojiSize, emojiSize);
text.setSpan(new ImageSpan(myIcon, DynamicDrawableSpan.ALIGN_BOTTOM),
i, i + skip, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
......
......@@ -16,8 +16,6 @@
package github.ankushsachdeva.emojicon;
import github.ankushsachdeva.emojicon.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.SpannableStringBuilder;
......@@ -49,10 +47,10 @@ public class EmojiconTextView extends TextView {
private void init(AttributeSet attrs) {
if (attrs == null) {
mEmojiconSize = (int) getTextSize();
mEmojiconSize = getLineHeight();
} else {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Emojicon);
mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getTextSize());
mEmojiconSize = (int) a.getDimension(R.styleable.Emojicon_emojiconSize, getLineHeight());
mTextStart = a.getInteger(R.styleable.Emojicon_emojiconTextStart, 0);
mTextLength = a.getInteger(R.styleable.Emojicon_emojiconTextLength, -1);
a.recycle();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment