diff --git a/number-of-covild-19-vaccinations/number-of-covild-19-vaccinations.js b/number-of-covild-19-vaccinations/number-of-covild-19-vaccinations.js index 8968f33..230900c 100644 --- a/number-of-covild-19-vaccinations/number-of-covild-19-vaccinations.js +++ b/number-of-covild-19-vaccinations/number-of-covild-19-vaccinations.js @@ -3,9 +3,11 @@ // icon-color: red; icon-glyph: syringe; /************** -Version 1.1.1 +Version 1.2.0 Changelog: + v1.2.0 + - Large Widget: write percentage to the bar and show total numbers v1.1.1 - Cache path changed - Allow force Update of the data @@ -29,15 +31,12 @@ Changelog: // How many minutes should the cache be valid let cacheMinutes = 4 * 60 -// Set to true to show total numbers in the large widget -const showTotalInLargeWidget = false - //////////////////////////////////////////////////////////////////////////////// ////////////////////////// Dev Settings //////////////////////// //////////////////////////////////////////////////////////////////////////////// const debug = false -config.widgetFamily = config.widgetFamily || 'medium' +config.widgetFamily = config.widgetFamily || 'large' //////////////////////////////////////////////////////////////////////////////// ////////////////////////// System Settings ///////////////////// @@ -91,7 +90,8 @@ function creatProgress(percentage) { // Background Path context.setFillColor(Color.gray()) const path = new Path() - path.addRect(new Rect(0, 0, width, h)) + const backgroundReact = new Rect(0, 0, width, h) + path.addRect(backgroundReact) context.addPath(path) context.fillPath() @@ -112,6 +112,11 @@ function creatProgress(percentage) { context.addPath(path1) context.fillPath() + context.setTextAlignedCenter() + context.setTextColor(Color.white()) + context.setFont(Font.systemFont(fontSize - 1)) + context.drawTextInRect(`${percentage.toLocaleString(Device.language())}%`, backgroundReact) + return context.getImage() } @@ -266,8 +271,7 @@ if (config.widgetFamily === 'large') { stateText.lineLimit = 1 row.addSpacer() - const totalText = showTotalInLargeWidget ? `${parseInt(value.vaccinated).toLocaleString(Device.language())} / ` : '' - const quoteText = row.addText(`${totalText}${value.quote.toString().replace('.', ',')} %`) + const quoteText = row.addText(`${parseInt(value.vaccinated).toLocaleString(Device.language())}`) quoteText.font = Font.systemFont(fontSize) row.addSpacer(4) @@ -283,8 +287,7 @@ if (config.widgetFamily === 'large') { stateText.font = Font.boldSystemFont(fontSize + 1) row.addSpacer() - const totalText = showTotalInLargeWidget ? `${parseInt(result.vaccinated).toLocaleString(Device.language())} / ` : '' - const quoteText = row.addText(`${totalText}${result.quote.toString().replace('.', ',')} %`) + const quoteText = row.addText(`${parseInt(result.vaccinated).toLocaleString(Device.language())}`) quoteText.font = Font.boldSystemFont(fontSize + 1) row.addSpacer(4) diff --git a/number-of-covild-19-vaccinations/previewDark3.jpeg b/number-of-covild-19-vaccinations/previewDark3.jpeg index 02b03ec..6e1220b 100644 Binary files a/number-of-covild-19-vaccinations/previewDark3.jpeg and b/number-of-covild-19-vaccinations/previewDark3.jpeg differ diff --git a/number-of-covild-19-vaccinations/previewLight3.jpeg b/number-of-covild-19-vaccinations/previewLight3.jpeg index e541eb5..14b82c2 100644 Binary files a/number-of-covild-19-vaccinations/previewLight3.jpeg and b/number-of-covild-19-vaccinations/previewLight3.jpeg differ