markdown: now markdown mode is restored from drafts

This commit is contained in:
Alibek Omarov 2019-12-09 02:26:54 +03:00
parent 64b488e825
commit dfee6f1f98
4 changed files with 14 additions and 6 deletions

View File

@ -561,7 +561,8 @@ public final class ComposeActivity
}
if(intent.hasExtra(MARKDOWN_MODE_EXTRA)) {
enableMarkdownMode(intent.getBooleanExtra(MARKDOWN_MODE_EXTRA, false));
// button will be activated later, when we get instance info
markdownMode = intent.getBooleanExtra(MARKDOWN_MODE_EXTRA, false);
}
}
@ -809,7 +810,7 @@ public final class ComposeActivity
private void enableMarkdownMode(boolean enable) {
markdownMode = enable;
TransitionManager.beginDelayedTransition((ViewGroup) markdownButton.getParent());
@ColorInt int color;
@ -865,6 +866,7 @@ public final class ComposeActivity
emojiButton.setClickable(false);
hideMediaToggle.setClickable(false);
scheduleButton.setClickable(false);
markdownButton.setClickable(false);
tootButton.setEnabled(false);
}
@ -874,6 +876,7 @@ public final class ComposeActivity
emojiButton.setClickable(true);
hideMediaToggle.setClickable(true);
scheduleButton.setClickable(true);
markdownButton.setClickable(true);
tootButton.setEnabled(true);
}
@ -1903,7 +1906,8 @@ public final class ComposeActivity
getIntent().getStringExtra(REPLYING_STATUS_CONTENT_EXTRA),
getIntent().getStringExtra(REPLYING_STATUS_AUTHOR_USERNAME_EXTRA),
statusVisibility,
poll);
poll,
markdownMode);
finishWithoutSlideOutAnimation();
}
@ -2040,6 +2044,7 @@ public final class ComposeActivity
if ((isPleroma = instance.isPleroma())) {
// TODO: implement nodeinfo later
enableButton(markdownButton, true, true);
enableMarkdownMode(markdownMode);
// we always can add new poll but only one
if (poll == null)

View File

@ -164,6 +164,7 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd
.replyingStatusContent(item.getInReplyToText())
.visibility(item.getVisibility())
.poll(item.getPoll())
.markdownMode(item.getMarkdownMode())
.build(this);
startActivity(intent);
}

View File

@ -261,7 +261,8 @@ class SendTootService : Service(), Injectable {
toot.replyingStatusContent,
toot.replyingStatusAuthorUsername,
Status.Visibility.byString(toot.visibility),
toot.poll)
toot.poll,
toot.markdownMode)
}
private fun cancelSendingIntent(tootId: Int): PendingIntent {

View File

@ -51,7 +51,8 @@ public final class SaveTootHelper {
@Nullable String replyingStatusContent,
@Nullable String replyingStatusAuthorUsername,
@NonNull Status.Visibility statusVisibility,
@Nullable NewPoll poll) {
@Nullable NewPoll poll,
@Nullable Boolean markdownMode) {
if (TextUtils.isEmpty(content) && mediaUris.isEmpty() && poll == null) {
return false;
@ -89,7 +90,7 @@ public final class SaveTootHelper {
replyingStatusContent,
replyingStatusAuthorUsername,
statusVisibility,
poll);
poll, markdownMode);
new AsyncTask<Void, Void, Void>() {
@Override