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
parent 8e2e815b84
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() {

View File

@ -327,6 +327,7 @@
android:layout_height="wrap_content"
android:textColor="?android:textColorTertiary"
android:textSize="?attr/status_text_medium"
android:textStyle="bold"
tools:text="500" />
<com.keylesspalace.tusky.components.compose.view.TootButton

View File

@ -6,6 +6,7 @@
<color name="tusky_orange_light">#fab207</color>
<color name="tusky_green">#19a341</color>
<color name="tusky_green_light">#25d069</color>
<color name="tusky_red">#DF1553</color>
<color name="white">#fff</color>
<color name="black">#000</color>