|
|
@ -17,6 +17,8 @@ import org.thoughtcrime.securesms.components.emoji.EmojiEditText;
|
|
|
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|
|
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|
|
|
|
|
|
|
|
|
|
|
public class ComposeText extends EmojiEditText {
|
|
|
|
public class ComposeText extends EmojiEditText {
|
|
|
|
|
|
|
|
private SpannableString hint;
|
|
|
|
|
|
|
|
|
|
|
|
public ComposeText(Context context) {
|
|
|
|
public ComposeText(Context context) {
|
|
|
|
super(context);
|
|
|
|
super(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -31,18 +33,22 @@ public class ComposeText extends EmojiEditText {
|
|
|
|
|
|
|
|
|
|
|
|
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
|
|
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
|
|
super.onLayout(changed, left, top, right, bottom);
|
|
|
|
super.onLayout(changed, left, top, right, bottom);
|
|
|
|
if (!TextUtils.isEmpty(getHint())) {
|
|
|
|
if (!TextUtils.isEmpty(hint)) {
|
|
|
|
setHint(TextUtils.ellipsize(getHint(),
|
|
|
|
setHint(ellipsizeToWidth(hint));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private CharSequence ellipsizeToWidth(CharSequence text) {
|
|
|
|
|
|
|
|
return TextUtils.ellipsize(text,
|
|
|
|
getPaint(),
|
|
|
|
getPaint(),
|
|
|
|
getWidth() - getPaddingLeft() - getPaddingRight(),
|
|
|
|
getWidth() - getPaddingLeft() - getPaddingRight(),
|
|
|
|
TruncateAt.END));
|
|
|
|
TruncateAt.END);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setHint(@NonNull String hint) {
|
|
|
|
public void setHint(@NonNull String hint) {
|
|
|
|
SpannableString span = new SpannableString(hint);
|
|
|
|
this.hint = new SpannableString(hint);
|
|
|
|
span.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
|
|
|
this.hint.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
|
|
|
super.setHint(span);
|
|
|
|
super.setHint(ellipsizeToWidth(this.hint));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void appendInvite(String invite) {
|
|
|
|
public void appendInvite(String invite) {
|
|
|
|