Change characters left color to red when negative (#1952)

* Change characters left color to red when negative

* Use val for the integers, optimize variable assignment

* Added tusky_red color

* remove extra line typo

* make characters left bold

* change red hue

* fix typo
This commit is contained in:
Vignesh Kumar 2020-10-13 22:00:06 +05:30 committed by GitHub
commit 3b67f339b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View file

@ -682,7 +682,15 @@ class ComposeActivity : BaseActivity(),
}
private fun updateVisibleCharactersLeft() {
composeCharactersLeftView.text = String.format(Locale.getDefault(), "%d", maximumTootCharacters - calculateTextLength())
val remainingLength = maximumTootCharacters - calculateTextLength();
composeCharactersLeftView.text = String.format(Locale.getDefault(), "%d", remainingLength)
val textColor = if (remainingLength < 0) {
ContextCompat.getColor(this, R.color.tusky_red)
} else {
ThemeUtils.getColor(this, android.R.attr.textColorTertiary)
}
composeCharactersLeftView.setTextColor(textColor)
}
private fun onContentWarningChanged() {