Wear CWF Add ShowDate preferences to CWF for AAPS v2 compatibility

This commit is contained in:
Philoul 2023-10-17 22:30:25 +02:00
parent cddeef84ba
commit 822a32f529
4 changed files with 19 additions and 9 deletions

View file

@ -170,7 +170,8 @@ enum class CwfMetadataKey(val key: String, @StringRes val label: Int, val isPref
CWF_PREF_WATCH_SHOW_AGO("key_show_ago", R.string.pref_show_ago, true),
CWF_PREF_WATCH_SHOW_BG("key_show_bg", R.string.pref_show_bg, true),
CWF_PREF_WATCH_SHOW_LOOP_STATUS("key_show_loop_status", R.string.pref_show_loop_status, true),
CWF_PREF_WATCH_SHOW_WEEK_NUMBER("key_show_week_number", R.string.pref_show_week_number, true);
CWF_PREF_WATCH_SHOW_WEEK_NUMBER("key_show_week_number", R.string.pref_show_week_number, true),
CWF_PREF_WATCH_SHOW_DATE("key_show_date", R.string.pref_show_date, true);
companion object {

View file

@ -66,6 +66,7 @@
<string name="pref_show_direction_arrow">Show Direction Arrow</string>
<string name="pref_show_ago">Show Ago</string>
<string name="pref_show_week_number">Show Week number</string>
<string name="pref_show_date">Show Date</string>
<string name="default_custom_watchface_comment">Default watchface, you can click on EXPORT WATCHFACE button to generate a template</string>
<string name="wear_default_watchface">Default Watchface</string>
<string name="cwf_comment_background">Background image</string>

View file

@ -106,15 +106,15 @@ class CustomWatchface : BaseWatchFace() {
override fun setColorDark() {
setWatchfaceStyle()
if ((ViewMap.SGV.dynData?.stepFontColor ?: 0) == 0)
if ((ViewMap.SGV.dynData?.stepFontColor ?: 0) <= 0)
binding.sgv.setTextColor(bgColor)
if ((ViewMap.DIRECTION.dynData?.stepColor ?: 0) == 0)
if ((ViewMap.DIRECTION.dynData?.stepColor ?: 0) <= 0)
binding.direction2.colorFilter = changeDrawableColor(bgColor)
if (ageLevel != 1 && (ViewMap.TIMESTAMP.dynData?.stepFontColor ?: 0) == 0)
if (ageLevel != 1 && (ViewMap.TIMESTAMP.dynData?.stepFontColor ?: 0) <= 0)
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_TimestampOld))
if (status.batteryLevel != 1 && (ViewMap.UPLOADER_BATTERY.dynData?.stepFontColor ?: 0) == 0)
if (status.batteryLevel != 1 && (ViewMap.UPLOADER_BATTERY.dynData?.stepFontColor ?: 0) <= 0)
binding.uploaderBattery.setTextColor(lowBatColor)
if ((ViewMap.LOOP.dynData?.stepDraw ?: 0) == 0) // Apply automatic background image only if no dynData or no step images
if ((ViewMap.LOOP.dynData?.stepDraw ?: 0) <= 0) // Apply automatic background image only if no dynData or no step images
when (loopLevel) {
-1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25)
@ -393,10 +393,10 @@ class CustomWatchface : BaseWatchFace() {
MINUTE(ViewKeys.MINUTE.key, R.id.minute),
SECOND(ViewKeys.SECOND.key, R.id.second, R.string.key_show_seconds),
TIMEPERIOD(ViewKeys.TIMEPERIOD.key, R.id.timePeriod),
DAY_NAME(ViewKeys.DAY_NAME.key, R.id.day_name),
DAY(ViewKeys.DAY.key, R.id.day),
DAY_NAME(ViewKeys.DAY_NAME.key, R.id.day_name, R.string.key_show_date),
DAY(ViewKeys.DAY.key, R.id.day, R.string.key_show_date),
WEEKNUMBER(ViewKeys.WEEKNUMBER.key, R.id.week_number, R.string.key_show_week_number),
MONTH(ViewKeys.MONTH.key, R.id.month),
MONTH(ViewKeys.MONTH.key, R.id.month, R.string.key_show_date),
LOOP(ViewKeys.LOOP.key, R.id.loop, R.string.key_show_external_status),
DIRECTION(ViewKeys.DIRECTION.key, R.id.direction2, R.string.key_show_direction),
TIMESTAMP(ViewKeys.TIMESTAMP.key, R.id.timestamp, R.string.key_show_ago),
@ -673,6 +673,7 @@ class CustomWatchface : BaseWatchFace() {
SHOW_BGI(CwfMetadataKey.CWF_PREF_WATCH_SHOW_BGI.key, R.string.key_show_bgi, true),
SHOW_LOOP_STATUS(CwfMetadataKey.CWF_PREF_WATCH_SHOW_LOOP_STATUS.key, R.string.key_show_external_status, true),
SHOW_WEEK_NUMBER(CwfMetadataKey.CWF_PREF_WATCH_SHOW_WEEK_NUMBER.key, R.string.key_show_week_number, true),
SHOW_DATE(CwfMetadataKey.CWF_PREF_WATCH_SHOW_DATE.key, R.string.key_show_date, true),
PREF_UNITS(JsonKeyValues.PREF_UNITS.key, R.string.key_units_mgdl, true),
PREF_DARK(JsonKeyValues.PREF_DARK.key, R.string.key_dark, true),
PREF_MATCH_DIVIDER(JsonKeyValues.PREF_MATCH_DIVIDER.key, R.string.key_match_divider, true);

View file

@ -31,6 +31,13 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/key_show_date"
android:title="@string/pref_show_date"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/key_vibrate_hourly"