Fixes a couple cases in the composer where buttons enabled are out of sync with whether a status is already in flight.

This commit is contained in:
Vavassor 2017-04-17 00:18:55 -04:00
parent c343f9b497
commit cc0aaf6162
2 changed files with 8 additions and 3 deletions

View file

@ -348,8 +348,6 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
floatingBtn.setOnClickListener(new View.OnClickListener() { floatingBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
disableButtons();
postProgress.setVisibility(View.VISIBLE); postProgress.setVisibility(View.VISIBLE);
sendStatus(); sendStatus();
} }
@ -637,9 +635,13 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
if (statusHideText) { if (statusHideText) {
spoilerText = contentWarningEditor.getText().toString(); 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; statusAlreadyInFlight = true;
disableButtons();
readyStatus(contentText, statusVisibility, statusMarkSensitive, spoilerText); readyStatus(contentText, statusVisibility, statusMarkSensitive, spoilerText);
} else if (characterCount <= 0) {
textEditor.setError(getString(R.string.error_empty));
} else { } else {
textEditor.setError(getString(R.string.error_compose_character_limit)); textEditor.setError(getString(R.string.error_compose_character_limit));
} }
@ -873,6 +875,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
protected void onCancelled() { protected void onCancelled() {
removeAllMediaFromQueue(); removeAllMediaFromQueue();
statusAlreadyInFlight = false; statusAlreadyInFlight = false;
enableButtons();
super.onCancelled(); super.onCancelled();
} }
}; };
@ -898,6 +901,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFrag
} }
}); });
statusAlreadyInFlight = false; statusAlreadyInFlight = false;
enableButtons();
} }
private void onMediaPick() { private void onMediaPick() {

View file

@ -1,6 +1,7 @@
<resources> <resources>
<string name="error_generic">An error occurred.</string> <string name="error_generic">An error occurred.</string>
<string name="error_empty">This can\'t be empty.</string>
<string name="error_invalid_domain">Invalid domain entered</string> <string name="error_invalid_domain">Invalid domain entered</string>
<string name="error_failed_app_registration">Failed authenticating with that instance.</string> <string name="error_failed_app_registration">Failed authenticating with that instance.</string>
<string name="error_no_web_browser_found">Couldn\'t find a web browser to use.</string> <string name="error_no_web_browser_found">Couldn\'t find a web browser to use.</string>