|
|
|
@ -6,6 +6,7 @@ import android.support.v7.widget.AppCompatEditText;
|
|
|
|
|
import android.text.Spannable;
|
|
|
|
|
import android.text.SpannableString;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
import android.text.TextUtils.TruncateAt;
|
|
|
|
|
import android.text.style.RelativeSizeSpan;
|
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
|
|
|
|
@ -24,6 +25,16 @@ public class ComposeText extends EmojiEditText {
|
|
|
|
|
super(context, attrs, defStyleAttr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
|
|
|
super.onLayout(changed, left, top, right, bottom);
|
|
|
|
|
if (!TextUtils.isEmpty(getHint())) {
|
|
|
|
|
setHint(TextUtils.ellipsize(getHint(),
|
|
|
|
|
getPaint(),
|
|
|
|
|
getWidth() - getPaddingLeft() - getPaddingRight(),
|
|
|
|
|
TruncateAt.END));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setHint(@NonNull String hint) {
|
|
|
|
|
SpannableString span = new SpannableString(hint);
|
|
|
|
|
span.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
|
|
|
|