From 50d386e2713394df77669592edfada00efe9e93f Mon Sep 17 00:00:00 2001 From: ntngrtltr Date: Fri, 7 Apr 2017 20:37:27 +0200 Subject: [PATCH] inherit content warnings in replys --- .../com/keylesspalace/tusky/ComposeActivity.java | 12 ++++++++++++ .../main/java/com/keylesspalace/tusky/SFragment.java | 2 ++ 2 files changed, 14 insertions(+) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 852d4a6fc..202ee91b0 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -369,6 +369,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag String startingVisibility; boolean startingHideText; + String startingContentWarning = null; ArrayList savedMediaQueued = null; if (savedInstanceState != null) { showMarkSensitive = savedInstanceState.getBoolean("showMarkSensitive"); @@ -411,6 +412,13 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag } mentionedUsernames = intent.getStringArrayExtra("mentioned_usernames"); + + if(inReplyToId != null) { + startingHideText = !intent.getStringExtra("content_warning").equals(""); + if(startingHideText){ + startingContentWarning = intent.getStringExtra("content_warning"); + } + } } /* Only after the starting visibility is determined and the send button is initialised can * the status visibility be set. */ @@ -476,6 +484,10 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag }); showContentWarning(startingHideText); + if(startingContentWarning != null){ + contentWarningEditor.setText(startingContentWarning); + } + statusAlreadyInFlight = false; // These can only be added after everything affected by the media queue is initialized. diff --git a/app/src/main/java/com/keylesspalace/tusky/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/SFragment.java index 6feacf8f3..67c78e1a5 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/SFragment.java @@ -66,6 +66,7 @@ public class SFragment extends BaseFragment { String inReplyToId = status.getActionableId(); Status actionableStatus = status.getActionableStatus(); String replyVisibility = actionableStatus.getVisibility().toString().toLowerCase(); + String contentWarning = actionableStatus.spoilerText; Status.Mention[] mentions = actionableStatus.mentions; List mentionedUsernames = new ArrayList<>(); for (Status.Mention mention : mentions) { @@ -76,6 +77,7 @@ public class SFragment extends BaseFragment { Intent intent = new Intent(getContext(), ComposeActivity.class); intent.putExtra("in_reply_to_id", inReplyToId); intent.putExtra("reply_visibility", replyVisibility); + intent.putExtra("content_warning", contentWarning); intent.putExtra("mentioned_usernames", mentionedUsernames.toArray(new String[0])); startActivity(intent); }