From 2ce45af45c6a82c42cd3a4d2c661485e0f5171ac Mon Sep 17 00:00:00 2001 From: Julian Strecker Date: Wed, 2 Dec 2020 21:57:19 +0100 Subject: [PATCH] Add Option to Have Battery Indicator Numerically --- resources-deu/strings/strings.xml | 1 + resources-dut/strings/strings.xml | 1 + resources-fin/strings/strings.xml | 1 + resources-fre/strings/strings.xml | 1 + resources-hrv/strings/strings.xml | 1 + resources-hun/strings/strings.xml | 1 + resources-ita/strings/strings.xml | 1 + resources-nob/strings/strings.xml | 1 + resources-pol/strings/strings.xml | 1 + resources-por/strings/strings.xml | 1 + resources-rus/strings/strings.xml | 1 + resources-slo/strings/strings.xml | 1 + resources-slv/strings/strings.xml | 1 + resources-spa/strings/strings.xml | 1 + resources-swe/strings/strings.xml | 1 + resources-zhs/strings/strings.xml | 1 + resources-zht/strings/strings.xml | 1 + resources/settings/settings.xml | 3 +++ resources/strings/strings.xml | 1 + source/CrystalView.mc | 6 ++++++ source/Indicators.mc | 5 +++++ 21 files changed, 32 insertions(+) diff --git a/resources-deu/strings/strings.xml b/resources-deu/strings/strings.xml index 4fb0c1fd..8df04fd7 100644 --- a/resources-deu/strings/strings.xml +++ b/resources-deu/strings/strings.xml @@ -63,6 +63,7 @@ Herzfrequenz Herzfrequenz (Live 5s) Batterie + Batterie Numerisch Batterie (Prozente ausgeblendet) Hinweise Kalorien diff --git a/resources-dut/strings/strings.xml b/resources-dut/strings/strings.xml index 7b9f33b6..4df35227 100644 --- a/resources-dut/strings/strings.xml +++ b/resources-dut/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-fin/strings/strings.xml b/resources-fin/strings/strings.xml index 9884f1f7..775699b8 100644 --- a/resources-fin/strings/strings.xml +++ b/resources-fin/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-fre/strings/strings.xml b/resources-fre/strings/strings.xml index 87dab35c..cd8f2199 100644 --- a/resources-fre/strings/strings.xml +++ b/resources-fre/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-hrv/strings/strings.xml b/resources-hrv/strings/strings.xml index bb0c04ae..f3e3e1fb 100644 --- a/resources-hrv/strings/strings.xml +++ b/resources-hrv/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-hun/strings/strings.xml b/resources-hun/strings/strings.xml index a6feb09f..e84be3a7 100644 --- a/resources-hun/strings/strings.xml +++ b/resources-hun/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-ita/strings/strings.xml b/resources-ita/strings/strings.xml index dc60dc43..a12ea453 100644 --- a/resources-ita/strings/strings.xml +++ b/resources-ita/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-nob/strings/strings.xml b/resources-nob/strings/strings.xml index b617a6f6..c7848cb2 100644 --- a/resources-nob/strings/strings.xml +++ b/resources-nob/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-pol/strings/strings.xml b/resources-pol/strings/strings.xml index 047e812b..248e07b6 100644 --- a/resources-pol/strings/strings.xml +++ b/resources-pol/strings/strings.xml @@ -63,6 +63,7 @@ Tętno Tętno (Live 5s) Bateria + Bateria Numeric Bateria (Sama Wartość) Powiadomienia Kalorie diff --git a/resources-por/strings/strings.xml b/resources-por/strings/strings.xml index 09e0106d..f8454c59 100644 --- a/resources-por/strings/strings.xml +++ b/resources-por/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-rus/strings/strings.xml b/resources-rus/strings/strings.xml index cba97aea..ee6eeb63 100644 --- a/resources-rus/strings/strings.xml +++ b/resources-rus/strings/strings.xml @@ -63,6 +63,7 @@ Пульс Пульс (обновлять каждые 5сек) Заряд аккумулятора + Заряд аккумулятора Цифровой дисплей Заряд аккумулятора (скрывать проценты) Уведомления Калории diff --git a/resources-slo/strings/strings.xml b/resources-slo/strings/strings.xml index 5d49cb15..ed60a344 100644 --- a/resources-slo/strings/strings.xml +++ b/resources-slo/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-slv/strings/strings.xml b/resources-slv/strings/strings.xml index 89d606f0..e477a721 100644 --- a/resources-slv/strings/strings.xml +++ b/resources-slv/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-spa/strings/strings.xml b/resources-spa/strings/strings.xml index c64bedc6..6913b2c2 100644 --- a/resources-spa/strings/strings.xml +++ b/resources-spa/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-swe/strings/strings.xml b/resources-swe/strings/strings.xml index a2fa1960..7f61bc53 100644 --- a/resources-swe/strings/strings.xml +++ b/resources-swe/strings/strings.xml @@ -63,6 +63,7 @@ Puls Puls (Live 5s) Batteri + Batteri Numeric Batteri (Dölj procent) Notifieringar Kalorier diff --git a/resources-zhs/strings/strings.xml b/resources-zhs/strings/strings.xml index a2d2ea05..c5db4c69 100644 --- a/resources-zhs/strings/strings.xml +++ b/resources-zhs/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources-zht/strings/strings.xml b/resources-zht/strings/strings.xml index 375c7cda..8872a239 100644 --- a/resources-zht/strings/strings.xml +++ b/resources-zht/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/resources/settings/settings.xml b/resources/settings/settings.xml index 3410e3fd..a9b77c80 100644 --- a/resources/settings/settings.xml +++ b/resources/settings/settings.xml @@ -140,6 +140,7 @@ @Strings.Notifications @Strings.BluetoothOrNotifications @Strings.Battery + @Strings.BatteryNumeric @@ -150,6 +151,7 @@ @Strings.Notifications @Strings.BluetoothOrNotifications @Strings.Battery + @Strings.BatteryNumeric @@ -160,6 +162,7 @@ @Strings.Notifications @Strings.BluetoothOrNotifications @Strings.Battery + @Strings.BatteryNumeric diff --git a/resources/strings/strings.xml b/resources/strings/strings.xml index f9512d17..2bb87d8f 100644 --- a/resources/strings/strings.xml +++ b/resources/strings/strings.xml @@ -63,6 +63,7 @@ Heart Rate Heart Rate (Live 5s) Battery + Battery Numeric Battery (Hide Percentage) Notifications Calories diff --git a/source/CrystalView.mc b/source/CrystalView.mc index 9beeb251..d162ac79 100644 --- a/source/CrystalView.mc +++ b/source/CrystalView.mc @@ -76,6 +76,12 @@ function drawBatteryMeter(dc, x, y, width, height) { height - (2 * lineWidthPlusMargin)); } + +function writeBatteryLevel(dc, x, y, width, height) { + dc.setColor(gThemeColour, Graphics.COLOR_TRANSPARENT); + dc.drawText(x - (width / 2), y - height, gNormalFont, Math.floor(Sys.getSystemStats().battery).format(INTEGER_FORMAT) + "%", Graphics.TEXT_JUSTIFY_LEFT); +} + class CrystalView extends Ui.WatchFace { private var mIsSleeping = false; private var mIsBurnInProtection = false; // Is burn-in protection required and active? diff --git a/source/Indicators.mc b/source/Indicators.mc index 4aaf1762..bd66aff9 100644 --- a/source/Indicators.mc +++ b/source/Indicators.mc @@ -93,6 +93,11 @@ class Indicators extends Ui.Drawable { return; } + if (indicatorType == 5 /* INDICATOR_TYPE_BATTERY_NUMERIC */) { + writeBatteryLevel(dc, x, y, mBatteryWidth, mBatteryWidth / 2); + return; + } + // Show notifications icon if connected and there are notifications, bluetoothicon otherwise. var settings = Sys.getDeviceSettings(); if (indicatorType == 3 /* INDICATOR_TYPE_BLUETOOTH_OR_NOTIFICATIONS */) {