diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 8fd3258e4..34dea45ba 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -4666,6 +4666,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat mentionListView.setOnItemLongClickListener((view, position) -> { Object object = mentionsAdapter.getItem(position); + int start = mentionsAdapter.getResultStartPosition(); + int len = mentionsAdapter.getResultLength(); if (object instanceof String) { AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); builder.setTitle(LocaleController.getString("NekoX", R.string.NekoX)); @@ -4674,6 +4676,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showAlertDialog(builder); return true; + } else if (object instanceof TLRPC.User) { + TLRPC.User user = (TLRPC.User) object; + String name = UserObject.getFirstName(user); + Spannable spannable = new SpannableString("@" + name + " "); + spannable.setSpan(new URLSpanUserMentionPhotoViewer("" + user.id, true), 0, spannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + captionEditText.replaceWithText(start, len, spannable, false); + return true; } return false; });