diff options
author | Christophe Henry <contact@c-henry.fr> | 2023-04-04 17:02:15 +0200 |
---|---|---|
committer | Christophe Henry <contact@c-henry.fr> | 2023-04-04 17:02:15 +0200 |
commit | 0fcc2e5898040cf5eadf2cad152c850135fe38ab (patch) | |
tree | 1088dd1e712082295b7df245eeb77ec7d86e0e4c | |
parent | a013c160b7b179a75302b67f5af61f5c63987f3a (diff) |
Reinstanciate linebreaks in shared content
-rw-r--r-- | app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java index 257adf8ee..e175a73eb 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java @@ -976,26 +976,36 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder if (description == null && content == null) { return; } - int position = statusList.size() - 1; - statusList.get(position).text = ""; + + StringBuilder contentBuilder = new StringBuilder(); + if (title != null && title.trim().length() > 0) { - statusList.get(position).text += title + " "; + contentBuilder.append(title); } else if (subject != null && subject.trim().length() > 0) { - statusList.get(position).text += subject + " "; + contentBuilder.append(subject); + } + + if(contentBuilder.length() > 0) { + contentBuilder.append("\n\n"); } + if (description != null && description.trim().length() > 0) { if (url != null && !description.contains(url)) { - statusList.get(position).text += url + "\n>"; + contentBuilder.append(url).append("\n\n"); } - statusList.get(position).text += description + "\n\n"; + contentBuilder.append("> ").append(description); } else if (content != null && content.trim().length() > 0) { if (!content.contains(url)) { - statusList.get(position).text += url + "\n>"; + contentBuilder.append(url).append("\n\n"); } - statusList.get(position).text += content + "\n\n"; + contentBuilder.append("> ").append(content); } else { - statusList.get(position).text += url + "\n\n"; + contentBuilder.append(url); } + + int position = statusList.size() - 1; + statusList.get(position).text = contentBuilder.toString(); + if (saveFilePath != null) { Attachment attachment = new Attachment(); attachment.mimeType = "image/*"; |