Wear CWF remove optional final poitn in short day name or month name (according to library translation)

This commit is contained in:
Philoul 2023-09-13 13:00:28 +02:00
parent 52bf463b6a
commit 752202a280
2 changed files with 4 additions and 4 deletions

View file

@ -164,8 +164,8 @@ class CustomWatchface : BaseWatchFace() {
.takeIf { it.matches(Regex("E{1,4}")) } ?: "E" .takeIf { it.matches(Regex("E{1,4}")) } ?: "E"
monthFormat = json.optString(MONTHFORMAT.key, "MMM") monthFormat = json.optString(MONTHFORMAT.key, "MMM")
.takeIf { it.matches(Regex("M{1,4}")) } ?: "MMM" .takeIf { it.matches(Regex("M{1,4}")) } ?: "MMM"
binding.dayName.text = dateUtil.dayNameString(dayNameFormat) // Update daynName and month according to format on cwf loading binding.dayName.text = dateUtil.dayNameString(dayNameFormat).substringBeforeLast(".") // Update daynName and month according to format on cwf loading
binding.month.text = dateUtil.monthString(monthFormat) binding.month.text = dateUtil.monthString(monthFormat).substringBeforeLast(".")
bgColor = when (singleBg.sgvLevel) { bgColor = when (singleBg.sgvLevel) {
1L -> highColor 1L -> highColor
0L -> midColor 0L -> midColor

View file

@ -373,9 +373,9 @@ abstract class BaseWatchFace : WatchFace() {
binding.hour?.text = dateUtil.hourString() binding.hour?.text = dateUtil.hourString()
binding.minute?.text = dateUtil.minuteString() binding.minute?.text = dateUtil.minuteString()
binding.dateTime?.visibility = sp.getBoolean(R.string.key_show_date, false).toVisibility() binding.dateTime?.visibility = sp.getBoolean(R.string.key_show_date, false).toVisibility()
binding.dayName?.text = dateUtil.dayNameString(dayNameFormat) binding.dayName?.text = dateUtil.dayNameString(dayNameFormat).substringBeforeLast(".")
binding.day?.text = dateUtil.dayString() binding.day?.text = dateUtil.dayString()
binding.month?.text = dateUtil.monthString(monthFormat) 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()
if (showSecond) if (showSecond)