append author and day for multi select copy value

This commit is contained in:
kosyak 2023-09-15 17:56:07 +02:00
parent e3ce350077
commit 13c22ad5db
2 changed files with 13 additions and 1 deletions

View file

@ -33,6 +33,7 @@ import android.provider.MediaStore;
import android.text.Editable; import android.text.Editable;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Log; import android.util.Log;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.ContextMenu; import android.view.ContextMenu;
@ -594,7 +595,6 @@ public class ConversationFragment extends XmppFragment
@Override @Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) { public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
Collections.sort(selectedMessages, (o1, o2) -> Long.compare(o1.getTimeSent(), o2.getMergedTimeSent())); Collections.sort(selectedMessages, (o1, o2) -> Long.compare(o1.getTimeSent(), o2.getMergedTimeSent()));
if (item.getItemId() == R.id.copy_message) { if (item.getItemId() == R.id.copy_message) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -611,6 +611,11 @@ public class ConversationFragment extends XmppFragment
if (!encrypted if (!encrypted
&& !unInitiatedButKnownSize && !unInitiatedButKnownSize
&& t == null) { && 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()); sb.append(m.getBodyForDisplaying());
if (i < selectedMessages.size() - 1) { if (i < selectedMessages.size() - 1) {

View file

@ -33,6 +33,7 @@ import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.format.DateUtils;
import android.widget.Toast; import android.widget.Toast;
import java.io.File; import java.io.File;
@ -126,6 +127,12 @@ public class ShareUtil {
sb.append("\n\n"); 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()) { if (m.isGeoUri()) {
sb.append(m.getBody()); sb.append(m.getBody());
} else if (!m.isFileOrImage()) { } else if (!m.isFileOrImage()) {