Set story text placeholder alpha to 60 percent.

fork-5.53.8
Alex Hart 2022-04-19 12:21:39 -03:00
rodzic b041ed1510
commit d74f1a386c
1 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -10,6 +10,7 @@ import android.widget.ImageView
import androidx.annotation.ColorInt
import androidx.annotation.Px
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.graphics.ColorUtils
import androidx.core.view.doOnNextLayout
import androidx.core.view.isVisible
import org.thoughtcrime.securesms.R
@ -63,8 +64,12 @@ class StoryTextPostView @JvmOverloads constructor(
backgroundView.setImageDrawable(drawable)
}
fun setTextColor(@ColorInt color: Int) {
textView.setTextColor(color)
private fun setTextColor(@ColorInt color: Int, isPlaceholder: Boolean) {
if (isPlaceholder) {
textView.setTextColor(ColorUtils.setAlphaComponent(color, 0x99))
} else {
textView.setTextColor(color)
}
}
fun setText(text: CharSequence, isPlaceholder: Boolean) {
@ -111,7 +116,7 @@ class StoryTextPostView @JvmOverloads constructor(
state.body.isEmpty()
)
setTextColor(state.textForegroundColor)
setTextColor(state.textForegroundColor, state.body.isEmpty())
setTextBackgroundColor(state.textBackgroundColor)
setTextGravity(state.textAlignment)
setTextScale(state.textScale)
@ -134,7 +139,7 @@ class StoryTextPostView @JvmOverloads constructor(
setText(storyTextPost.body, false)
}
setTextColor(storyTextPost.textForegroundColor)
setTextColor(storyTextPost.textForegroundColor, false)
setTextBackgroundColor(storyTextPost.textBackgroundColor)
setTextGravity(TextAlignment.CENTER)