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:
parent
dbb28017e3
commit
8d9a54e8ea
@ -929,7 +929,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() {
|
||||
|
@ -451,6 +451,7 @@
|
||||
android:textSize="?attr/status_text_medium"
|
||||
android:layout_toLeftOf="@+id/composePreviewButton"
|
||||
android:layout_centerVertical="true"
|
||||
android:textStyle="bold"
|
||||
tools:text="500" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
|
@ -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="red">#f00</color>
|
||||
<color name="white">#fff</color>
|
||||
|
Loading…
Reference in New Issue
Block a user