@@ -9,6 +9,7 @@ package com.facebook.fresco.vito.tools.liveeditor
99
1010import android.annotation.SuppressLint
1111import android.content.Context
12+ import android.content.res.Configuration
1213import android.graphics.Color
1314import android.graphics.Typeface
1415import android.util.TypedValue
@@ -20,6 +21,7 @@ import android.widget.LinearLayout
2021import android.widget.ScrollView
2122import android.widget.Spinner
2223import android.widget.TextView
24+ import androidx.annotation.ColorInt
2325import com.facebook.drawee.backends.pipeline.info.ImageOrigin
2426import com.facebook.fresco.vito.core.impl.FrescoDrawable2Impl
2527import com.facebook.fresco.vito.core.impl.KFrescoVitoDrawable
@@ -96,6 +98,7 @@ class LiveEditorUiUtils(
9698 text = title
9799 textSize = 18f
98100 setTypeface(typeface, android.graphics.Typeface .BOLD )
101+ setTextColor(dialogTextColor(context))
99102 val titleHorizontalPad = 12 .dpToPx(context)
100103 val titleBottomPad = 6 .dpToPx(context)
101104 setPadding(titleHorizontalPad, 0 , titleHorizontalPad, titleBottomPad)
@@ -118,6 +121,7 @@ class LiveEditorUiUtils(
118121 TextView (context).apply {
119122 @SuppressLint(" SetTextI18n" )
120123 text = " No image options available"
124+ setTextColor(dialogTextColor(context))
121125 }
122126 )
123127 }
@@ -187,6 +191,7 @@ class LiveEditorUiUtils(
187191 text = " $emoji $label ${ImageSourceUiUtil .COPY_GLYPH } "
188192 textSize = 16f
189193 setTypeface(typeface, Typeface .BOLD )
194+ setTextColor(dialogTextColor(context))
190195 val pad = 12 .dpToPx(context)
191196 setPadding(pad, 0 , pad, pad)
192197 setOnClickListener { ImageSourceUiUtil .copyToClipboard(context, " Cache source" , label) }
@@ -212,7 +217,12 @@ class LiveEditorUiUtils(
212217
213218 // Render all info
214219 if (info.isEmpty()) {
215- addView(TextView (context).apply { text = " Source is Empty" })
220+ addView(
221+ TextView (context).apply {
222+ text = " Source is Empty"
223+ setTextColor(dialogTextColor(context))
224+ }
225+ )
216226 }
217227 info.forEach { infoItem ->
218228 val view = ImageSourceUiUtil (context).createImageInfoView(infoItem, this )
@@ -344,6 +354,24 @@ class LiveEditorUiUtils(
344354 }
345355
346356 companion object {
357+ // Debug tool overlay text colors — chosen to contrast the DIALOG_BACKGROUND_* colors in
358+ // LiveEditorOnScreenButtonController. Kept as literals because the live editor renders
359+ // into a raw overlay Context that does not carry a Material/AppCompat theme, so system
360+ // text-color attributes cannot be relied on.
361+ @SuppressLint(" HexColorValueUsage" )
362+ @ColorInt
363+ private const val DIALOG_TEXT_NIGHT = 0xFFF0F2F5 .toInt()
364+ @SuppressLint(" HexColorValueUsage" )
365+ @ColorInt
366+ private const val DIALOG_TEXT_DAY = 0xFF1E1E2E .toInt()
367+
368+ @ColorInt
369+ internal fun dialogTextColor (context : Context ): Int {
370+ val nightMode = context.resources.configuration.uiMode and Configuration .UI_MODE_NIGHT_MASK
371+ return if (nightMode == Configuration .UI_MODE_NIGHT_YES ) DIALOG_TEXT_NIGHT
372+ else DIALOG_TEXT_DAY
373+ }
374+
347375 /* *
348376 * Returns a human-readable label for the image origin string.
349377 *
0 commit comments