From 3710e9f91ac3084faa9d94893ac8a8e94bf235c7 Mon Sep 17 00:00:00 2001 From: mueller-ma Date: Thu, 18 Jul 2024 20:20:34 +0200 Subject: [PATCH] Make dynamically created skeleton darker Similar to the statically created skeleton. Signed-off-by: mueller-ma --- .../java/org/openhab/habdroid/ui/widget/WidgetImageView.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mobile/src/main/java/org/openhab/habdroid/ui/widget/WidgetImageView.kt b/mobile/src/main/java/org/openhab/habdroid/ui/widget/WidgetImageView.kt index 68233d79d0..b2eaa2c8d0 100644 --- a/mobile/src/main/java/org/openhab/habdroid/ui/widget/WidgetImageView.kt +++ b/mobile/src/main/java/org/openhab/habdroid/ui/widget/WidgetImageView.kt @@ -23,9 +23,11 @@ import android.util.Base64 import android.util.Log import androidx.appcompat.widget.AppCompatImageView import com.faltenreich.skeletonlayout.Skeleton +import com.faltenreich.skeletonlayout.SkeletonConfig import com.faltenreich.skeletonlayout.SkeletonLayout import com.faltenreich.skeletonlayout.createSkeleton import kotlin.random.Random +import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -42,6 +44,7 @@ import org.openhab.habdroid.util.ImageConversionPolicy import org.openhab.habdroid.util.getIconFallbackColor import org.openhab.habdroid.util.getPrefs import org.openhab.habdroid.util.isDebugModeEnabled +import org.openhab.habdroid.util.resolveThemedColor class WidgetImageView(context: Context, attrs: AttributeSet?) : AppCompatImageView(context, attrs) { private var scope: CoroutineScope? = null @@ -317,7 +320,9 @@ class WidgetImageView(context: Context, attrs: AttributeSet?) : AppCompatImageVi private fun applySkeleton() { if (skeleton == null) { - skeleton = createSkeleton() + val config = SkeletonConfig.default(context) + config.maskColor = context.resolveThemedColor(R.attr.colorOnSurfaceInverse, config.maskColor) + skeleton = createSkeleton(config) } skeleton?.showSkeleton() }