Skip to content

Commit

Permalink
6.8.0 - Configurable results theme (light and dark). Default is light…
Browse files Browse the repository at this point in the history
…. Configure it by holding left middle button or touch and holding screen (touch screen devices). Go to Global Settings, hold left button again and set results theme as you like.
  • Loading branch information
dliedke committed Mar 2, 2024
1 parent 615a995 commit 679d535
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Meditate/manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- This is a generated file. It is highly recommended that you DO NOT edit this file. -->
<iq:manifest xmlns:iq="http://www.garmin.com/xml/connectiq" version="3">
<iq:application entry="MeditateApp" id="9abb375dcf7c4ace87ff66f4f774f6c8" launcherIcon="@Drawables.launcherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watch-app" version="6.7.0">
<iq:application entry="MeditateApp" id="9abb375dcf7c4ace87ff66f4f774f6c8" launcherIcon="@Drawables.launcherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watch-app" version="6.8.0">
<iq:products>
<iq:product id="approachs62"/>
<iq:product id="approachs7042mm"/>
Expand Down
7 changes: 6 additions & 1 deletion Meditate/resources-deu/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<string id="menuGlobalSettings_singleSession">Einz. Sitz.</string>
<string id="menuGlobalSettings_respirationRate">Atmung</string>
<string id="menuGlobalSettings_autoStop">Auto Stopp</string>
<string id="menuGlobalSettings_resultsTheme">Ergebnisthema</string>
<string id="menuGlobalSettings_prepareTime">Vorb.-Zeit</string>
<string id="menuGlobalSettings_finalizeTime">Abschl.-Zeit</string>
<string id="menuGlobalSettings_respiration">Atmung: </string>
Expand Down Expand Up @@ -78,6 +79,10 @@
<string id="menuAutoStopOptions_on">Ein (Standard)</string>
<string id="menuAutoStopOptions_off">Aus</string>

<string id="menuResultsThemeOptions_title">Ergebnisse</string>
<string id="menuResultsThemeOptions_light">Hell (Standard)</string>
<string id="menuResultsThemeOptions_dark">Dunkel</string>

<string id="menuPrepareTimeOptions_title">Vorbereitung</string>
<string id="menuFinalizeTimeOptions_title">Abschluss</string>
<string id="menuPrepareTimeOptions_0s">0 Sek</string>
Expand Down Expand Up @@ -154,7 +159,7 @@
<string id="HRVready">HRV Bereit</string>
<string id="HRVoff">HRV aus</string>

<string id="about_AppVersion">Meditate 6.7.0</string>
<string id="about_AppVersion">Meditate 6.8.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
7 changes: 6 additions & 1 deletion Meditate/resources-por/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<string id="menuGlobalSettings_singleSession">Sessão Simples</string>
<string id="menuGlobalSettings_respirationRate">Taxa respiração</string>
<string id="menuGlobalSettings_autoStop">Parada Auto</string>
<string id="menuGlobalSettings_resultsTheme">Tema dos Resultados</string>
<string id="menuGlobalSettings_prepareTime">Tempo Preparação</string>
<string id="menuGlobalSettings_finalizeTime">Tempo Finalização</string>
<string id="menuGlobalSettings_respiration">Respiração: </string>
Expand Down Expand Up @@ -78,6 +79,10 @@
<string id="menuAutoStopOptions_on">Lig. (Padrão)</string>
<string id="menuAutoStopOptions_off">Desl.</string>

<string id="menuResultsThemeOptions_title">Resultados</string>
<string id="menuResultsThemeOptions_light">Claro (Padrão)</string>
<string id="menuResultsThemeOptions_dark">Escuro</string>

<string id="menuPrepareTimeOptions_title">Preparação</string>
<string id="menuFinalizeTimeOptions_title">Finalização</string>
<string id="menuPrepareTimeOptions_0s">0 segs</string>
Expand Down Expand Up @@ -155,7 +160,7 @@
<string id="HRVready">VFC Pronto</string>
<string id="HRVoff">VFC Deslig.</string>

<string id="about_AppVersion">Meditate 6.7.0</string>
<string id="about_AppVersion">Meditate 6.8.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
7 changes: 6 additions & 1 deletion Meditate/resources-spa/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<string id="menuGlobalSettings_singleSession">Sesión Única</string>
<string id="menuGlobalSettings_respirationRate">Tasa Respiración</string>
<string id="menuGlobalSettings_autoStop">Parada Auto</string>
<string id="menuGlobalSettings_resultsTheme">Tema de Resultados</string>
<string id="menuGlobalSettings_prepareTime">Tiempo Preparación</string>
<string id="menuGlobalSettings_finalizeTime">Tiempo Finalización</string>
<string id="menuGlobalSettings_respiration">Respiración: </string>
Expand Down Expand Up @@ -78,6 +79,10 @@
<string id="menuAutoStopOptions_on">Activ. (Predet.)</string>
<string id="menuAutoStopOptions_off">Des.</string>

