Separate saved draft visibility from default reply visibility: #772 (#787)

This commit is contained in:
Levi Bard 2018-08-23 20:50:50 +02:00 committed by Konrad Pozniak
parent e89f8cf3ee
commit bfb82bb10c
2 changed files with 17 additions and 1 deletions

View file

@ -159,6 +159,7 @@ public final class ComposeActivity
private static final String SAVED_TOOT_UID_EXTRA = "saved_toot_uid";
private static final String SAVED_TOOT_TEXT_EXTRA = "saved_toot_text";
private static final String SAVED_JSON_URLS_EXTRA = "saved_json_urls";
private static final String SAVED_TOOT_VISIBILITY_EXTRA = "saved_toot_visibility";
private static final String IN_REPLY_TO_ID_EXTRA = "in_reply_to_id";
private static final String REPLY_VISIBILITY_EXTRA = "reply_visibilty";
private static final String CONTENT_WARNING_EXTRA = "content_warning";
@ -426,6 +427,11 @@ public final class ComposeActivity
this.savedTootUid = savedTootUid;
}
int savedTootVisibility = intent.getIntExtra(SAVED_TOOT_VISIBILITY_EXTRA, Status.Visibility.UNKNOWN.getNum());
if (savedTootVisibility != Status.Visibility.UNKNOWN.getNum()) {
startingVisibility = Status.Visibility.byNum(savedTootVisibility);
}
if (intent.hasExtra(REPLYING_STATUS_AUTHOR_USERNAME_EXTRA)) {
replyTextView.setVisibility(View.VISIBLE);
String username = intent.getStringExtra(REPLYING_STATUS_AUTHOR_USERNAME_EXTRA);
@ -1609,6 +1615,8 @@ public final class ComposeActivity
@Nullable
private Status.Visibility replyVisibility;
@Nullable
private Status.Visibility savedVisibility;
@Nullable
private String contentWarning;
@Nullable
private String replyingStatusAuthor;
@ -1630,6 +1638,11 @@ public final class ComposeActivity
return this;
}
public IntentBuilder savedVisibility(Status.Visibility savedVisibility) {
this.savedVisibility = savedVisibility;
return this;
}
public IntentBuilder mentionedUsernames(Collection<String> mentionedUsernames) {
this.mentionedUsernames = mentionedUsernames;
return this;
@ -1682,6 +1695,9 @@ public final class ComposeActivity
if (replyVisibility != null) {
intent.putExtra(REPLY_VISIBILITY_EXTRA, replyVisibility.getNum());
}
if (savedVisibility != null) {
intent.putExtra(SAVED_TOOT_VISIBILITY_EXTRA, savedVisibility.getNum());
}
if (contentWarning != null) {
intent.putExtra(CONTENT_WARNING_EXTRA, contentWarning);
}

View file

@ -166,7 +166,7 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd
.inReplyToId(item.getInReplyToId())
.repyingStatusAuthor(item.getInReplyToUsername())
.replyingStatusContent(item.getInReplyToText())
.replyVisibility(item.getVisibility())
.savedVisibility(item.getVisibility())
.build(this);
startActivity(intent);
}