Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Option to Have Battery Indicator Numerically #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources-deu/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Herzfrequenz</string>
<string id="HeartRateLive5s">Herzfrequenz (Live 5s)</string>
<string id="Battery">Batterie</string>
<string id="BatteryNumeric">Batterie Numerisch</string>
<string id="BatteryHidePercentage">Batterie (Prozente ausgeblendet)</string>
<string id="Notifications">Hinweise</string>
<string id="Calories">Kalorien</string>
Expand Down
1 change: 1 addition & 0 deletions resources-dut/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-fin/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-fre/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-hrv/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-hun/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-ita/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-nob/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-pol/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Tętno</string>
<string id="HeartRateLive5s">Tętno (Live 5s)</string>
<string id="Battery">Bateria</string>
<string id="BatteryNumeric">Bateria Numeric</string>
<string id="BatteryHidePercentage">Bateria (Sama Wartość)</string>
<string id="Notifications">Powiadomienia</string>
<string id="Calories">Kalorie</string>
Expand Down
1 change: 1 addition & 0 deletions resources-por/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-rus/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Пульс</string>
<string id="HeartRateLive5s">Пульс (обновлять каждые 5сек)</string>
<string id="Battery">Заряд аккумулятора</string>
<string id="BatteryNumeric">Заряд аккумулятора Цифровой дисплей</string>
<string id="BatteryHidePercentage">Заряд аккумулятора (скрывать проценты)</string>
<string id="Notifications">Уведомления</string>
<string id="Calories">Калории</string>
Expand Down
1 change: 1 addition & 0 deletions resources-slo/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-slv/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-spa/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-swe/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Puls</string>
<string id="HeartRateLive5s">Puls (Live 5s)</string>
<string id="Battery">Batteri</string>
<string id="BatteryNumeric">Batteri Numeric</string>
<string id="BatteryHidePercentage">Batteri (Dölj procent)</string>
<string id="Notifications">Notifieringar</string>
<string id="Calories">Kalorier</string>
Expand Down
1 change: 1 addition & 0 deletions resources-zhs/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
1 change: 1 addition & 0 deletions resources-zht/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
3 changes: 3 additions & 0 deletions resources/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<listEntry value="2">@Strings.Notifications</listEntry>
<listEntry value="3">@Strings.BluetoothOrNotifications</listEntry>
<listEntry value="4">@Strings.Battery</listEntry>
<listEntry value="5">@Strings.BatteryNumeric</listEntry>
</settingConfig>
</setting>

Expand All @@ -150,6 +151,7 @@
<listEntry value="2">@Strings.Notifications</listEntry>
<listEntry value="3">@Strings.BluetoothOrNotifications</listEntry>
<listEntry value="4">@Strings.Battery</listEntry>
<listEntry value="5">@Strings.BatteryNumeric</listEntry>
</settingConfig>
</setting>

Expand All @@ -160,6 +162,7 @@
<listEntry value="2">@Strings.Notifications</listEntry>
<listEntry value="3">@Strings.BluetoothOrNotifications</listEntry>
<listEntry value="4">@Strings.Battery</listEntry>
<listEntry value="5">@Strings.BatteryNumeric</listEntry>
</settingConfig>
</setting>

Expand Down
1 change: 1 addition & 0 deletions resources/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<string id="HeartRate">Heart Rate</string>
<string id="HeartRateLive5s">Heart Rate (Live 5s)</string>
<string id="Battery">Battery</string>
<string id="BatteryNumeric">Battery Numeric</string>
<string id="BatteryHidePercentage">Battery (Hide Percentage)</string>
<string id="Notifications">Notifications</string>
<string id="Calories">Calories</string>
Expand Down
6 changes: 6 additions & 0 deletions source/CrystalView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
5 changes: 5 additions & 0 deletions source/Indicators.mc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */) {
Expand Down