summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas <tom79@noreply.codeberg.org>2023-06-01 14:51:56 +0000
committerThomas <tom79@noreply.codeberg.org>2023-06-01 14:51:56 +0000
commitf6483c0ccbad1f0bd54aa4c42d8a339fe64bf0f3 (patch)
tree6a7f386058c87ffd6cb81c09e7f169107deec558
parent7e86d9377f2eb34fa8d301b34d324d1d719b038c (diff)
parent0fcc2e5898040cf5eadf2cad152c850135fe38ab (diff)
Merge pull request 'Reinstanciate linebreaks in shared content' (#849) from Augier/Fedilab:reinstanciate-linebreaks-in-share into develop
Reviewed-on: https://codeberg.org/tom79/Fedilab/pulls/849
-rw-r--r--app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java28
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 394a353cf..457285b43 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/*";