From 103435a0d27e7d494938113546405efe3f51a210 Mon Sep 17 00:00:00 2001 From: Philoul Date: Fri, 13 Oct 2023 22:34:11 +0200 Subject: [PATCH] Wear CWF Fix getColor for images --- .../kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt b/wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt index e27d5923ef..d388e674c4 100644 --- a/wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt +++ b/wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt @@ -514,7 +514,7 @@ class CustomWatchface : BaseWatchFace() { view.text = viewJson.optString(TEXTVALUE.key) (dynData?.getDrawable() ?: textDrawable())?.let { if (viewJson.has(COLOR.key) || (dynData?.stepColor ?: 0) > 0) // Note only works on bitmap (png or jpg) or xml included into res, not for svg files - it.colorFilter = cwf.changeDrawableColor(dynData?.getFontColor() ?: cwf.getColor(viewJson.optString(COLOR.key))) + it.colorFilter = cwf.changeDrawableColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key))) else it.clearColorFilter() view.background = it @@ -530,14 +530,14 @@ class CustomWatchface : BaseWatchFace() { viewJson?.let { viewJson -> drawable?.let { if (viewJson.has(COLOR.key) || (dynData?.stepColor ?: 0) > 0) // Note only works on bitmap (png or jpg) or xml included into res, not for svg files - it.colorFilter = cwf.changeDrawableColor(dynData?.getFontColor() ?: cwf.getColor(viewJson.optString(COLOR.key))) + it.colorFilter = cwf.changeDrawableColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key))) else it.clearColorFilter() view.setImageDrawable(it) } ?: apply { view.setImageDrawable(defaultDrawable?.let { cwf.resources.getDrawable(it) }) if (viewJson.has(COLOR.key) || (dynData?.stepColor ?: 0) > 0) - view.setColorFilter(dynData?.getFontColor() ?: cwf.getColor(viewJson.optString(COLOR.key))) + view.setColorFilter(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key))) else view.clearColorFilter() } @@ -551,7 +551,7 @@ class CustomWatchface : BaseWatchFace() { viewJson?.let { viewJson -> (dynData?.getDrawable() ?: textDrawable())?.let { if (viewJson.has(COLOR.key) || (dynData?.stepColor ?: 0) > 0) // Note only works on bitmap (png or jpg) or xml included into res, not for svg files - it.colorFilter = cwf.changeDrawableColor(dynData?.getFontColor() ?: cwf.getColor(viewJson.optString(COLOR.key))) + it.colorFilter = cwf.changeDrawableColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key))) else it.clearColorFilter() view.background = it