From bfb82bb10c3e6893097c6f4b978a6a44ab091b20 Mon Sep 17 00:00:00 2001 From: Levi Bard Date: Thu, 23 Aug 2018 20:50:50 +0200 Subject: [PATCH] Separate saved draft visibility from default reply visibility: #772 (#787) --- .../com/keylesspalace/tusky/ComposeActivity.java | 16 ++++++++++++++++ .../keylesspalace/tusky/SavedTootActivity.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 51653724..0755a2b1 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.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_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 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); } diff --git a/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java b/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java index a59908e2..b67418e6 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java @@ -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); }