Skip to content
Merged
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
19 changes: 15 additions & 4 deletions source/Delegates/AdvancedViewDelegate.mc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import Toybox.Application;

class AdvancedViewDelegate extends WatchUi.BehaviorDelegate {

//private var _view as AdvancedView;

function initialize(view as AdvancedView) {
BehaviorDelegate.initialize();
InputDelegate.initialize();
//_view = view;
}

function onMenu(){
Expand Down Expand Up @@ -44,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;
}

Expand All @@ -57,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);
}

}
77 changes: 0 additions & 77 deletions source/Delegates/SettingsDelegate.mc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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;
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 {

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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading