From cc0aaf61628ca439ece0af4ce44553e78bfb8639 Mon Sep 17 00:00:00 2001 From: Vavassor Date: Mon, 17 Apr 2017 00:18:55 -0400 Subject: [PATCH] Fixes a couple cases in the composer where buttons enabled are out of sync with whether a status is already in flight. --- .../java/com/keylesspalace/tusky/ComposeActivity.java | 10 +++++++--- app/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 403b9b0a..36330bcc 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -348,8 +348,6 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag floatingBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - disableButtons(); - postProgress.setVisibility(View.VISIBLE); sendStatus(); } @@ -637,9 +635,13 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag if (statusHideText) { spoilerText = contentWarningEditor.getText().toString(); } - if (contentText.length() + spoilerText.length() <= STATUS_CHARACTER_LIMIT) { + int characterCount = contentText.length() + spoilerText.length(); + if (characterCount > 0 && characterCount <= STATUS_CHARACTER_LIMIT) { statusAlreadyInFlight = true; + disableButtons(); readyStatus(contentText, statusVisibility, statusMarkSensitive, spoilerText); + } else if (characterCount <= 0) { + textEditor.setError(getString(R.string.error_empty)); } else { textEditor.setError(getString(R.string.error_compose_character_limit)); } @@ -873,6 +875,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag protected void onCancelled() { removeAllMediaFromQueue(); statusAlreadyInFlight = false; + enableButtons(); super.onCancelled(); } }; @@ -898,6 +901,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag } }); statusAlreadyInFlight = false; + enableButtons(); } private void onMediaPick() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 42bb3fa7..345d1c01 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ An error occurred. + This can\'t be empty. Invalid domain entered Failed authenticating with that instance. Couldn\'t find a web browser to use.