Wear CWF Manage Background Color fix Background Color for all views including ImageView
This commit is contained in:
parent
0fb1cad8da
commit
c2401d865b
|
@ -512,12 +512,14 @@ class CustomWatchface : BaseWatchFace() {
|
||||||
view.isAllCaps = viewJson.optBoolean(ALLCAPS.key)
|
view.isAllCaps = viewJson.optBoolean(ALLCAPS.key)
|
||||||
if (viewJson.has(TEXTVALUE.key))
|
if (viewJson.has(TEXTVALUE.key))
|
||||||
view.text = viewJson.optString(TEXTVALUE.key)
|
view.text = viewJson.optString(TEXTVALUE.key)
|
||||||
view.setBackgroundColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key, "#0000000000"), Color.TRANSPARENT))
|
(dynData?.getDrawable() ?: textDrawable())?.let {
|
||||||
view.background = (dynData?.getDrawable() ?: textDrawable())?.also {
|
|
||||||
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
|
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?.getFontColor() ?: cwf.getColor(viewJson.optString(COLOR.key)))
|
||||||
else
|
else
|
||||||
it.clearColorFilter()
|
it.clearColorFilter()
|
||||||
|
view.background = it
|
||||||
|
} ?: apply {
|
||||||
|
view.setBackgroundColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key, "#0000000000"), Color.TRANSPARENT))
|
||||||
}
|
}
|
||||||
} ?: apply { view.text = "" }
|
} ?: apply { view.text = "" }
|
||||||
}
|
}
|
||||||
|
@ -539,18 +541,22 @@ class CustomWatchface : BaseWatchFace() {
|
||||||
else
|
else
|
||||||
view.clearColorFilter()
|
view.clearColorFilter()
|
||||||
}
|
}
|
||||||
|
if (view.drawable == null)
|
||||||
|
view.setBackgroundColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key, "#0000000000"), Color.TRANSPARENT))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun customizeGraphView(view: lecho.lib.hellocharts.view.LineChartView) {
|
fun customizeGraphView(view: lecho.lib.hellocharts.view.LineChartView) {
|
||||||
customizeViewCommon(view)
|
customizeViewCommon(view)
|
||||||
viewJson?.let { viewJson ->
|
viewJson?.let { viewJson ->
|
||||||
view.setBackgroundColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key, "#0000000000"), Color.TRANSPARENT))
|
(dynData?.getDrawable() ?: textDrawable())?.let {
|
||||||
view.background = (dynData?.getDrawable() ?: textDrawable())?.also {
|
|
||||||
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
|
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?.getFontColor() ?: cwf.getColor(viewJson.optString(COLOR.key)))
|
||||||
else
|
else
|
||||||
it.clearColorFilter()
|
it.clearColorFilter()
|
||||||
|
view.background = it
|
||||||
|
} ?: apply {
|
||||||
|
view.setBackgroundColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key, "#0000000000"), Color.TRANSPARENT))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue