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.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) {

View file

@ -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()) {