Skip to content

Commit

Permalink
6.2.0 - Added Breathing activity type
Browse files Browse the repository at this point in the history
  • Loading branch information
dliedke committed Nov 4, 2023
1 parent b270e38 commit 1b8643d
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 23 deletions.
8 changes: 8 additions & 0 deletions HrvAlgorithms/sources/activity/FitSessionSpec.mc
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ module HrvAlgorithms {
:sport => SPORT_MEDITATION
};
}

static function createBreathing(sessionName) {
return {
:name => sessionName,
:sport => ActivityRecording.SPORT_TRAINING,
:subSport => SUB_SPORT_BREATHWORKS
};
}
}
}
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.1.0">
<iq:application entry="MeditateApp" id="9abb375dcf7c4ace87ff66f4f774f6c8" launcherIcon="@Drawables.launcherIcon" minSdkVersion="3.0.0" name="@Strings.AppName" type="watch-app" version="6.2.0">
<iq:products>
<iq:product id="approachs62"/>
<iq:product id="approachs7042mm"/>
Expand Down
4 changes: 3 additions & 1 deletion Meditate/resources-por/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@
<string id="menuNewActivityTypeOptions_title">Atividade</string>
<string id="menuNewActivityTypeOptions_yoga">Yoga</string>
<string id="menuNewActivityTypeOptions_meditating">Meditação</string>
<string id="menuNewActivityTypeOptions_breathing">Respiração</string>

<string id="activityTypeMenu_title">Atividade</string>
<string id="activityTypeMenu_yoga">Yoga</string>
<string id="activityTypeMenu_meditating">Meditação</string>
<string id="activityTypeMenu_breathing">Respiração</string>

<string id="menuNewHrvTrackingOptions_title">Monit. VFC</string>
<string id="menuNewHrvTrackingOptions_onDetailed">Detalhado (Padrão)</string>
Expand Down Expand Up @@ -148,7 +150,7 @@
<string id="HRVready">VFC Pronto</string>
<string id="HRVoff">VFC Deslig.</string>

<string id="about_AppVersion">Meditate 6.1.0</string>
<string id="about_AppVersion">Meditate 6.2.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="newActivityTypeOptionsMenu" title="@Strings.menuNewActivityTypeOptions_title">
<menu-item id="yoga" label="@Strings.menuNewActivityTypeOptions_yoga" />
<menu-item id="meditating" label="@Strings.menuNewActivityTypeOptions_meditating" />
<menu-item id="breathing" label="@Strings.menuNewActivityTypeOptions_breathing" />
</menu>
1 change: 1 addition & 0 deletions Meditate/resources/menus/session/activityTypeMenu.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<menu id="activityTypeMenu" title="@Strings.activityTypeMenu_title">
<menu-item id="yoga" label="@Strings.activityTypeMenu_yoga" />
<menu-item id="meditating" label="@Strings.activityTypeMenu_meditating" />
<menu-item id="breathing" label="@Strings.activityTypeMenu_breathing" />
</menu>
4 changes: 3 additions & 1 deletion Meditate/resources/strings/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@
<string id="menuNewActivityTypeOptions_title">Activity</string>
<string id="menuNewActivityTypeOptions_yoga">Yoga</string>
<string id="menuNewActivityTypeOptions_meditating">Meditating</string>
<string id="menuNewActivityTypeOptions_breathing">Breathing</string>

<string id="activityTypeMenu_title">Activity Type</string>
<string id="activityTypeMenu_yoga">Yoga</string>
<string id="activityTypeMenu_meditating">Meditating</string>
<string id="activityTypeMenu_breathing">Breathing</string>

<string id="menuNewHrvTrackingOptions_title">Hrv Tracking</string>
<string id="menuNewHrvTrackingOptions_onDetailed">On Detailed (Default)</string>
Expand Down Expand Up @@ -147,7 +149,7 @@
<string id="HRVready">HRV Ready</string>
<string id="HRVoff">HRV off</string>

<string id="about_AppVersion">Meditate 6.1.0</string>
<string id="about_AppVersion">Meditate 6.2.0</string>
<string id="about_vtrifonov"> vtrifonov</string>
<string id="about_dliedke"> dliedke</string>

