Merge branch 'inherit_warnings' of https://github.com/ntngrtltr/Tusky into ntngrtltr-inherit_warnings

This commit is contained in:
Vavassor 2017-04-09 20:24:59 -04:00
commit 2ba35fae35
2 changed files with 14 additions and 0 deletions

View file

@ -369,6 +369,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
String startingVisibility; String startingVisibility;
boolean startingHideText; boolean startingHideText;
String startingContentWarning = null;
ArrayList<SavedQueuedMedia> savedMediaQueued = null; ArrayList<SavedQueuedMedia> savedMediaQueued = null;
if (savedInstanceState != null) { if (savedInstanceState != null) {
showMarkSensitive = savedInstanceState.getBoolean("showMarkSensitive"); showMarkSensitive = savedInstanceState.getBoolean("showMarkSensitive");
@ -411,6 +412,13 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
} }
mentionedUsernames = intent.getStringArrayExtra("mentioned_usernames"); 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 /* Only after the starting visibility is determined and the send button is initialised can
* the status visibility be set. */ * the status visibility be set. */
@ -476,6 +484,10 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
}); });
showContentWarning(startingHideText); showContentWarning(startingHideText);
if(startingContentWarning != null){
contentWarningEditor.setText(startingContentWarning);
}
statusAlreadyInFlight = false; statusAlreadyInFlight = false;
// These can only be added after everything affected by the media queue is initialized. // These can only be added after everything affected by the media queue is initialized.

View file

@ -66,6 +66,7 @@ public class SFragment extends BaseFragment {
String inReplyToId = status.getActionableId(); String inReplyToId = status.getActionableId();
Status actionableStatus = status.getActionableStatus(); Status actionableStatus = status.getActionableStatus();
String replyVisibility = actionableStatus.getVisibility().toString().toLowerCase(); String replyVisibility = actionableStatus.getVisibility().toString().toLowerCase();
String contentWarning = actionableStatus.spoilerText;
Status.Mention[] mentions = actionableStatus.mentions; Status.Mention[] mentions = actionableStatus.mentions;
List<String> mentionedUsernames = new ArrayList<>(); List<String> mentionedUsernames = new ArrayList<>();
for (Status.Mention mention : mentions) { for (Status.Mention mention : mentions) {
@ -76,6 +77,7 @@ public class SFragment extends BaseFragment {
Intent intent = new Intent(getContext(), ComposeActivity.class); Intent intent = new Intent(getContext(), ComposeActivity.class);
intent.putExtra("in_reply_to_id", inReplyToId); intent.putExtra("in_reply_to_id", inReplyToId);
intent.putExtra("reply_visibility", replyVisibility); intent.putExtra("reply_visibility", replyVisibility);
intent.putExtra("content_warning", contentWarning);
intent.putExtra("mentioned_usernames", mentionedUsernames.toArray(new String[0])); intent.putExtra("mentioned_usernames", mentionedUsernames.toArray(new String[0]));
startActivity(intent); startActivity(intent);
} }