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