From 2d5b0763500f023264e5a6ce830436ef2ccc88e4 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 19 Jan 2026 00:44:46 +1100 Subject: [PATCH 1/3] added profile delegates --- source/Delegates/AdvancedViewDelegate.mc | 4 +- source/Delegates/SettingsDelegate.mc | 76 ------------- .../ProfileDelegates/ProfilePickerDelegate.mc | 37 +++++++ .../ProfileDelegates/ProfilePickerFactory.mc | 64 +++++++++++ .../SelectExperienceDelegate.mc | 53 +++++++++ .../ProfileDelegates/SelectGenderDelegate.mc | 51 +++++++++ .../ProfileDelegates/SelectProfileDelegate.mc | 104 ++++++++++++++++++ .../SelectCadenceDelegate.mc | 4 +- .../SettingsDelegates/SettingsDelegate.mc | 101 +++++++++++++++++ source/Delegates/SimpleViewDelegate.mc | 12 +- source/GarminApp.mc | 1 + 11 files changed, 423 insertions(+), 84 deletions(-) delete mode 100644 source/Delegates/SettingsDelegate.mc create mode 100644 source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerDelegate.mc create mode 100644 source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerFactory.mc create mode 100644 source/Delegates/SettingsDelegates/ProfileDelegates/SelectExperienceDelegate.mc create mode 100644 source/Delegates/SettingsDelegates/ProfileDelegates/SelectGenderDelegate.mc create mode 100644 source/Delegates/SettingsDelegates/ProfileDelegates/SelectProfileDelegate.mc rename source/Delegates/{ => SettingsDelegates}/SelectCadenceDelegate.mc (96%) create mode 100644 source/Delegates/SettingsDelegates/SettingsDelegate.mc diff --git a/source/Delegates/AdvancedViewDelegate.mc b/source/Delegates/AdvancedViewDelegate.mc index f97db34..9bc2577 100644 --- a/source/Delegates/AdvancedViewDelegate.mc +++ b/source/Delegates/AdvancedViewDelegate.mc @@ -5,11 +5,11 @@ import Toybox.Application; class AdvancedViewDelegate extends WatchUi.InputDelegate { - private var _view as AdvancedView; + //private var _view as AdvancedView; function initialize(view as AdvancedView) { InputDelegate.initialize(); - _view = view; + //_view = view; } function onBack() as Boolean{ diff --git a/source/Delegates/SettingsDelegate.mc b/source/Delegates/SettingsDelegate.mc deleted file mode 100644 index 8caa6df..0000000 --- a/source/Delegates/SettingsDelegate.mc +++ /dev/null @@ -1,76 +0,0 @@ -import Toybox.Lang; -import Toybox.System; -import Toybox.WatchUi; -import Toybox.Application; - -class SettingsDelegate extends WatchUi.InputDelegate { - - private var _view as SettingsView; - - function initialize(view as SettingsView) { - InputDelegate.initialize(); - _view = view; - } - - function onBack() as Boolean{ - WatchUi.popView(WatchUi.SLIDE_DOWN); - return true; - } - - // This check for a tap on the screen - function onTap(event as WatchUi.ClickEvent) as Boolean { - - var x = 0; - var y = 0; - - // Use has check to safely retrieve coordinates from the event object. - if (event has :getCoordinates) { - // event.getCoordinates() returns Array [x, y]. - var tapCoords = event.getCoordinates() as Array; - x = tapCoords[0]; - y = tapCoords[1]; - } else if (event has :getX) { - // Fallback for devices without getCoordinates() - x = 0; - y = 0; - } - - System.println(x.toString() + "and" + y.toString()); - - // Get the button coordinates from the associated View - var coords = _view.getButtonCoords(); - var x1 = coords[0]; - var y1 = coords[1]; - var x2 = coords[2]; - var y2 = coords[3]; - - System.println(x1.toString() + " " + y1.toString() + " " + x2.toString() + " " + y2.toString()); - - // Check if the tap was on the button and sends to cadence range select menu - if (x >= x1 && x <= x1 + x2 && y >= y1 && y <= y1 + y2) { - System.println("Button Pressed"); - - - var app = Application.getApp() as GarminApp; - var minCadence = app.getMinCadence(); - var maxCadence = app.getMaxCadence(); - - var menu = new WatchUi.Menu2({ - :title => Lang.format("Cadence: $1$ - $2$", [minCadence, maxCadence]) - }); - - // these are def in strings.xml - menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_inc_min), null, :item_inc_min, null)); - menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_dec_min), null, :item_dec_min, null)); - menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_inc_max), null, :item_inc_max, null)); - menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_dec_max), null, :item_dec_max, null)); - - // push the menu made above with selectcadencedelegate - WatchUi.pushView(menu, new SelectCadenceDelegate(menu), WatchUi.SLIDE_LEFT); - - return true; - } - - return false; - } -} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerDelegate.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerDelegate.mc new file mode 100644 index 0000000..f7dcbd7 --- /dev/null +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerDelegate.mc @@ -0,0 +1,37 @@ +import Toybox.WatchUi; +import Toybox.System; +import Toybox.Application; +import Toybox.Lang; + +class ProfilePickerDelegate extends WatchUi.PickerDelegate { + + private var _typeId; + + function initialize(typeId) { + PickerDelegate.initialize(); + _typeId = typeId; + } + + function onAccept(values as Array) as Boolean { + var pickedValue = values[0]; // Gets the "selected" value + + //var app = Application.getApp(); + + if (_typeId == :prof_height) { + System.println("Height Saved: " + pickedValue); + //app.setUserHeight(pickedValue); + } + else if (_typeId == :prof_speed) { + System.println("Speed Saved: " + pickedValue); + //app.setUserSpeed(pickedValue); + } + + WatchUi.popView(WatchUi.SLIDE_RIGHT); + return true; + } + + function onCancel() as Boolean { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + return true; + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerFactory.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerFactory.mc new file mode 100644 index 0000000..a6140f5 --- /dev/null +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerFactory.mc @@ -0,0 +1,64 @@ +import Toybox.WatchUi; +import Toybox.Graphics; +import Toybox.Lang; + +class ProfilePickerFactory extends WatchUi.PickerFactory { + private var _start as Number; + private var _stop as Number; + private var _increment as Number; + private var _label as String; + + function initialize(start as Number, stop as Number, increment as Number, options as Dictionary?) { + PickerFactory.initialize(); + _start = start; + _stop = stop; + _increment = increment; + _label = ""; + + if (options != null) { + if (options.hasKey(:label)) { + _label = options[:label] as String; + } + } + } + + function getSize() as Number { + return (_stop - _start) / _increment + 1; + } + + function getValue(index as Number) as Object? { + return _start + (index * _increment); + } + + function getDrawable(index as Number, selected as Boolean) as Drawable? { + + // gets the selected value + var val = getValue(index); + + // converts to number if needed + if (val has :toNumber) { + val = val.toNumber(); + } + + // string that is displayed (e.g. "175" + " cm") + var displayString = Lang.format("$1$$2$", [val, _label]); + + return new WatchUi.Text({ + :text => displayString, + :color => Graphics.COLOR_WHITE, + :font => Graphics.FONT_MEDIUM, + :locX => WatchUi.LAYOUT_HALIGN_CENTER, + :locY => WatchUi.LAYOUT_VALIGN_CENTER + }); + } + + function getIndex(value as Number) as Number { + + var safeValue = value; + if (safeValue has :toNumber) { + safeValue = safeValue.toNumber(); + } + + return (safeValue - _start) / _increment; + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectExperienceDelegate.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectExperienceDelegate.mc new file mode 100644 index 0000000..c349a95 --- /dev/null +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectExperienceDelegate.mc @@ -0,0 +1,53 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; + +class SelectExperienceDelegate extends WatchUi.Menu2InputDelegate { + + private var _menu as WatchUi.Menu2; + var app = Application.getApp() as GarminApp; + //var experienceLvl = app.getExperienceLvl(); + var experienceLvl = 1.06;// make sure to change to above!! + + function initialize(menu as WatchUi.Menu2) { + Menu2InputDelegate.initialize(); + _menu = menu; + + // need if statements to display experiencelvl string instead of float values + var newTitle = Lang.format("Experience: $1$", [experienceLvl]); + + // This updates the UI when the cadence is changed + _menu.setTitle(newTitle); + } + + function onSelect(item) as Void { + + var id = item.getId(); + + //Try to change cadence range based off menu selection + if (id == :exp_beginner){ + System.println("User ExperienceLvl: Beginner"); + //app.setExperienceLvl(1.06); + } + else if (id == :exp_intermediate){ + System.println("User ExperienceLvl: Intermediate"); + //app.setExperienceLvl(1.04); + } + else if (id == :exp_advanced){ + System.println("User ExperienceLvl: Advanced"); + //app.setExperienceLvl(1.02); + } else {System.println("ERROR");} + + WatchUi.popView(WatchUi.SLIDE_RIGHT); + + } + + + function onMenuItem(item as Symbol) as Void {} + + // Returns back one menu + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectGenderDelegate.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectGenderDelegate.mc new file mode 100644 index 0000000..3fda82c --- /dev/null +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectGenderDelegate.mc @@ -0,0 +1,51 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; + +class SelectGenderDelegate extends WatchUi.Menu2InputDelegate { + + private var _menu as WatchUi.Menu2; + var app = Application.getApp() as GarminApp; + //var experienceLvl = app.getUserGender(); + var gender = "Other";// make sure to change to above!! + + function initialize(menu as WatchUi.Menu2) { + Menu2InputDelegate.initialize(); + _menu = menu; + + // need if statements to display experiencelvl string instead of float values + var newTitle = Lang.format("Gender: $1$", [gender]); + + // This updates the UI when the cadence is changed + _menu.setTitle(newTitle); + } + + function onSelect(item) as Void { + + var id = item.getId(); + + //Try to change cadence range based off menu selection + if (id == :user_male){ + System.println("User Gender: Male"); + //app.setUserGender("Male"); + } + else if (id == :user_female){ + System.println("User Gender: Female"); + //app.setUserGender("Female"); + } + else if (id == :user_other){ + System.println("User Gender: Other"); + //app.setUserGender("Other"); + } else {System.println("ERROR");} + + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } + + function onMenuItem(item as Symbol) as Void {} + + // Returns back one menu + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectProfileDelegate.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectProfileDelegate.mc new file mode 100644 index 0000000..a7ac987 --- /dev/null +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectProfileDelegate.mc @@ -0,0 +1,104 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; +import Toybox.Graphics; + +class SelectProfileDelegate extends WatchUi.Menu2InputDelegate { + + //private var _menu as WatchUi.Menu2; + + function initialize(menu as WatchUi.Menu2) { + Menu2InputDelegate.initialize(); + //_menu = menu; + } + + function onSelect(item) as Void { + + var id = item.getId(); + + //displays the menu for the selected item + if (id == :profile_height){ + heightPicker(); + } + else if (id == :profile_speed){ + speedPicker(); + } + else if (id == :profile_experience){ + experienceMenu(); + } + else if (id == :profile_gender){ + genderMenu(); + } + } + + function onMenuItem(item as Symbol) as Void {} + + // Returns back one menu + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } + + function heightPicker() as Void { + //var app = Application.getApp(); + //var currentHeight = app.getUserHeight(); + var currentHeight = null; + if (currentHeight == null) { currentHeight = 175; } // Default 175 cm + + var factory = new ProfilePickerFactory(100, 250, 1, {:label=>" cm"}); + + var picker = new WatchUi.Picker({ + :title => new WatchUi.Text({:text=>"Set Height", :locX=>WatchUi.LAYOUT_HALIGN_CENTER, :locY=>WatchUi.LAYOUT_VALIGN_BOTTOM, :color=>Graphics.COLOR_WHITE}), + :pattern => [factory], + :defaults => [factory.getIndex(currentHeight)] + }); + + WatchUi.pushView(picker, new ProfilePickerDelegate(:prof_height), WatchUi.SLIDE_LEFT); + + } + + function speedPicker() as Void { + //var app = Application.getApp(); + //var currentSpeed = app.getUserSpeed(); + var currentSpeed = null; + if (currentSpeed == null) { currentSpeed = 10; } // Default 10 km/h + + var factory = new ProfilePickerFactory(5, 30, 1, {:label=>" km/h"}); + + var picker = new WatchUi.Picker({ + :title => new WatchUi.Text({:text=>"Set Speed", :locX=>WatchUi.LAYOUT_HALIGN_CENTER, :locY=>WatchUi.LAYOUT_VALIGN_BOTTOM, :color=>Graphics.COLOR_WHITE}), + :pattern => [factory], + :defaults => [factory.getIndex(currentSpeed)] + }); + + WatchUi.pushView(picker, new ProfilePickerDelegate(:prof_speed), WatchUi.SLIDE_LEFT); + + } + + function experienceMenu() as Void { + var menu = new WatchUi.Menu2({ + :title => "Set Experience" + }); + + menu.addItem(new WatchUi.MenuItem("Beginner", null, :exp_beginner, null)); + menu.addItem(new WatchUi.MenuItem("Intermediate", null, :exp_intermediate, null)); + menu.addItem(new WatchUi.MenuItem("Advanced", null, :exp_advanced, null)); + + //pushes the view to the screen with the relevent delegate + WatchUi.pushView(menu, new SelectExperienceDelegate(menu), WatchUi.SLIDE_LEFT); + } + + function genderMenu() as Void { + var menu = new WatchUi.Menu2({ + :title => "Set Gender" + }); + + menu.addItem(new WatchUi.MenuItem("Male", null, :user_male, null)); + menu.addItem(new WatchUi.MenuItem("Female", null, :user_female, null)); + menu.addItem(new WatchUi.MenuItem("Other", null, :user_other, null)); + + //pushes the view to the screen with the relevent delegate + WatchUi.pushView(menu, new SelectGenderDelegate(menu), WatchUi.SLIDE_LEFT); + } + +} \ No newline at end of file diff --git a/source/Delegates/SelectCadenceDelegate.mc b/source/Delegates/SettingsDelegates/SelectCadenceDelegate.mc similarity index 96% rename from source/Delegates/SelectCadenceDelegate.mc rename to source/Delegates/SettingsDelegates/SelectCadenceDelegate.mc index 8947648..9dc205f 100644 --- a/source/Delegates/SelectCadenceDelegate.mc +++ b/source/Delegates/SettingsDelegates/SelectCadenceDelegate.mc @@ -58,14 +58,14 @@ class SelectCadenceDelegate extends WatchUi.Menu2InputDelegate { var newTitle = Lang.format("Cadence: $1$ - $2$", [newMin, newMax]); - // This updates the UI immediately + //this updates the UI when the cadence is changed _menu.setTitle(newTitle); } function onMenuItem(item as Symbol) as Void {} - // Returns back one menu + //returns back one menu function onBack() as Void { WatchUi.popView(WatchUi.SLIDE_RIGHT); } diff --git a/source/Delegates/SettingsDelegates/SettingsDelegate.mc b/source/Delegates/SettingsDelegates/SettingsDelegate.mc new file mode 100644 index 0000000..fe8081b --- /dev/null +++ b/source/Delegates/SettingsDelegates/SettingsDelegate.mc @@ -0,0 +1,101 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; + +//this Delegate handels the menu items and creates the menus for each item +class SettingsMenuDelegate extends WatchUi.Menu2InputDelegate { + + function initialize() { + Menu2InputDelegate.initialize(); + } + + //triggers when user selects a menu option + function onSelect(item as WatchUi.MenuItem) as Void { + var id = item.getId(); + + //pushes next menu view based on selection + if (id == :set_profile) { + System.println("Selected: Set Profile"); + //function to push next view + pushProfileMenu(); + } + else if (id == :cust_options) { + System.println("Selected: Customizable Options"); + pushCustMenu(); + } + else if (id == :feedback_options) { + System.println("Selected: Feedback Options"); + pushFeedbackMenu(); + } + else if (id == :cadence_range) { + pushCadenceMenu(); + } + } + + //allows user to go back from the menu view + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } + + function pushProfileMenu() as Void{ + + //creates the secondary menu and sets title + var menu = new WatchUi.Menu2({ + :title => "Profile Options" + }); + + //creates the new menu items + menu.addItem(new WatchUi.MenuItem("Height", null, :profile_height, null)); + menu.addItem(new WatchUi.MenuItem("Speed", null, :profile_speed, null)); + menu.addItem(new WatchUi.MenuItem("Experience level", null, :profile_experience, null)); + menu.addItem(new WatchUi.MenuItem("Gender", null, :profile_gender, null)); + + //pushes the view to the screen with the relevent delegate + WatchUi.pushView(menu, new SelectProfileDelegate(menu), WatchUi.SLIDE_LEFT); + + } + + function pushCustMenu() as Void{ + + var menu = new WatchUi.Menu2({ + :title => "Customization Options" + }); + + menu.addItem(new WatchUi.MenuItem("Bar Chart", null, :cust_bar_chart, null)); + + WatchUi.pushView(menu, new SelectProfileDelegate(menu), WatchUi.SLIDE_LEFT); + + } + + function pushFeedbackMenu() as Void{ + + var menu = new WatchUi.Menu2({ + :title => "Feedback Options" + }); + + menu.addItem(new WatchUi.MenuItem("Haptic Feedback", null, :profile_height, null)); + menu.addItem(new WatchUi.MenuItem("Audiable Feedback", null, :profile_speed, null)); + + WatchUi.pushView(menu, new SelectProfileDelegate(menu), WatchUi.SLIDE_LEFT); + } + + function pushCadenceMenu() as Void { + + //sets the cadence variables to the global app variable to be used within the title + var app = Application.getApp() as GarminApp; + var minCadence = app.getMinCadence(); + var maxCadence = app.getMaxCadence(); + + var menu = new WatchUi.Menu2({ + :title => Lang.format("Cadence: $1$ - $2$", [minCadence, maxCadence]) + }); + + menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_inc_min), null, :item_inc_min, null)); + menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_dec_min), null, :item_dec_min, null)); + menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_inc_max), null, :item_inc_max, null)); + menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_dec_max), null, :item_dec_max, null)); + + WatchUi.pushView(menu, new SelectCadenceDelegate(menu), WatchUi.SLIDE_LEFT); + } +} \ No newline at end of file diff --git a/source/Delegates/SimpleViewDelegate.mc b/source/Delegates/SimpleViewDelegate.mc index 07b0876..dbedda1 100644 --- a/source/Delegates/SimpleViewDelegate.mc +++ b/source/Delegates/SimpleViewDelegate.mc @@ -8,11 +8,15 @@ class SimpleViewDelegate extends WatchUi.BehaviorDelegate { } function onMenu() as Boolean { - var settingsView = new SettingsView(); - - //Switches the screen to settings view by holding up button - WatchUi.pushView(settingsView, new SettingsDelegate(settingsView), WatchUi.SLIDE_UP); + var settingsMenu = new WatchUi.Menu2({ :title => "Settings" }); + + settingsMenu.addItem(new WatchUi.MenuItem("Profile", null, :set_profile, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Customization", null, :cust_options, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Feedback", null, :feedback_options, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Cadence Range", null, :cadence_range, null)); + WatchUi.pushView(settingsMenu, new SettingsMenuDelegate(), WatchUi.SLIDE_UP); + return true; } diff --git a/source/GarminApp.mc b/source/GarminApp.mc index c086aac..03c8ade 100644 --- a/source/GarminApp.mc +++ b/source/GarminApp.mc @@ -26,6 +26,7 @@ class GarminApp extends Application.AppBase { private var _userHeight = 160; private var _userSpeed = 0; private var _trainingLvl = Beginner; + private var _userGender = 1; function initialize() { AppBase.initialize(); From e959ee10e10f46d4a74504cd54e212fd5e4da20b Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 19 Jan 2026 21:31:40 +1100 Subject: [PATCH 2/3] added feedback & customizable options --- .../SelectBarChartDelegate.mc | 50 ++++++++++++++ .../SelectCustomizableDelegate.mc | 47 +++++++++++++ .../SelectAudibleDelegate.mc | 50 ++++++++++++++ .../SelectFeedbackDelegate.mc | 66 +++++++++++++++++++ .../FeedbackDelegates/SelectHapticDelegate.mc | 50 ++++++++++++++ .../SettingsDelegates/SettingsDelegate.mc | 8 +-- 6 files changed, 267 insertions(+), 4 deletions(-) create mode 100644 source/Delegates/SettingsDelegates/CustomizableDelegates/SelectBarChartDelegate.mc create mode 100644 source/Delegates/SettingsDelegates/CustomizableDelegates/SelectCustomizableDelegate.mc create mode 100644 source/Delegates/SettingsDelegates/FeedbackDelegates/SelectAudibleDelegate.mc create mode 100644 source/Delegates/SettingsDelegates/FeedbackDelegates/SelectFeedbackDelegate.mc create mode 100644 source/Delegates/SettingsDelegates/FeedbackDelegates/SelectHapticDelegate.mc diff --git a/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectBarChartDelegate.mc b/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectBarChartDelegate.mc new file mode 100644 index 0000000..d3f96ac --- /dev/null +++ b/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectBarChartDelegate.mc @@ -0,0 +1,50 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; + +class SelectBarChartDelegate extends WatchUi.Menu2InputDelegate { + + //private var _menu as WatchUi.Menu2; + var app = Application.getApp() as GarminApp; + //var chartDuration = app.getChartDuration(); + + function initialize(menu as WatchUi.Menu2) { + Menu2InputDelegate.initialize(); + //_menu = menu; + } + + function onSelect(item) as Void { + + var id = item.getId(); + + //Try to change cadence range based off menu selection + if (id == :chart_15m){ + //app.setChartDuration("FifteenminChart"); + System.println("Chart Duration: Fifteenmin"); + } + else if (id == :chart_30m){ + //app.setChartDuration("ThirtyminChart"); + System.println("Chart Duration: Thirtymin"); + } + else if (id == :chart_1h){ + //app.setChartDuration("OneHourChart"); + System.println("Chart Duration: OneHour"); + } + else if (id == :chart_2h){ + //app.setChartDuration("TwoHourChart"); + System.println("Chart Duration: TwoHour"); + } + else {System.println("ERROR");} + + WatchUi.popView(WatchUi.SLIDE_RIGHT); + + } + + function onMenuItem(item as Symbol) as Void {} + + //returns back one menu + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectCustomizableDelegate.mc b/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectCustomizableDelegate.mc new file mode 100644 index 0000000..345a3b5 --- /dev/null +++ b/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectCustomizableDelegate.mc @@ -0,0 +1,47 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; + +class SelectCutomizableDelegate extends WatchUi.Menu2InputDelegate { + + //private var _menu as WatchUi.Menu2; + + function initialize(menu as WatchUi.Menu2) { + Menu2InputDelegate.initialize(); + //_menu = menu; + } + + function onSelect(item) as Void { + + var id = item.getId(); + + //Add if more customizable options are added + if (id == :cust_bar_chart){ + pushBarChartMenu(); + } + else {System.println("ERROR");} + + } + + function pushBarChartMenu() as Void { + var menu = new WatchUi.Menu2({ + :title => "Bar Chart Length:" + }); + + menu.addItem(new WatchUi.MenuItem("15 Minute", null, :chart_15m, null)); + menu.addItem(new WatchUi.MenuItem("30 Minute", null, :chart_30m, null)); + menu.addItem(new WatchUi.MenuItem("1 Hour", null, :chart_1h, null)); + menu.addItem(new WatchUi.MenuItem("2 Hour", null, :chart_2h, null)); + + //pushes the view to the screen with the relevent delegate + WatchUi.pushView(menu, new SelectBarChartDelegate(menu), WatchUi.SLIDE_LEFT); + } + + function onMenuItem(item as Symbol) as Void {} + + //returns back one menu + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectAudibleDelegate.mc b/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectAudibleDelegate.mc new file mode 100644 index 0000000..68d5708 --- /dev/null +++ b/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectAudibleDelegate.mc @@ -0,0 +1,50 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; + +class SelectAudibleDelegate extends WatchUi.Menu2InputDelegate { + + private var _menu as WatchUi.Menu2; + var app = Application.getApp() as GarminApp; + //var Audible = app.getAudible(); + var Audible = "low";// make sure to change to above!! - after feature has been added + + function initialize(menu as WatchUi.Menu2) { + Menu2InputDelegate.initialize(); + _menu = menu; + + var newTitle = Lang.format("Audible: $1$", [Audible]); + + // This updates the UI when the cadence is changed + _menu.setTitle(newTitle); + } + + function onSelect(item) as Void { + + var id = item.getId(); + + //Try to change cadence range based off menu selection + if (id == :audible_low){ + System.println("Audible Feedback: LOW"); + //app.setAudible("low"); + } + else if (id == :audible_med){ + System.println("Audible Feedback: MEDIUM"); + //app.setUserAudible("med"); + } + else if (id == :audible_high){ + System.println("Audible Feedback: HIGH"); + //app.setUserAudible("high"); + } else {System.println("ERROR");} + + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } + + function onMenuItem(item as Symbol) as Void {} + + // Returns back one menu + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectFeedbackDelegate.mc b/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectFeedbackDelegate.mc new file mode 100644 index 0000000..50515b9 --- /dev/null +++ b/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectFeedbackDelegate.mc @@ -0,0 +1,66 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; + +class SelectFeedbackDelegate extends WatchUi.Menu2InputDelegate { + + //private var _menu as WatchUi.Menu2; + var app = Application.getApp() as GarminApp; + //var experienceLvl = app.getUserGender(); + var gender = "Other";// make sure to change to above!! + + function initialize(menu as WatchUi.Menu2) { + Menu2InputDelegate.initialize(); + //_menu = menu; + } + + function onSelect(item) as Void { + + var id = item.getId(); + + //Try to change cadence range based off menu selection + if (id == :haptic_feedback){ + System.println("Haptic menu selected"); + pushHapticSettings(); + } + else if (id == :audible_feedback){ + System.println("Audible menu selected"); + pushAudibleSettings(); + } else {System.println("ERROR");} + + } + + function pushHapticSettings() as Void{ + var menu = new WatchUi.Menu2({ + :title => "Haptic Settings" + }); + //temp items since feedback has not yet been implemented + menu.addItem(new WatchUi.MenuItem("Low", null, :haptic_low, null)); + menu.addItem(new WatchUi.MenuItem("Medium", null, :haptic_med, null)); + menu.addItem(new WatchUi.MenuItem("High", null, :haptic_high, null)); + + //pushes the view to the screen with the relevent delegate + WatchUi.pushView(menu, new SelectHapticDelegate(menu), WatchUi.SLIDE_LEFT); + } + + function pushAudibleSettings() as Void{ + var menu = new WatchUi.Menu2({ + :title => "Audible Settings" + }); + + menu.addItem(new WatchUi.MenuItem("Low", null, :audible_low, null)); + menu.addItem(new WatchUi.MenuItem("Medium", null, :audible_med, null)); + menu.addItem(new WatchUi.MenuItem("High", null, :audible_high, null)); + + //pushes the view to the screen with the relevent delegate + WatchUi.pushView(menu, new SelectAudibleDelegate(menu), WatchUi.SLIDE_LEFT); + } + + function onMenuItem(item as Symbol) as Void {} + + // Returns back one menu + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectHapticDelegate.mc b/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectHapticDelegate.mc new file mode 100644 index 0000000..d701071 --- /dev/null +++ b/source/Delegates/SettingsDelegates/FeedbackDelegates/SelectHapticDelegate.mc @@ -0,0 +1,50 @@ +import Toybox.Lang; +import Toybox.System; +import Toybox.WatchUi; +import Toybox.Application; + +class SelectHapticDelegate extends WatchUi.Menu2InputDelegate { + + private var _menu as WatchUi.Menu2; + var app = Application.getApp() as GarminApp; + //var haptic = app.getHaptic(); + var haptic = "low";// make sure to change to above!! - after feature has been added + + function initialize(menu as WatchUi.Menu2) { + Menu2InputDelegate.initialize(); + _menu = menu; + + var newTitle = Lang.format("Haptic: $1$", [haptic]); + + // This updates the UI when the cadence is changed + _menu.setTitle(newTitle); + } + + function onSelect(item) as Void { + + var id = item.getId(); + + //Try to change cadence range based off menu selection + if (id == :haptic_low){ + System.println("Haptic Feedback: LOW"); + //app.setHaptic("low"); + } + else if (id == :haptic_med){ + System.println("Haptic Feedback: MEDIUM"); + //app.setUserHaptic("med"); + } + else if (id == :haptic_high){ + System.println("Haptic Feedback: HIGH"); + //app.setUserHaptic("high"); + } else {System.println("ERROR");} + + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } + + function onMenuItem(item as Symbol) as Void {} + + // Returns back one menu + function onBack() as Void { + WatchUi.popView(WatchUi.SLIDE_RIGHT); + } +} \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/SettingsDelegate.mc b/source/Delegates/SettingsDelegates/SettingsDelegate.mc index fe8081b..972f1e0 100644 --- a/source/Delegates/SettingsDelegates/SettingsDelegate.mc +++ b/source/Delegates/SettingsDelegates/SettingsDelegate.mc @@ -64,7 +64,7 @@ class SettingsMenuDelegate extends WatchUi.Menu2InputDelegate { menu.addItem(new WatchUi.MenuItem("Bar Chart", null, :cust_bar_chart, null)); - WatchUi.pushView(menu, new SelectProfileDelegate(menu), WatchUi.SLIDE_LEFT); + WatchUi.pushView(menu, new SelectCutomizableDelegate(menu), WatchUi.SLIDE_LEFT); } @@ -74,10 +74,10 @@ class SettingsMenuDelegate extends WatchUi.Menu2InputDelegate { :title => "Feedback Options" }); - menu.addItem(new WatchUi.MenuItem("Haptic Feedback", null, :profile_height, null)); - menu.addItem(new WatchUi.MenuItem("Audiable Feedback", null, :profile_speed, null)); + menu.addItem(new WatchUi.MenuItem("Haptic Feedback", null, :haptic_feedback, null)); + menu.addItem(new WatchUi.MenuItem("Audible Feedback", null, :audible_feedback, null)); - WatchUi.pushView(menu, new SelectProfileDelegate(menu), WatchUi.SLIDE_LEFT); + WatchUi.pushView(menu, new SelectFeedbackDelegate(menu), WatchUi.SLIDE_LEFT); } function pushCadenceMenu() as Void { From 9c5aecec0840dbc9e1bb48bcccfc12870068a363 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 19 Jan 2026 22:16:04 +1100 Subject: [PATCH 3/3] Merged with main Ready to pull to main --- source/Delegates/AdvancedViewDelegate.mc | 15 ++++++++-- .../SelectBarChartDelegate.mc | 18 +++++++----- .../ProfileDelegates/ProfilePickerDelegate.mc | 6 ++-- .../SelectExperienceDelegate.mc | 24 ++++++++++------ .../ProfileDelegates/SelectGenderDelegate.mc | 11 ++++---- .../ProfileDelegates/SelectProfileDelegate.mc | 13 ++++----- source/Delegates/SimpleViewDelegate.mc | 28 +++++++++---------- source/GarminApp.mc | 16 ++++++++++- source/Views/SimpleView.mc | 2 -- 9 files changed, 80 insertions(+), 53 deletions(-) diff --git a/source/Delegates/AdvancedViewDelegate.mc b/source/Delegates/AdvancedViewDelegate.mc index 5a48e45..9b302c8 100644 --- a/source/Delegates/AdvancedViewDelegate.mc +++ b/source/Delegates/AdvancedViewDelegate.mc @@ -46,9 +46,7 @@ class AdvancedViewDelegate extends WatchUi.BehaviorDelegate { } if(direction == WatchUi.SWIPE_LEFT){ - var currentView = new SettingsView(); - System.println("Swiped Left"); - WatchUi.pushView(currentView, new SettingsDelegate(currentView), WatchUi.SLIDE_LEFT); + pushSettingsView(); return true; } @@ -59,5 +57,16 @@ class AdvancedViewDelegate extends WatchUi.BehaviorDelegate { WatchUi.popView(WatchUi.SLIDE_BLINK); return true; } + + function pushSettingsView() as Void{ + var settingsMenu = new WatchUi.Menu2({ :title => "Settings" }); + + settingsMenu.addItem(new WatchUi.MenuItem("Profile", null, :set_profile, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Customization", null, :cust_options, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Feedback", null, :feedback_options, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Cadence Range", null, :cadence_range, null)); + + WatchUi.pushView(settingsMenu, new SettingsMenuDelegate(), WatchUi.SLIDE_UP); + } } \ No newline at end of file diff --git a/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectBarChartDelegate.mc b/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectBarChartDelegate.mc index d3f96ac..196f907 100644 --- a/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectBarChartDelegate.mc +++ b/source/Delegates/SettingsDelegates/CustomizableDelegates/SelectBarChartDelegate.mc @@ -5,13 +5,17 @@ import Toybox.Application; class SelectBarChartDelegate extends WatchUi.Menu2InputDelegate { - //private var _menu as WatchUi.Menu2; + private var _menu as WatchUi.Menu2; var app = Application.getApp() as GarminApp; - //var chartDuration = app.getChartDuration(); + var chartDuration = app.getChartDuration(); function initialize(menu as WatchUi.Menu2) { Menu2InputDelegate.initialize(); - //_menu = menu; + _menu = menu; + var newTitle = Lang.format("Chart: $1$", [chartDuration]); + + // This updates the UI when the chart duration is changed + _menu.setTitle(newTitle); } function onSelect(item) as Void { @@ -20,19 +24,19 @@ class SelectBarChartDelegate extends WatchUi.Menu2InputDelegate { //Try to change cadence range based off menu selection if (id == :chart_15m){ - //app.setChartDuration("FifteenminChart"); + app.setChartDuration("FifteenminChart"); System.println("Chart Duration: Fifteenmin"); } else if (id == :chart_30m){ - //app.setChartDuration("ThirtyminChart"); + app.setChartDuration("ThirtyminChart"); System.println("Chart Duration: Thirtymin"); } else if (id == :chart_1h){ - //app.setChartDuration("OneHourChart"); + app.setChartDuration("OneHourChart"); System.println("Chart Duration: OneHour"); } else if (id == :chart_2h){ - //app.setChartDuration("TwoHourChart"); + app.setChartDuration("TwoHourChart"); System.println("Chart Duration: TwoHour"); } else {System.println("ERROR");} diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerDelegate.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerDelegate.mc index f7dcbd7..61d7218 100644 --- a/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerDelegate.mc +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/ProfilePickerDelegate.mc @@ -15,15 +15,15 @@ class ProfilePickerDelegate extends WatchUi.PickerDelegate { function onAccept(values as Array) as Boolean { var pickedValue = values[0]; // Gets the "selected" value - //var app = Application.getApp(); + var app = Application.getApp() as GarminApp; if (_typeId == :prof_height) { System.println("Height Saved: " + pickedValue); - //app.setUserHeight(pickedValue); + app.setUserHeight(pickedValue); } else if (_typeId == :prof_speed) { System.println("Speed Saved: " + pickedValue); - //app.setUserSpeed(pickedValue); + app.setUserSpeed(pickedValue); } WatchUi.popView(WatchUi.SLIDE_RIGHT); diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectExperienceDelegate.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectExperienceDelegate.mc index c349a95..6e1a254 100644 --- a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectExperienceDelegate.mc +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectExperienceDelegate.mc @@ -7,17 +7,23 @@ class SelectExperienceDelegate extends WatchUi.Menu2InputDelegate { private var _menu as WatchUi.Menu2; var app = Application.getApp() as GarminApp; - //var experienceLvl = app.getExperienceLvl(); - var experienceLvl = 1.06;// make sure to change to above!! + var experienceLvl = app.getExperienceLvl(); + var experienceLvlString = "NULL"; function initialize(menu as WatchUi.Menu2) { Menu2InputDelegate.initialize(); _menu = menu; - // need if statements to display experiencelvl string instead of float values - var newTitle = Lang.format("Experience: $1$", [experienceLvl]); + if (experienceLvl == 1.06){ + experienceLvlString = "Beginner"; + } else if (experienceLvl == 1.04){ + experienceLvlString = "Intermediate"; + } else if (experienceLvl == 1.02){ + experienceLvlString = "Advanced"; + } + var newTitle = Lang.format("Experience: $1$", [experienceLvlString]); - // This updates the UI when the cadence is changed + // This updates the UI when the experience level is changed _menu.setTitle(newTitle); } @@ -25,18 +31,18 @@ class SelectExperienceDelegate extends WatchUi.Menu2InputDelegate { var id = item.getId(); - //Try to change cadence range based off menu selection + //Try to change user experience lvl based off menu selection if (id == :exp_beginner){ System.println("User ExperienceLvl: Beginner"); - //app.setExperienceLvl(1.06); + app.setExperienceLvl(1.06); } else if (id == :exp_intermediate){ System.println("User ExperienceLvl: Intermediate"); - //app.setExperienceLvl(1.04); + app.setExperienceLvl(1.04); } else if (id == :exp_advanced){ System.println("User ExperienceLvl: Advanced"); - //app.setExperienceLvl(1.02); + app.setExperienceLvl(1.02); } else {System.println("ERROR");} WatchUi.popView(WatchUi.SLIDE_RIGHT); diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectGenderDelegate.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectGenderDelegate.mc index 3fda82c..8f2179b 100644 --- a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectGenderDelegate.mc +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectGenderDelegate.mc @@ -7,8 +7,7 @@ class SelectGenderDelegate extends WatchUi.Menu2InputDelegate { private var _menu as WatchUi.Menu2; var app = Application.getApp() as GarminApp; - //var experienceLvl = app.getUserGender(); - var gender = "Other";// make sure to change to above!! + var gender = app.getUserGender(); function initialize(menu as WatchUi.Menu2) { Menu2InputDelegate.initialize(); @@ -25,18 +24,18 @@ class SelectGenderDelegate extends WatchUi.Menu2InputDelegate { var id = item.getId(); - //Try to change cadence range based off menu selection + //Try to change user gender based off menu selection if (id == :user_male){ + app.setUserGender("Male"); System.println("User Gender: Male"); - //app.setUserGender("Male"); } else if (id == :user_female){ + app.setUserGender("Female"); System.println("User Gender: Female"); - //app.setUserGender("Female"); } else if (id == :user_other){ + app.setUserGender("Other"); System.println("User Gender: Other"); - //app.setUserGender("Other"); } else {System.println("ERROR");} WatchUi.popView(WatchUi.SLIDE_RIGHT); diff --git a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectProfileDelegate.mc b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectProfileDelegate.mc index a7ac987..2e55f3e 100644 --- a/source/Delegates/SettingsDelegates/ProfileDelegates/SelectProfileDelegate.mc +++ b/source/Delegates/SettingsDelegates/ProfileDelegates/SelectProfileDelegate.mc @@ -7,6 +7,7 @@ import Toybox.Graphics; class SelectProfileDelegate extends WatchUi.Menu2InputDelegate { //private var _menu as WatchUi.Menu2; + var app = Application.getApp() as GarminApp; function initialize(menu as WatchUi.Menu2) { Menu2InputDelegate.initialize(); @@ -14,7 +15,7 @@ class SelectProfileDelegate extends WatchUi.Menu2InputDelegate { } function onSelect(item) as Void { - + var id = item.getId(); //displays the menu for the selected item @@ -40,9 +41,8 @@ class SelectProfileDelegate extends WatchUi.Menu2InputDelegate { } function heightPicker() as Void { - //var app = Application.getApp(); - //var currentHeight = app.getUserHeight(); - var currentHeight = null; + + var currentHeight = app.getUserHeight(); if (currentHeight == null) { currentHeight = 175; } // Default 175 cm var factory = new ProfilePickerFactory(100, 250, 1, {:label=>" cm"}); @@ -58,9 +58,8 @@ class SelectProfileDelegate extends WatchUi.Menu2InputDelegate { } function speedPicker() as Void { - //var app = Application.getApp(); - //var currentSpeed = app.getUserSpeed(); - var currentSpeed = null; + //uses number not float + var currentSpeed = app.getUserSpeed().toNumber(); if (currentSpeed == null) { currentSpeed = 10; } // Default 10 km/h var factory = new ProfilePickerFactory(5, 30, 1, {:label=>" km/h"}); diff --git a/source/Delegates/SimpleViewDelegate.mc b/source/Delegates/SimpleViewDelegate.mc index 3805dfb..163d145 100644 --- a/source/Delegates/SimpleViewDelegate.mc +++ b/source/Delegates/SimpleViewDelegate.mc @@ -11,15 +11,7 @@ class SimpleViewDelegate extends WatchUi.BehaviorDelegate { // Long-press MENU (optional settings) function onMenu() as Boolean { - var settingsMenu = new WatchUi.Menu2({ :title => "Settings" }); - - settingsMenu.addItem(new WatchUi.MenuItem("Profile", null, :set_profile, null)); - settingsMenu.addItem(new WatchUi.MenuItem("Customization", null, :cust_options, null)); - settingsMenu.addItem(new WatchUi.MenuItem("Feedback", null, :feedback_options, null)); - settingsMenu.addItem(new WatchUi.MenuItem("Cadence Range", null, :cadence_range, null)); - - WatchUi.pushView(settingsMenu, new SettingsMenuDelegate(), WatchUi.SLIDE_UP); - + pushSettingsView(); return true; } @@ -74,18 +66,24 @@ class SimpleViewDelegate extends WatchUi.BehaviorDelegate { } if (direction == WatchUi.SWIPE_LEFT) { - _currentView = new SettingsView(); - WatchUi.pushView( - _currentView, - new SettingsDelegate(_currentView), - WatchUi.SLIDE_LEFT - ); + pushSettingsView(); return true; } return false; } + function pushSettingsView() as Void{ + var settingsMenu = new WatchUi.Menu2({ :title => "Settings" }); + + settingsMenu.addItem(new WatchUi.MenuItem("Profile", null, :set_profile, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Customization", null, :cust_options, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Feedback", null, :feedback_options, null)); + settingsMenu.addItem(new WatchUi.MenuItem("Cadence Range", null, :cadence_range, null)); + + WatchUi.pushView(settingsMenu, new SettingsMenuDelegate(), WatchUi.SLIDE_UP); + } + function onBack() as Boolean { // Prevent accidental app exit return true; diff --git a/source/GarminApp.mc b/source/GarminApp.mc index 529c30c..61d2518 100644 --- a/source/GarminApp.mc +++ b/source/GarminApp.mc @@ -460,7 +460,17 @@ function writeDiagnosticLog() as Void { } function setChartDuration(value as String) as Void { - _chartDuration = value; + if (value == "FifteenminChart"){ + _chartDuration = FifteenminChart; + } else if (value == "ThirtyminChart"){ + _chartDuration = ThirtyminChart; + } else if (value == "OneHourChart"){ + _chartDuration = OneHourChart; + } else if (value == "TwoHourChart"){ + _chartDuration = TwoHourChart; + } else {System.println("ERROR");} + + System.println(_chartDuration); } function getUserGender() as String { @@ -479,6 +489,10 @@ function writeDiagnosticLog() as Void { _userHeight = value; } + function getUserHeight() as Number { + return _userHeight; + } + function getUserSpeed() as Float { return _userSpeed; } diff --git a/source/Views/SimpleView.mc b/source/Views/SimpleView.mc index db9d268..c20332f 100644 --- a/source/Views/SimpleView.mc +++ b/source/Views/SimpleView.mc @@ -18,8 +18,6 @@ class SimpleView extends WatchUi.View { private var _cqDisplay; private var _hardcoreDisplay; - - function _secondVibe() as Void { // Haptics not available on this target SDK/device in this workspace. // Replace the println below with the device vibration call when supported,