Expand Down
6 changes: 5 additions & 1 deletion Meditate/source/activity/MeditateActivity.mc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ class MediteActivity extends HrvAlgorithms.HrvAndStressActivity {
if (meditateModel.getActivityType() == ActivityType.Yoga) {
fitSessionSpec = HrvAlgorithms.FitSessionSpec.createYoga(createSessionName(sessionTime, activityNameProperty)); // Due to bug in Connect IQ API for breath activity to get respiration rate, we will use Yoga as default meditate activity
}
else {
if (meditateModel.getActivityType() == ActivityType.Meditating) {
fitSessionSpec = HrvAlgorithms.FitSessionSpec.createMeditation(createSessionName(sessionTime, activityNameProperty));
}
if (meditateModel.getActivityType() == ActivityType.Breathing) {
fitSessionSpec = HrvAlgorithms.FitSessionSpec.createBreathing(createSessionName(sessionTime, activityNameProperty));
}

me.mMeditateModel = meditateModel;
HrvAlgorithms.HrvAndStressActivity.initialize(fitSessionSpec, meditateModel.getHrvTracking(), heartbeatIntervalsSensor);
}
Expand Down
40 changes: 23 additions & 17 deletions Meditate/source/globalSettings/GlobalSettingsDelegate.mc
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,12 @@ class GlobalSettingsDelegate extends ScreenPicker.ScreenPickerDelegate {
}
details.detailLines[3].value.text = multiSessionSetting;

// Activity type settings (not enough screen space for everything)
/*
details.detailLines[4].icon = new ScreenPicker.Icon({
:font => StatusIconFonts.fontMeditateIcons,
:symbol => StatusIconFonts.Rez.Strings.meditateFontYoga
});
var newActivityType = GlobalSettings.loadActivityType();
if (newActivityType == ActivityType.Meditating) {
details.detailLines[4].value.text = Ui.loadResource(Rez.Strings.menuNewActivityTypeOptions_meditating);
}
if (newActivityType == ActivityType.Yoga) {
details.detailLines[4].value.text = Ui.loadResource(Rez.Strings.menuNewActivityTypeOptions_yoga);
}
*/


// Preparation time settings
details.detailLines[4].icon = new ScreenPicker.Icon({
:font => StatusIconFonts.fontMeditateIcons,
:symbol => StatusIconFonts.Rez.Strings.meditateFontYoga
:font => StatusIconFonts.fontAwesomeFreeRegular,
:symbol => StatusIconFonts.Rez.Strings.faClock
});

// Calculate minutes and seconds from the loaded prepare time
Expand All @@ -149,7 +136,25 @@ class GlobalSettingsDelegate extends ScreenPicker.ScreenPickerDelegate {
details.detailLines[4].value.text = Ui.loadResource(Rez.Strings.menuPrepareTimeOptions_title) + ": " + minutes + ":" + (seconds < 10 ? "0" : "") + seconds;


// Show Respiration rate settings if supported
// New Activity type settings
details.detailLines[5].icon = new ScreenPicker.Icon({
:font => StatusIconFonts.fontMeditateIcons,
:symbol => StatusIconFonts.Rez.Strings.meditateFontYoga,
:color => Gfx.COLOR_GREEN
});
var newActivityType = GlobalSettings.loadActivityType();
if (newActivityType == ActivityType.Meditating) {
details.detailLines[5].value.text = Ui.loadResource(Rez.Strings.menuNewActivityTypeOptions_meditating);
}
if (newActivityType == ActivityType.Yoga) {
details.detailLines[5].value.text = Ui.loadResource(Rez.Strings.menuNewActivityTypeOptions_yoga);
}
if (newActivityType == ActivityType.Breathing) {
details.detailLines[5].value.text = Ui.loadResource(Rez.Strings.menuNewActivityTypeOptions_breathing);
}

// Show Respiration rate settings if supported (not enough screen space for everything)
/*
if (HrvAlgorithms.RrActivity.isRespirationRateSupported()) {
var respirationRateSetting = "";
Expand All @@ -163,6 +168,7 @@ class GlobalSettingsDelegate extends ScreenPicker.ScreenPickerDelegate {
}
details.detailLines[5].value.text = Ui.loadResource(Rez.Strings.menuGlobalSettings_respiration) + respirationRateSetting;
}
*/

details.setAllLinesYOffset(me.mGlobalSettingsLinesYOffset);
details.setAllIconsXPos(me.mGlobalSettingsIconsXPos);
Expand Down
3 changes: 3 additions & 0 deletions Meditate/source/globalSettings/GlobalSettingsMenuDelegate.mc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ class GlobalSettingsMenuDelegate extends Ui.MenuInputDelegate {
else if (item == :yoga) {
GlobalSettings.saveActivityType(ActivityType.Yoga);
}
else if (item == :breathing) {
GlobalSettings.saveActivityType(ActivityType.Breathing);
}
mOnGlobalSettingsChanged.invoke();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ class AddEditSessionMenuDelegate extends Ui.MenuInputDelegate {
}
else if (item == :yoga) {
sessionModel.activityType = ActivityType.Yoga;
}
}
else if (item == :breathing) {
sessionModel.activityType = ActivityType.Breathing;
}
me.mOnChangeSession.invoke(sessionModel);
}

Expand Down
3 changes: 2 additions & 1 deletion Meditate/source/sessionSettings/SessionModel.mc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ module VibePattern {
module ActivityType {
enum {
Meditating = 0,
Yoga = 1
Yoga = 1,
Breathing = 2
}
}

Expand Down

0 comments on commit 1b8643d

Please sign in to comment.