Fix remaining freetext in v0.1 watchfaces

This commit is contained in:
Philoul 2023-08-12 20:02:13 +02:00
parent 04dd42241a
commit d06a3c3e53
2 changed files with 8 additions and 1 deletions

View file

@ -17,6 +17,7 @@ import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
val CUSTOM_VERSION = "v0.2"
enum class CustomWatchfaceDrawableDataKey(val key: String, @DrawableRes val icon: Int?, val fileName: String) {
UNKNOWN("unknown", null, "Unknown"),
CUSTOM_WATCHFACE("customWatchface", R.drawable.watchface_custom, "CustomWatchface"),

View file

@ -28,6 +28,7 @@ import androidx.viewbinding.ViewBinding
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityCustomBinding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.rx.weardata.CUSTOM_VERSION
import info.nightscout.rx.weardata.CustomWatchfaceData
import info.nightscout.rx.weardata.CustomWatchfaceDrawableDataKey
import info.nightscout.rx.weardata.CustomWatchfaceDrawableDataMap
@ -54,7 +55,6 @@ class CustomWatchface : BaseWatchFace() {
private var lowBatColor = Color.RED
private var bgColor = Color.WHITE
val CUSTOM_VERSION = "v0.2"
@Suppress("DEPRECATION")
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
@ -168,6 +168,7 @@ class CustomWatchface : BaseWatchFace() {
)
if (viewjson.has("fontColor"))
view.setTextColor(getColor(viewjson.getString("fontColor")))
if (viewjson.has("textvalue"))
view.text = viewjson.getString("textvalue")
}
@ -188,6 +189,11 @@ class CustomWatchface : BaseWatchFace() {
view.clearColorFilter()
}
}
} else {
view.visibility = View.GONE
if (view is TextView) {
view.text = ""
}
}
}
}