summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java27
-rw-r--r--src/fdroid/fastlane/metadata/android/en/changelogs/477.txt1
2 files changed, 28 insertions, 0 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 a500e1af6..d3076c01b 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
@@ -1311,6 +1311,8 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
ComposeViewHolder holder = (ComposeViewHolder) viewHolder;
boolean extraFeatures = sharedpreferences.getBoolean(context.getString(R.string.SET_EXTAND_EXTRA_FEATURES) + MainActivity.currentUserID + MainActivity.currentInstance, false);
boolean mathsComposer = sharedpreferences.getBoolean(context.getString(R.string.SET_MATHS_COMPOSER), true);
+ boolean forwardTag = sharedpreferences.getBoolean(context.getString(R.string.SET_FORWARD_TAGS_IN_REPLY), true);
+
if (mathsComposer) {
holder.binding.buttonMathsComposer.setVisibility(View.VISIBLE);
@@ -1596,6 +1598,31 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
statusDraft.setCursorToEnd = false;
holder.binding.content.setSelection(holder.binding.content.getText().length());
}
+ if (forwardTag && position > 0 && statusDraft.text != null && !statusDraft.text.contains("#")) {
+ Status status = statusList.get(position - 1).reblog == null ? statusList.get(position - 1) : statusList.get(position - 1).reblog;
+ if (status.tags != null && status.tags.size() > 0) {
+ statusDraft.text += "\n\n";
+ int lenght = 0;
+ for (Tag tag : status.tags) {
+ statusDraft.text += "#" + tag.name + " ";
+ lenght += ("#" + tag.name + " ").length();
+ }
+ holder.binding.content.setText(statusDraft.text);
+ statusDraft.cursorPosition = statusDraft.text.length() - lenght - 3;
+ statusDraft.setCursorToEnd = false;
+ holder.binding.content.setSelection(statusDraft.text.length() - lenght - 3);
+ }
+ } else if (forwardTag && position > 0 && statusDraft.text != null && statusDraft.text.contains("#")) {
+ Status status = statusList.get(position - 1).reblog == null ? statusList.get(position - 1) : statusList.get(position - 1).reblog;
+ int lenght = 0;
+ for (Tag tag : status.tags) {
+ lenght += ("#" + tag.name + " ").length();
+ }
+ statusDraft.cursorPosition = statusDraft.text.length() - lenght - 3;
+ statusDraft.setCursorToEnd = false;
+ holder.binding.content.setSelection(statusDraft.text.length() - lenght - 3);
+ }
+
if (statusDraft.spoiler_text != null) {
holder.binding.contentSpoiler.setText(statusDraft.spoiler_text);
holder.binding.contentSpoiler.setSelection(holder.binding.contentSpoiler.getText().length());
diff --git a/src/fdroid/fastlane/metadata/android/en/changelogs/477.txt b/src/fdroid/fastlane/metadata/android/en/changelogs/477.txt
index e86d194e4..ee3ae0d22 100644
--- a/src/fdroid/fastlane/metadata/android/en/changelogs/477.txt
+++ b/src/fdroid/fastlane/metadata/android/en/changelogs/477.txt
@@ -11,4 +11,5 @@ Fixed:
- Dynamic color for Android 12+
- Fix a crash when replying
- Fix button size not changed
+- Forward tags in replies
- Some crashes