From 13c22ad5dbb67257abf2cba622f0f7909d470e89 Mon Sep 17 00:00:00 2001 From: kosyak Date: Fri, 15 Sep 2023 17:56:07 +0200 Subject: [PATCH] append author and day for multi select copy value --- .../eu/siacs/conversations/ui/ConversationFragment.java | 7 ++++++- .../java/eu/siacs/conversations/ui/util/ShareUtil.java | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 4ad98e2b9..9ff365f2c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -33,6 +33,7 @@ import android.provider.MediaStore; import android.text.Editable; import android.text.SpannableStringBuilder; import android.text.TextUtils; +import android.text.format.DateUtils; import android.util.Log; import android.view.ActionMode; import android.view.ContextMenu; @@ -594,7 +595,6 @@ public class ConversationFragment extends XmppFragment @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { Collections.sort(selectedMessages, (o1, o2) -> Long.compare(o1.getTimeSent(), o2.getMergedTimeSent())); - if (item.getItemId() == R.id.copy_message) { StringBuilder sb = new StringBuilder(); @@ -611,6 +611,11 @@ public class ConversationFragment extends XmppFragment if (!encrypted && !unInitiatedButKnownSize && t == null) { + + sb.append(m.getAvatarName()); + sb.append(", "); + sb.append(DateUtils.formatDateTime(activity, m.getTimeSent(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_ABBREV_MONTH)); + sb.append(": "); sb.append(m.getBodyForDisplaying()); if (i < selectedMessages.size() - 1) { diff --git a/src/main/java/eu/siacs/conversations/ui/util/ShareUtil.java b/src/main/java/eu/siacs/conversations/ui/util/ShareUtil.java index 3462ffb92..2548e66c3 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/ShareUtil.java +++ b/src/main/java/eu/siacs/conversations/ui/util/ShareUtil.java @@ -33,6 +33,7 @@ import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.text.SpannableStringBuilder; +import android.text.format.DateUtils; import android.widget.Toast; import java.io.File; @@ -126,6 +127,12 @@ public class ShareUtil { sb.append("\n\n"); } + sb.append(m.getAvatarName()); + sb.append(", "); + sb.append(DateUtils.formatDateTime(activity, m.getTimeSent(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_ABBREV_MONTH)); + sb.append(": "); + sb.append(m.getBodyForDisplaying()); + if (m.isGeoUri()) { sb.append(m.getBody()); } else if (!m.isFileOrImage()) {