markdown: now markdown mode is restored from drafts

main
Alibek Omarov 5 years ago
parent fd1594f554
commit 8900e45015
  1. 11
      app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
  2. 1
      app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java
  3. 3
      app/src/main/java/com/keylesspalace/tusky/service/SendTootService.kt
  4. 5
      app/src/main/java/com/keylesspalace/tusky/util/SaveTootHelper.java

@ -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)

@ -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);
}

@ -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 {

@ -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

Loading…
Cancel
Save