<string id="menuResultsThemeOptions_title">Resultados</string>
<string id="menuResultsThemeOptions_light">Claro (Predeterminado)</string>
<string id="menuResultsThemeOptions_dark">Oscuro</string>

<string id="menuPrepareTimeOptions_title">Preparación</string>
<string id="menuFinalizeTimeOptions_title">Finalización</string>
<string id="menuPrepareTimeOptions_0s">0 seg</string>
Expand Down Expand Up @@ -154,7 +159,7 @@
<string id="HRVready">HRV Listo</string>
<string id="HRVoff">HRV apagado</string>

<string id="about_AppVersion">Meditate 6.7.0</string>
<string id="about_AppVersion">Meditate 6.8.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<menu id="globalSettingsMenu" title="@Strings.menuGlobalSettings_title">
<menu-item id="resultsTheme" label="@Strings.menuGlobalSettings_resultsTheme" />
<menu-item id="autoStop" label="@Strings.menuGlobalSettings_autoStop" />
<menu-item id="confirmSaveActivity" label="@Strings.menuGlobalSettings_confirmSaveActivity" />
<menu-item id="prepareTime" label="@Strings.menuGlobalSettings_prepareTime" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<menu id="resultsThemeOptionsMenu" title="@Strings.menuResultsThemeOptions_title">
<menu-item id="Light" label="@Strings.menuResultsThemeOptions_light" />
<menu-item id="Dark" label="@Strings.menuResultsThemeOptions_dark" />
</menu>
7 changes: 6 additions & 1 deletion Meditate/resources/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<string id="menuGlobalSettings_singleSession">Single session</string>
<string id="menuGlobalSettings_respirationRate">Respiration Rate</string>
<string id="menuGlobalSettings_autoStop">Auto Stop</string>
<string id="menuGlobalSettings_resultsTheme">Results Theme</string>
<string id="menuGlobalSettings_prepareTime">Prepare Time</string>
<string id="menuGlobalSettings_finalizeTime">Finalize Time</string>
<string id="menuGlobalSettings_respiration">Respiration: </string>
Expand Down Expand Up @@ -78,6 +79,10 @@
<string id="menuAutoStopOptions_on">On (Default)</string>
<string id="menuAutoStopOptions_off">Off</string>

<string id="menuResultsThemeOptions_title">Results</string>
<string id="menuResultsThemeOptions_light">Light (Default)</string>
<string id="menuResultsThemeOptions_dark">Dark</string>

<string id="menuPrepareTimeOptions_title">Preparation</string>
<string id="menuFinalizeTimeOptions_title">Finalization</string>
<string id="menuPrepareTimeOptions_0s">0 secs</string>
Expand Down Expand Up @@ -154,7 +159,7 @@
<string id="HRVready">HRV Ready</string>
<string id="HRVoff">HRV off</string>

