From d74f1a386ce345edac4110d8e6dddd5d406665aa Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Tue, 19 Apr 2022 12:21:39 -0300 Subject: [PATCH] Set story text placeholder alpha to 60 percent. --- .../securesms/stories/StoryTextPostView.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/stories/StoryTextPostView.kt b/app/src/main/java/org/thoughtcrime/securesms/stories/StoryTextPostView.kt index 890f8b6c8..ee156ae8b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/stories/StoryTextPostView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/stories/StoryTextPostView.kt @@ -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)