Search in sources :

Example 1 with CharacterState

use of org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState in project Signal-Android by WhisperSystems.

the class ConversationActivity method calculateCharactersRemaining.

private void calculateCharactersRemaining() {
    String messageBody = composeText.getText().toString();
    TransportOption transportOption = sendButton.getSelectedTransport();
    CharacterState characterState = transportOption.calculateCharacters(messageBody);
    if (characterState.charactersRemaining <= 15 || characterState.messagesSpent > 1) {
        charactersLeft.setText(characterState.charactersRemaining + "/" + characterState.maxMessageSize + " (" + characterState.messagesSpent + ")");
        charactersLeft.setVisibility(View.VISIBLE);
    } else {
        charactersLeft.setVisibility(View.GONE);
    }
}
Also used : ByteString(com.google.protobuf.ByteString) CharacterState(org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState)

Example 2 with CharacterState

use of org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState in project Signal-Android by WhisperSystems.

the class ConversationParentFragment method calculateCharactersRemaining.

private void calculateCharactersRemaining() {
    String messageBody = composeText.getTextTrimmed().toString();
    TransportOption transportOption = sendButton.getSelectedTransport();
    CharacterState characterState = transportOption.calculateCharacters(messageBody);
    if (characterState.charactersRemaining <= 15 || characterState.messagesSpent > 1) {
        charactersLeft.setText(String.format(Locale.getDefault(), "%d/%d (%d)", characterState.charactersRemaining, characterState.maxTotalMessageSize, characterState.messagesSpent));
        charactersLeft.setVisibility(View.VISIBLE);
    } else {
        charactersLeft.setVisibility(View.GONE);
    }
}
Also used : TransportOption(org.thoughtcrime.securesms.TransportOption) SpannableString(android.text.SpannableString) CharacterState(org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState)

Example 3 with CharacterState

use of org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState in project Signal-Android by signalapp.

the class ConversationActivity method calculateCharactersRemaining.

private void calculateCharactersRemaining() {
    String messageBody = composeText.getTextTrimmed();
    TransportOption transportOption = sendButton.getSelectedTransport();
    CharacterState characterState = transportOption.calculateCharacters(messageBody);
    if (characterState.charactersRemaining <= 15 || characterState.messagesSpent > 1) {
        charactersLeft.setText(String.format(dynamicLanguage.getCurrentLocale(), "%d/%d (%d)", characterState.charactersRemaining, characterState.maxMessageSize, characterState.messagesSpent));
        charactersLeft.setVisibility(View.VISIBLE);
    } else {
        charactersLeft.setVisibility(View.GONE);
    }
}
Also used : ByteString(com.google.protobuf.ByteString) CharacterState(org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState)

Aggregations

CharacterState (org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState)3 ByteString (com.google.protobuf.ByteString)2 SpannableString (android.text.SpannableString)1 TransportOption (org.thoughtcrime.securesms.TransportOption)1