Wear CWF Authorize DynColor in ImageView and background image for chart
This commit is contained in:
parent
bf30eb5f08
commit
acfc23ddf8
|
@ -510,15 +510,15 @@ class CustomWatchface : BaseWatchFace() {
|
||||||
customizeViewCommon(view, viewJson)
|
customizeViewCommon(view, viewJson)
|
||||||
view.clearColorFilter()
|
view.clearColorFilter()
|
||||||
drawable?.let {
|
drawable?.let {
|
||||||
if (viewJson.has(COLOR.key)) // 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(cwf.getColor(viewJson.optString(COLOR.key)))
|
it.colorFilter = cwf.changeDrawableColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key)))
|
||||||
else
|
else
|
||||||
it.clearColorFilter()
|
it.clearColorFilter()
|
||||||
view.setImageDrawable(it)
|
view.setImageDrawable(it)
|
||||||
} ?: apply {
|
} ?: apply {
|
||||||
view.setImageDrawable(defaultDrawable?.let { cwf.resources.getDrawable(it) })
|
view.setImageDrawable(defaultDrawable?.let { cwf.resources.getDrawable(it) })
|
||||||
if (viewJson.has(COLOR.key))
|
if (viewJson.has(COLOR.key) || (dynData?.stepColor ?: 0) > 0)
|
||||||
view.setColorFilter(cwf.getColor(viewJson.optString(COLOR.key)))
|
view.setColorFilter(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key)))
|
||||||
else
|
else
|
||||||
view.clearColorFilter()
|
view.clearColorFilter()
|
||||||
}
|
}
|
||||||
|
@ -527,6 +527,7 @@ class CustomWatchface : BaseWatchFace() {
|
||||||
fun customizeGraphView(view: lecho.lib.hellocharts.view.LineChartView, viewJson: JSONObject) {
|
fun customizeGraphView(view: lecho.lib.hellocharts.view.LineChartView, viewJson: JSONObject) {
|
||||||
customizeViewCommon(view, viewJson)
|
customizeViewCommon(view, viewJson)
|
||||||
view.setBackgroundColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key, "#0000000000"),Color.TRANSPARENT))
|
view.setBackgroundColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key, "#0000000000"),Color.TRANSPARENT))
|
||||||
|
view.background = dynData?.getDrawable() ?: textDrawable(viewJson)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue