Skip to content

Commit

Permalink
feat: copy username on click or longclick in profile activity
Browse files Browse the repository at this point in the history
Signed-off-by: Next Alone <[email protected]>
  • Loading branch information
NextAlone committed Feb 15, 2024
1 parent a893f50 commit 16b4d33
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions TMessagesProj/src/main/java/org/telegram/ui/ProfileActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4774,18 +4774,18 @@ public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
nameTextView[a].setScrollNonFitText(true);
nameTextView[a].setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
nameTextView[a].setOnLongClickListener(v -> {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
if (i == 0) {
try {
AndroidUtilities.addToClipboard(((SimpleTextView) v).getText());
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
FileLog.e(e);
}
}
});
showDialog(builder.create());
// AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
// builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy)}, (dialogInterface, i) -> {
// if (i == 0) {
try {
AndroidUtilities.addToClipboard(((SimpleTextView) v).getText());
Toast.makeText(getParentActivity(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
FileLog.e(e);
}
// }
// });
// showDialog(builder.create());
return false;
});
}
Expand Down

0 comments on commit 16b4d33

Please sign in to comment.