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

main
Levi Bard 6 years ago committed by Konrad Pozniak
parent c6acee511e
commit 9b9450736f
  1. 16
      app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
  2. 2
      app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java

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

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

Loading…
Cancel
Save