fix notification message formatting when username is not at the beginning of the message (#2522)
* fix notification message formatting when username is not at the beginning of the message * search for placeholder in format string
This commit is contained in:
parent
ec2eae9e89
commit
8c6ccf4261
1 changed files with 7 additions and 2 deletions
|
@ -531,8 +531,13 @@ public class NotificationsAdapter extends RecyclerView.Adapter {
|
||||||
message.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
message.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
||||||
String wholeMessage = String.format(format, displayName);
|
String wholeMessage = String.format(format, displayName);
|
||||||
final SpannableStringBuilder str = new SpannableStringBuilder(wholeMessage);
|
final SpannableStringBuilder str = new SpannableStringBuilder(wholeMessage);
|
||||||
str.setSpan(new StyleSpan(Typeface.BOLD), 0, displayName.length(),
|
int displayNameIndex = format.indexOf("%s");
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
str.setSpan(
|
||||||
|
new StyleSpan(Typeface.BOLD),
|
||||||
|
displayNameIndex,
|
||||||
|
displayNameIndex + displayName.length(),
|
||||||
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
|
);
|
||||||
CharSequence emojifiedText = CustomEmojiHelper.emojify(
|
CharSequence emojifiedText = CustomEmojiHelper.emojify(
|
||||||
str, notificationViewData.getAccount().getEmojis(), message, statusDisplayOptions.animateEmojis()
|
str, notificationViewData.getAccount().getEmojis(), message, statusDisplayOptions.animateEmojis()
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue