Merge pull request #795 from benalbrecht/nocount

Don't show letter count when SMS mode is disabled
This commit is contained in:
Moxie Marlinspike 2014-02-27 14:12:27 -08:00
commit d795aa30b3

View File

@ -166,6 +166,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
private boolean isEncryptedConversation;
private boolean isAuthenticatedConversation;
private boolean isMmsEnabled = true;
private boolean isCharactersLeftViewEnabled;
private CharacterCalculator characterCalculator = new CharacterCalculator();
private DynamicTheme dynamicTheme = new DynamicTheme();
@ -205,6 +206,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
initializeEnabledCheck();
initializeMmsEnabledCheck();
initializeIme();
initializeCharactersLeftViewEnabledCheck();
calculateCharactersRemaining();
MessageNotifier.setVisibleThread(threadId);
@ -635,6 +637,11 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
sendButton.setEnabled(enabled);
}
private void initializeCharactersLeftViewEnabledCheck() {
isCharactersLeftViewEnabled = !(isPushGroupConversation() ||
(TextSecurePreferences.isPushRegistered(this) && !TextSecurePreferences.isSmsFallbackEnabled(this)));
}
private void initializeDraftFromDatabase() {
new AsyncTask<Void, Void, List<Draft>>() {
@Override
@ -947,7 +954,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
private void calculateCharactersRemaining() {
int charactersSpent = composeText.getText().toString().length();
CharacterCalculator.CharacterState characterState = characterCalculator.calculateCharacters(charactersSpent);
if (characterState.charactersRemaining <= 15 && charactersLeft.getVisibility() != View.VISIBLE) {
if (characterState.charactersRemaining <= 15 && charactersLeft.getVisibility() != View.VISIBLE && isCharactersLeftViewEnabled) {
charactersLeft.setVisibility(View.VISIBLE);
} else if (characterState.charactersRemaining > 15 && charactersLeft.getVisibility() != View.GONE) {
charactersLeft.setVisibility(View.GONE);