From 5e72c109252bc9228950f28df973824d98ba5a7b Mon Sep 17 00:00:00 2001 From: Riko Sakurauchi Date: Thu, 20 Jun 2019 21:38:20 +0800 Subject: [PATCH] improve prpr --- .../src/main/java/org/telegram/ui/ChatActivity.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 7cb6befc7..a45809cd0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -13119,7 +13119,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not showDialog(builder.create()); break; } case 27: { - SendMessagesHelper.getInstance(currentAccount).sendMessage("/prpr", dialog_id, selectedObject, null, false, null, null, null); + TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(selectedObject.messageOwner.from_id); + if (user.username != null) { + SendMessagesHelper.getInstance(currentAccount).sendMessage("/prpr@" + user.username, dialog_id, selectedObject, null, false, + null, null, null); + } else { + SpannableString spannableString = new SpannableString("/prpr@" + user.first_name); + spannableString.setSpan(new URLSpanUserMention(Integer.toString(user.id), 1), 6, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + CharSequence[] cs = new CharSequence[]{spannableString}; + ArrayList entities = DataQuery.getInstance(currentAccount).getEntities(cs); + SendMessagesHelper.getInstance(currentAccount).sendMessage(spannableString.toString(), dialog_id, selectedObject, null, false, + entities, null, null); + } break; } case 94: { ArrayList messages = new ArrayList<>();