<string id="about_AppVersion">Meditate 6.7.0</string>
<string id="about_AppVersion">Meditate 6.8.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
25 changes: 24 additions & 1 deletion Meditate/source/globalSettings/GlobalSettings.mc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class GlobalSettings {
static function loadAutoStop() {
var autoStop = App.Storage.getValue(AutoStopKey);
if (autoStop == null) {
return AutoStop.On; // Assuming 'On' is a valid default value for AutoStop
return AutoStop.On; // 'On' the default value for AutoStop
}
else {
return autoStop;
Expand All @@ -96,6 +96,22 @@ class GlobalSettings {
App.Storage.setValue(AutoStopKey, autoStop);
}

private static const ResultsThemeKey = "globalSettings_resultsTheme";

static function loadResultsTheme() {
var resultsTheme = App.Storage.getValue(ResultsThemeKey);
if (resultsTheme == null) {
return ResultsTheme.Light; // 'Light' is the default value for Results Theme
}
else {
return resultsTheme;
}
}

static function saveResultsTheme(resultsTheme) {
App.Storage.setValue(ResultsThemeKey, resultsTheme);
}

private static const PrepareTimeKey = "globalSettings_prapareTime";

static function loadPrepareTime() {
Expand Down Expand Up @@ -158,4 +174,11 @@ module AutoStop {
Off = 0,
On = 1
}
}

module ResultsTheme {
enum {
Light = 0,
Dark = 1
}
}
14 changes: 14 additions & 0 deletions Meditate/source/globalSettings/GlobalSettingsMenuDelegate.mc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class GlobalSettingsMenuDelegate extends Ui.MenuInputDelegate {
var autoStopDelegate = new MenuOptionsDelegate(method(:onAutoStopPicked));
Ui.pushView(new Rez.Menus.autoStopOptionMenu(), autoStopDelegate, Ui.SLIDE_LEFT);
}
else if (item ==:resultsTheme) {
var resultsDelegate = new MenuOptionsDelegate(method(:onResultsPicked));
Ui.pushView(new Rez.Menus.resultsThemeOptionsMenu(), resultsDelegate, Ui.SLIDE_LEFT);
}
}

function onConfirmSaveActivityPicked(item) {
Expand Down Expand Up @@ -94,6 +98,16 @@ class GlobalSettingsMenuDelegate extends Ui.MenuInputDelegate {
mOnGlobalSettingsChanged.invoke();
}

function onResultsPicked(item) {
if (item == :Light) {
GlobalSettings.saveResultsTheme(ResultsTheme.Light);
}
else if (item == :Dark) {
GlobalSettings.saveResultsTheme(ResultsTheme.Dark);
}
mOnGlobalSettingsChanged.invoke();
}

function onPrepareTimePicked(item) {
if (item == :time_0s) {
GlobalSettings.savePrepareTime(0);
Expand Down
18 changes: 15 additions & 3 deletions Meditate/source/summaryScreen/HeartRateGraphView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,29 @@ class HeartRateGraphView extends ScreenPicker.ScreenPickerView {
var centerX;
var centerY;
var summaryModel;
var resultsTheme;

function initialize(summaryModel) {
ScreenPickerView.initialize(Gfx.COLOR_BLACK);
me.summaryModel = summaryModel;
resultsTheme = GlobalSettings.loadResultsTheme();
}

// Update the view
function onUpdate(dc) {

// Light results theme
var backgroundColor = Gfx.COLOR_WHITE;
var foregroundColor = Gfx.COLOR_BLACK;

// Dark results theme
if (resultsTheme == ResultsTheme.Dark) {
backgroundColor = Gfx.COLOR_BLACK;
foregroundColor = Gfx.COLOR_WHITE;
}

// Clear the screen
dc.setColor(Gfx.COLOR_TRANSPARENT, Gfx.COLOR_BLACK);
dc.setColor(Gfx.COLOR_TRANSPARENT, backgroundColor);
dc.clear();
ScreenPickerView.onUpdate(dc);

Expand All @@ -51,7 +63,7 @@ class HeartRateGraphView extends ScreenPicker.ScreenPickerView {
me.summaryModel.avgHr = "--";
}

dc.setColor(Gfx.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.setColor(foregroundColor, Graphics.COLOR_TRANSPARENT);

// Draw title text
dc.drawText(centerX,
Expand Down Expand Up @@ -166,7 +178,7 @@ class HeartRateGraphView extends ScreenPicker.ScreenPickerView {

// Draw lines and labels
dc.setPenWidth(1);
dc.setColor(Gfx.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.setColor(foregroundColor, Graphics.COLOR_TRANSPARENT);

var lineSpacing = graph_height / 4;

Expand Down
18 changes: 15 additions & 3 deletions Meditate/source/summaryScreen/RespirationRateGraphView.mc
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,29 @@ class RespirationRateGraphView extends ScreenPicker.ScreenPickerView {
var centerX;
var centerY;
var summaryModel;
var resultsTheme;

function initialize(summaryModel) {
ScreenPickerView.initialize(Gfx.COLOR_BLACK);
me.summaryModel = summaryModel;
resultsTheme = GlobalSettings.loadResultsTheme();
}

// Update the view
function onUpdate(dc) {

// Light results theme
var backgroundColor = Gfx.COLOR_WHITE;
var foregroundColor = Gfx.COLOR_BLACK;

// Dark results theme
if (resultsTheme == ResultsTheme.Dark) {
backgroundColor = Gfx.COLOR_BLACK;
foregroundColor = Gfx.COLOR_WHITE;
}

// Clear the screen
dc.setColor(Gfx.COLOR_TRANSPARENT, Gfx.COLOR_BLACK);
dc.setColor(Gfx.COLOR_TRANSPARENT, backgroundColor);
dc.clear();
ScreenPickerView.onUpdate(dc);

Expand All @@ -51,7 +63,7 @@ class RespirationRateGraphView extends ScreenPicker.ScreenPickerView {
me.summaryModel.avgRr = "--";
}

dc.setColor(Gfx.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.setColor(foregroundColor, Graphics.COLOR_TRANSPARENT);

// Draw title text
dc.drawText(centerX,
Expand Down Expand Up @@ -178,7 +190,7 @@ class RespirationRateGraphView extends ScreenPicker.ScreenPickerView {

// Draw lines and labels
dc.setPenWidth(1);
dc.setColor(Gfx.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.setColor(foregroundColor, Graphics.COLOR_TRANSPARENT);

var lineSpacing = graph_height / numberHorizontalLines;

Expand Down
Loading

0 comments on commit 679d535

Please sign in to comment.