Wear CWF Add Week number field and include it within BaseWatchFace
This commit is contained in:
parent
130391eb99
commit
4ba7ab7e09
|
@ -161,7 +161,8 @@ enum class CwfMetadataKey(val key: String, @StringRes val label: Int, val isPref
|
||||||
CWF_PREF_WATCH_SHOW_DIRECTION("key_show_direction", R.string.pref_show_direction_arrow, true),
|
CWF_PREF_WATCH_SHOW_DIRECTION("key_show_direction", R.string.pref_show_direction_arrow, true),
|
||||||
CWF_PREF_WATCH_SHOW_AGO("key_show_ago", R.string.pref_show_ago, true),
|
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_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_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);
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
@ -196,6 +197,7 @@ enum class ViewKeys(val key: String, @StringRes val comment: Int) {
|
||||||
TIMEPERIOD("timePeriod", R.string.cwf_comment_timePeriod),
|
TIMEPERIOD("timePeriod", R.string.cwf_comment_timePeriod),
|
||||||
DAY_NAME("day_name", R.string.cwf_comment_day_name),
|
DAY_NAME("day_name", R.string.cwf_comment_day_name),
|
||||||
DAY("day", R.string.cwf_comment_day),
|
DAY("day", R.string.cwf_comment_day),
|
||||||
|
WEEKNUMBER("week_number",R.string.cwf_comment_week_number),
|
||||||
MONTH("month", R.string.cwf_comment_month),
|
MONTH("month", R.string.cwf_comment_month),
|
||||||
LOOP("loop", R.string.cwf_comment_loop),
|
LOOP("loop", R.string.cwf_comment_loop),
|
||||||
DIRECTION("direction", R.string.cwf_comment_direction),
|
DIRECTION("direction", R.string.cwf_comment_direction),
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
<string name="pref_show_bgi">Show BGI</string>
|
<string name="pref_show_bgi">Show BGI</string>
|
||||||
<string name="pref_show_direction_arrow">Show Direction Arrow</string>
|
<string name="pref_show_direction_arrow">Show Direction Arrow</string>
|
||||||
<string name="pref_show_ago">Show Ago</string>
|
<string name="pref_show_ago">Show Ago</string>
|
||||||
|
<string name="pref_show_week_number">Show Week number</string>
|
||||||
<string name="default_custom_watchface_comment">Default watchface, you can click on EXPORT WATCHFACE button to generate a template</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="wear_default_watchface">Default Watchface</string>
|
||||||
<string name="cwf_comment_background">Background image</string>
|
<string name="cwf_comment_background">Background image</string>
|
||||||
|
@ -88,12 +89,13 @@
|
||||||
<string name="cwf_comment_timePeriod">AM or PM</string>
|
<string name="cwf_comment_timePeriod">AM or PM</string>
|
||||||
<string name="cwf_comment_day_name">Name of day of the week</string>
|
<string name="cwf_comment_day_name">Name of day of the week</string>
|
||||||
<string name="cwf_comment_day">Day (DD)</string>
|
<string name="cwf_comment_day">Day (DD)</string>
|
||||||
|
<string name="cwf_comment_week_number">Week number (ww)</string>
|
||||||
<string name="cwf_comment_month">Month name (short)</string>
|
<string name="cwf_comment_month">Month name (short)</string>
|
||||||
<string name="cwf_comment_loop">Loop status and ago</string>
|
<string name="cwf_comment_loop">Loop status and ago</string>
|
||||||
<string name="cwf_comment_direction">Direction arrow</string>
|
<string name="cwf_comment_direction">Direction arrow</string>
|
||||||
<string name="cwf_comment_timestamp">Mintutes ago for last received BG</string>
|
<string name="cwf_comment_timestamp">Mintutes ago for last received BG</string>
|
||||||
<string name="cwf_comment_sgv">BG value</string>
|
<string name="cwf_comment_sgv">BG value</string>
|
||||||
<string name="cwf_comment_cover_plate">Cover image in front of text (dials...)</string>
|
<string name="cwf_comment_cover_plate">Cover image in front of text (dials…)</string>
|
||||||
<string name="cwf_comment_hour_hand">Image of hour hand (Analog Watch)</string>
|
<string name="cwf_comment_hour_hand">Image of hour hand (Analog Watch)</string>
|
||||||
<string name="cwf_comment_minute_hand">Image of minute hand (Analog Watch)</string>
|
<string name="cwf_comment_minute_hand">Image of minute hand (Analog Watch)</string>
|
||||||
<string name="cwf_comment_second_hand">Image of second hand (Analog Watch)</string>
|
<string name="cwf_comment_second_hand">Image of second hand (Analog Watch)</string>
|
||||||
|
|
|
@ -438,6 +438,7 @@ class CustomWatchface : BaseWatchFace() {
|
||||||
TIMEPERIOD(ViewKeys.TIMEPERIOD.key, R.id.timePeriod, null, null, null, null, null),
|
TIMEPERIOD(ViewKeys.TIMEPERIOD.key, R.id.timePeriod, null, null, null, null, null),
|
||||||
DAY_NAME(ViewKeys.DAY_NAME.key, R.id.day_name, null, null, null, null, null),
|
DAY_NAME(ViewKeys.DAY_NAME.key, R.id.day_name, null, null, null, null, null),
|
||||||
DAY(ViewKeys.DAY.key, R.id.day, null, null, null, null, null),
|
DAY(ViewKeys.DAY.key, R.id.day, null, null, null, null, null),
|
||||||
|
WEEKNUMBER(ViewKeys.WEEKNUMBER.key, R.id.week_number, R.string.key_show_week_number, null, null, null, null),
|
||||||
MONTH(ViewKeys.MONTH.key, R.id.month, null, null, null, null, null),
|
MONTH(ViewKeys.MONTH.key, R.id.month, null, null, null, null, null),
|
||||||
LOOP(ViewKeys.LOOP.key, R.id.loop, R.string.key_show_external_status, null, null, null, null),
|
LOOP(ViewKeys.LOOP.key, R.id.loop, R.string.key_show_external_status, null, null, null, null),
|
||||||
DIRECTION(ViewKeys.DIRECTION.key, R.id.direction2, R.string.key_show_direction, null, null, null, null),
|
DIRECTION(ViewKeys.DIRECTION.key, R.id.direction2, R.string.key_show_direction, null, null, null, null),
|
||||||
|
@ -595,7 +596,8 @@ private enum class PrefMap(val key: String, @StringRes val prefKey: Int) {
|
||||||
SHOW_AGO(CwfMetadataKey.CWF_PREF_WATCH_SHOW_AGO.key, R.string.key_show_ago),
|
SHOW_AGO(CwfMetadataKey.CWF_PREF_WATCH_SHOW_AGO.key, R.string.key_show_ago),
|
||||||
SHOW_BG(CwfMetadataKey.CWF_PREF_WATCH_SHOW_BG.key, R.string.key_show_bg),
|
SHOW_BG(CwfMetadataKey.CWF_PREF_WATCH_SHOW_BG.key, R.string.key_show_bg),
|
||||||
SHOW_BGI(CwfMetadataKey.CWF_PREF_WATCH_SHOW_BGI.key, R.string.key_show_bgi),
|
SHOW_BGI(CwfMetadataKey.CWF_PREF_WATCH_SHOW_BGI.key, R.string.key_show_bgi),
|
||||||
SHOW_LOOP_STATUS(CwfMetadataKey.CWF_PREF_WATCH_SHOW_LOOP_STATUS.key, R.string.key_show_external_status)
|
SHOW_LOOP_STATUS(CwfMetadataKey.CWF_PREF_WATCH_SHOW_LOOP_STATUS.key, R.string.key_show_external_status),
|
||||||
|
SHOW_WEEK_NUMBER(CwfMetadataKey.CWF_PREF_WATCH_SHOW_WEEK_NUMBER.key, R.string.key_show_week_number)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,11 +113,6 @@ class DigitalStyleWatchface : BaseWatchFace() {
|
||||||
binding.minute.textSize = 26f
|
binding.minute.textSize = 26f
|
||||||
binding.hour.letterSpacing = 0.toFloat()
|
binding.hour.letterSpacing = 0.toFloat()
|
||||||
binding.minute.letterSpacing = 0.toFloat()
|
binding.minute.letterSpacing = 0.toFloat()
|
||||||
|
|
||||||
/* display week number */
|
|
||||||
val mWeekNumber = layoutView?.findViewById<TextView>(R.id.week_number)
|
|
||||||
mWeekNumber?.visibility = sp.getBoolean(R.string.key_show_week_number, false).toVisibility()
|
|
||||||
mWeekNumber?.text = "(" + dateUtil.weekString() + ")"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,6 +378,8 @@ abstract class BaseWatchFace : WatchFace() {
|
||||||
binding.month?.text = dateUtil.monthString(monthFormat).substringBeforeLast(".")
|
binding.month?.text = dateUtil.monthString(monthFormat).substringBeforeLast(".")
|
||||||
binding.timePeriod?.visibility = android.text.format.DateFormat.is24HourFormat(this).not().toVisibility()
|
binding.timePeriod?.visibility = android.text.format.DateFormat.is24HourFormat(this).not().toVisibility()
|
||||||
binding.timePeriod?.text = dateUtil.amPm()
|
binding.timePeriod?.text = dateUtil.amPm()
|
||||||
|
binding.weekNumber?.visibility = sp.getBoolean(R.string.key_show_week_number, false).toVisibility()
|
||||||
|
binding.weekNumber?.text = "(" + dateUtil.weekString() + ")"
|
||||||
if (showSecond)
|
if (showSecond)
|
||||||
setSecond()
|
setSecond()
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ class WatchfaceViewAdapter(
|
||||||
val mainMenuTap = ds?.mainMenuTap ?: sP?.mainMenuTap
|
val mainMenuTap = ds?.mainMenuTap ?: sP?.mainMenuTap
|
||||||
val chartZoomTap = ds?.chartZoomTap ?: sP?.chartZoomTap
|
val chartZoomTap = ds?.chartZoomTap ?: sP?.chartZoomTap
|
||||||
val dateTime = ds?.dateTime ?: a2?.dateTime
|
val dateTime = ds?.dateTime ?: a2?.dateTime
|
||||||
|
val weekNumber = ds?.weekNumber ?: cU?.weekNumber
|
||||||
// val minuteHand = sP?.minuteHand
|
// val minuteHand = sP?.minuteHand
|
||||||
// val secondaryLayout = aL?.secondaryLayout ?: a2?.secondaryLayout ?: aa?.secondaryLayout ?: ds?.secondaryLayout ?: sP?.secondaryLayout
|
// val secondaryLayout = aL?.secondaryLayout ?: a2?.secondaryLayout ?: aa?.secondaryLayout ?: ds?.secondaryLayout ?: sP?.secondaryLayout
|
||||||
// val tertiaryLayout = a2?.tertiaryLayout ?: sP?.tertiaryLayout
|
// val tertiaryLayout = a2?.tertiaryLayout ?: sP?.tertiaryLayout
|
||||||
|
|
|
@ -282,7 +282,7 @@
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
tools:text="day." />
|
tools:text="day" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/day"
|
android:id="@+id/day"
|
||||||
|
@ -296,6 +296,19 @@
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
tools:text="01" />
|
tools:text="01" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/week_number"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_height="0px"
|
||||||
|
android:layout_marginTop="0px"
|
||||||
|
android:layout_marginLeft="0px"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="24px"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="ww" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/month"
|
android:id="@+id/month"
|
||||||
android:layout_width="50px"
|
android:layout_width="50px"
|
||||||
|
|
|
@ -9,6 +9,13 @@
|
||||||
app:wear_iconOff="@drawable/settings_off"
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
app:wear_iconOn="@drawable/settings_on" />
|
app:wear_iconOn="@drawable/settings_on" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="@string/key_show_week_number"
|
||||||
|
android:title="@string/pref_show_weeknumber"
|
||||||
|
app:wear_iconOff="@drawable/settings_off"
|
||||||
|
app:wear_iconOn="@drawable/settings_on" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/key_vibrate_hourly"
|
android:key="@string/key_vibrate_hourly"
|
||||||
|
|
Loading…
Reference in a new issue