mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
parent
b0f7df93a4
commit
534ac22fd2
@ -6,6 +6,7 @@ import android.support.v7.widget.AppCompatEditText;
|
|||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextUtils.TruncateAt;
|
||||||
import android.text.style.RelativeSizeSpan;
|
import android.text.style.RelativeSizeSpan;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
@ -24,6 +25,16 @@ public class ComposeText extends EmojiEditText {
|
|||||||
super(context, attrs, defStyleAttr);
|
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) {
|
public void setHint(@NonNull String hint) {
|
||||||
SpannableString span = new SpannableString(hint);
|
SpannableString span = new SpannableString(hint);
|
||||||
span.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
span.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user