/** * Updates the character limit display, coloring the text RED when the limit is reached or * exceeded. */ private void updateCharacterLimit() { String subjectText = mCallSubjectView.getText().toString(); final int length; // If a message encoding is specified, use that to count bytes in the message. if (mMessageEncoding != null) { length = subjectText.getBytes(mMessageEncoding).length; } else { // No message encoding specified, so just count characters entered. length = subjectText.length(); } mCharacterLimitView.setText( getString(R.string.call_subject_limit, length, mLimit)); if (length >= mLimit) { mCharacterLimitView.setTextColor(getResources().getColor( R.color.call_subject_limit_exceeded)); } else { mCharacterLimitView.setTextColor(getResources().getColor( R.color.dialtacts_secondary_text_color)); } }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAnimationDuration = getResources().getInteger(R.integer.call_subject_animation_duration); mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mPhotoSize = getResources().getDimensionPixelSize( R.dimen.call_subject_dialog_contact_photo_size); readArguments();