Update/cadencelogo feature#62
Open
SawandiR wants to merge 16 commits into
Open
Conversation
- New view for selecting bar chart length - Updated logic within bar chart select delegate
UI/UX: update bar chart settings menu view
Updated summary view icons and layout
Bar Chart Select Changes
Refined Settings UI layout, styling and added settings icon
feature/pace-timer-fix
…arget cadence system with automatic ±5% range calculation. Updated cadence alerts, advanced view graph logic, and settings navigation to match PO feedback and simplify the overall cadence experience.
Remake screens to not use inbuild Garmin Menu2 (Allows us to use Min API level 1.2.0):
Activity: Resume, Pause, Stop
Save Activity?: Save, Discard
Look into using a custom font for icons on simple, advanced, and summary view. (allows better scaling for different screen sizes)
Simple View: Remove CQ score, redesign so pace is easily readable, add pace measurements (min/km)
Advanced: Update yellow timer to HH:MM:SS (Vihanga has done), change distance to pace.
Convert cadence min & max to one value (settings), calculate the min & max based on %5+/-.
Change cadence chart and indicator colours to: too low = red, everything else = green.
Remove vibration and popup alert for cadence too high.
I think that covers all the needed tasks, Naren is doing 3&4 (Vihanga already done the yellow timer just has pc issue), I think Joel did the cadence range settings so see if you can assign him 5, Vihanga was working on the colours so he can do 6, I linked the alerts so I can do 7. Everything else you can distribute to anyone
When you're making the kanban tasks let me know if you need help with descriptions.
these are the update need to be dopne Feedback received from POs:
• Simplify cadence input
• Replace min/max with single target value
• Auto-calculate ±5% range
• Remove upper limit alerts
• Only alert when cadence is too low
• Simplify feedback alerts
• Replace multiple vibrations with one simple alert
• Simplify colour system
• Red = below target
• Green = within range
• Remove unused colours (e.g., grey)
• Declutter main screen
• Move CQ (Cadence Quality) to advanced/summary view
• Clarify pace display
• Improve labeling of pace units for better understanding
These are the main area we need to focus on right now.
7:37 PM Call ended 13m 28s
these rae tere all the update we need to do for this gmain watch modificaton as fater op meeting can u make some task and discription so i can add to the kanban board]
1. Replace Built-in Menu (Menu2 Removal) what we basically needd to do
Add Custom Font for Icons (All Views) can this done by one guy?
can you start doing Replace Cadence Min/Max with Target Value this tsask cuz u alrady done m,aking cadncs setting so it would be easy to use to do it i will update ui/ux to make a new design for that it will be easy to u for now i will assign for that if u have issue or change the task just pm me. re write
i add task and bit discription and also assign team members so can u chekc and confim me all the discription good to go or any thing need to add just add and g=headsup me. re write
SOwe desiced toi remeove qc form the simpolke viwe and tthe change s going to done by e. SO we need a design for that doso acan you cant with me and desuide design and next we need t a a update design for the cadanvce setting we have to chahbge cuz op asked. it think for now thats all we need tyo to look inin it
i need that massage to be 2 ponits one for simple viwe and senc-ne for cadnace settingsd
Cadence Settings: We need to update the design based on the PO’s feedback, can flees soet out and redisgn and tell us so we can start with new cadance setting . basically not m,uch to design we need to remove stuff
Rolling on the floor laughing
much a pretiation.
MITCHELL
DEAN
SHARKIE
hoiw u mate how u going with your testing and also can u use that new watcg=he semulators to chekc any buigs or issues
i need a quick updatre this week what our team going to do which mewan dev teamn
Updating cadence settings from min/max input to a single target value with auto ±5% calculation so this pone
this one is my task if i =gave the code s for that cna you updat e5he setting do as new way
remeber it asllos connect woth advance viwe graps
these are the file i hav ewhat u need tio chnag efirst
im now sending min and max
import Toybox.Graphics;
import Toybox.WatchUi;
// CadenceMinView
// This screen shows the user their current minimum cadence setting.
// It is a simple display screen - the user cannot edit the value here.
// Editing happens through the existing CadenceRangePickerDelegate.
class CadenceMinView extends WatchUi.View {
function initialize() {
View.initialize();
}
function onUpdate(dc as Dc) as Void {
// Step 1: Clear the screen with a black background
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
dc.clear();
// Step 2: Get screen dimensions so we can centre text
var width = dc.getWidth();
var height = dc.getHeight();
// Step 3: Get the current minimum cadence value from the app
var app = getApp();
var minCadence = app.getMinCadence();
// Step 4: Draw the screen title "Min Cadence" in the upper area
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
height / 3,
Graphics.FONT_MEDIUM,
"Min Cadence",
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
// Step 5: Draw the actual minimum cadence value in large text in the centre
// This shows the user what their current minimum cadence is set to
dc.setColor(Graphics.COLOR_GREEN, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
height / 2,
Graphics.FONT_NUMBER_HOT,
minCadence.toString(),
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
// Step 6: Draw "spm" label below the number so user knows the unit
dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
(height / 2) + 50,
Graphics.FONT_SMALL,
"spm",
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
}
} min cpode import Toybox.Graphics;
import Toybox.WatchUi;
// CadenceMaxView
// This screen shows the user their current maximum cadence setting.
// It is a simple display screen - the user cannot edit the value here.
// Editing happens through the existing CadenceRangePickerDelegate.
class CadenceMaxView extends WatchUi.View {
function initialize() {
View.initialize();
}
function onUpdate(dc as Dc) as Void {
// Step 1: Clear the screen with a black background
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
dc.clear();
// Step 2: Get screen dimensions so we can centre text
var width = dc.getWidth();
var height = dc.getHeight();
// Step 3: Get the current maximum cadence value from the app
var app = getApp();
var maxCadence = app.getMaxCadence();
// Step 4: Draw the screen title "Max Cadence" in the upper area
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
height / 3,
Graphics.FONT_MEDIUM,
"Max Cadence",
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
// Step 5: Draw the actual maximum cadence value in large text in the centre
// This shows the user what their current maximum cadence is set to
// Displayed in orange so user can visually distinguish from min (green)
dc.setColor(Graphics.COLOR_ORANGE, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
height / 2,
Graphics.FONT_NUMBER_HOT,
maxCadence.toString(),
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
// Step 6: Draw "spm" label below the number so user knows the unit
dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
(height / 2) + 50,
Graphics.FONT_SMALL,
"spm",
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
}
} max code
var targetCadence = app.getTargetCadence(); this one we have a issue how ever i have import Toybox.Lang;
import Toybox.WatchUi;
import Toybox.System;
import Toybox.Application;
class CadenceMaxDelegate extends WatchUi.BehaviorDelegate {
// _max stores the current maximum cadence value locally
private var _max as Number;
function initialize() {
BehaviorDelegate.initialize();
// Get the current max cadence from the app when screen opens
var app = Application.getApp() as GarminApp;
_max = app.getMaxCadence();
}
// BACK → go back to CadenceMinView
function onBack() as Boolean {
System.println("[SETTINGS] CadenceMax: Back - returning to CadenceMinView");
WatchUi.switchToView(
new CadenceMinView(),
new CadenceMinDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// SELECT → save current value and go back to CadenceSettingsMenuView
function onSelect() as Boolean {
System.println("[SETTINGS] CadenceMax: Select - saving max and returning to CadenceSettingsMenu");
var app = Application.getApp() as GarminApp;
app.setMaxCadence(_max);
WatchUi.switchToView(
new CadenceSettingsMenuView(),
new CadenceSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
function onKey(keyEvent as WatchUi.KeyEvent) as Boolean {
var key = keyEvent.getKey();
var app = Application.getApp() as GarminApp;
// UP → increase max cadence by 1 and save immediately
if (key == WatchUi.KEY_UP) {
_max = _max + 1;
app.setMaxCadence(_max);
System.println("[SETTINGS] CadenceMax: UP - max is now " + _max);
WatchUi.requestUpdate();
return true;
}
// DOWN → decrease max cadence by 1 and save immediately
if (key == WatchUi.KEY_DOWN) {
_max = _max - 1;
app.setMaxCadence(_max);
System.println("[SETTINGS] CadenceMax: DOWN - max is now " + _max);
WatchUi.requestUpdate();
return true;
}
return false;
}
} which cadance max delegate and import Toybox.Lang;
import Toybox.WatchUi;
import Toybox.System;
import Toybox.Application;
class CadenceMinDelegate extends WatchUi.BehaviorDelegate {
// _min stores the current minimum cadence value locally
// so we can change it with UP/DOWN before saving
private var _min as Number;
function initialize() {
BehaviorDelegate.initialize();
// Get the current min cadence from the app when screen opens
var app = Application.getApp() as GarminApp;
_min = app.getMinCadence();
}
// BACK → go back to CadenceSettingsMenuView
function onBack() as Boolean {
System.println("[SETTINGS] CadenceMin: Back - returning to CadenceSettingsMenu");
WatchUi.switchToView(
new CadenceSettingsMenuView(),
new CadenceSettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// SELECT → save current value and go to CadenceMaxView
function onSelect() as Boolean {
System.println("[SETTINGS] CadenceMin: Select - saving min and going to CadenceMaxView");
var app = Application.getApp() as GarminApp;
app.setMinCadence(_min);
WatchUi.switchToView(
new CadenceMaxView(),
new CadenceMaxDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
function onKey(keyEvent as WatchUi.KeyEvent) as Boolean {
var key = keyEvent.getKey();
var app = Application.getApp() as GarminApp;
// UP → increase min cadence by 1 and save immediately
if (key == WatchUi.KEY_UP) {
_min = _min + 1;
app.setMinCadence(_min);
System.println("[SETTINGS] CadenceMin: UP - min is now " + _min);
WatchUi.requestUpdate(); // refreshes screen to show new value
return true;
}
// DOWN → decrease min cadence by 1 and save immediately
if (key == WatchUi.KEY_DOWN) {
_min = _min - 1;
app.setMinCadence(_min);
System.println("[SETTINGS] CadenceMin: DOWN - min is now " + _min);
WatchUi.requestUpdate(); // refreshes screen to show new value
return true;
}
return false;
}
} cadance min deleget
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
import Toybox.Application;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(new SimpleView(), new SimpleViewDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
// Handles the SELECT/START button (or screen tap)
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceMinView");
WatchUi.switchToView(
new CadenceMinView(),
new CadenceMinDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button (or swipe up)
function onNextPage() as Boolean {
System.println("Down button pressed");
// Push the bar chart settings view
WatchUi.pushView(new BarChartSettingsMenuView(), new BarChartSettingsMenuDelegate(), WatchUi.SLIDE_UP);
return true;
}
// Handles the UP button (or swipe down)
function onPreviousPage() as Boolean {
System.println("Up button pressed");
// Push the profile settings view
WatchUi.pushView(new SummarySettingsMenuView(), new SummarySettingsMenuDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
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_set_min), null, :item_set_min, null));
menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_set_max), null, :item_set_max, null));
WatchUi.pushView(menu, new SelectCadenceDelegate(menu), WatchUi.SLIDE_LEFT);
}
} this cadnace setting deleget
import Toybox.WatchUi;
import Toybox.System;
import Toybox.Application;
import Toybox.Lang;
class CadenceRangePickerDelegate extends WatchUi.PickerDelegate {
private var _typeId;
private var _menu;
function initialize(typeId, menu) {
PickerDelegate.initialize();
_typeId = typeId;
_menu = menu;
System.println("[DEBUG] CadenceRangePickerDelegate initialized with typeId: " + typeId);
}
function onAccept(values as Array) as Boolean {
System.println("[DEBUG] CadenceRangePickerDelegate onAccept called");
var pickedValue = values[0]; // Gets the "selected" value
System.println("[DEBUG] Picked value: " + pickedValue);
var app = Application.getApp() as GarminApp;
if (_typeId == :cadence_min) {
System.println("[INFO] Min Cadence Saved: " + pickedValue);
app.setMinCadence(pickedValue);
}
else if (_typeId == :cadence_max) {
System.println("[INFO] Max Cadence Saved: " + pickedValue);
app.setMaxCadence(pickedValue);
}
// Update the menu title to show new range
if (_menu != null) {
var newMin = app.getMinCadence();
var newMax = app.getMaxCadence();
var newTitle = Lang.format("Cadence: $1$ - $2$", [newMin, newMax]);
_menu.setTitle(newTitle);
System.println("[DEBUG] Menu title updated to: " + newTitle);
}
WatchUi.popView(WatchUi.SLIDE_RIGHT);
return true;
}
function onCancel() as Boolean {
System.println("[DEBUG] CadenceRangePickerDelegate onCancel called");
WatchUi.popView(WatchUi.SLIDE_RIGHT);
return true;
}
} cadance range picker
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
import Toybox.Application;
import Toybox.Graphics;
class SelectCadenceDelegate extends WatchUi.Menu2InputDelegate {
private var _menu as WatchUi.Menu2;
var app = Application.getApp() as GarminApp;
function initialize(menu as WatchUi.Menu2) {
Menu2InputDelegate.initialize();
_menu = menu;
}
function onSelect(item) as Void {
var id = item.getId();
System.println("[DEBUG] SelectCadenceDelegate onSelect called with id: " + id);
// Show picker for min or max cadence
if (id == :item_set_min) {
System.println("[DEBUG] Opening minCadencePicker");
minCadencePicker();
}
else if (id == :item_set_max) {
System.println("[DEBUG] Opening maxCadencePicker");
maxCadencePicker();
}
else {
System.println("[DEBUG] Unknown menu item id: " + id);
}
}
function onMenuItem(item as Symbol) as Void {
System.println("[DEBUG] onMenuItem called with: " + item);
// Legacy code - no longer used with pickers
// Keeping for backwards compatibility if needed
}
// Returns back one menu
function onBack() as Void {
System.println("[DEBUG] SelectCadenceDelegate onBack called");
WatchUi.popView(WatchUi.SLIDE_BLINK);
}
function minCadencePicker() as Void {
System.println("[DEBUG] minCadencePicker() started");
var currentMin = app.getMinCadence();
if (currentMin == null) { currentMin = 120; } // Default 120 spm
System.println("[DEBUG] Current min cadence: " + currentMin);
try {
// Range: 50-200, increment by 1, label " spm"
var factory = new ProfilePickerFactory(50, 200, 1, {:label=>" spm"});
System.println("[DEBUG] ProfilePickerFactory created");
var picker = new WatchUi.Picker({
:title => new WatchUi.Text({
:text=>"Min Cadence",
:locX=>WatchUi.LAYOUT_HALIGN_CENTER,
:locY=>WatchUi.LAYOUT_VALIGN_BOTTOM,
:color=>Graphics.COLOR_WHITE
}),
:pattern => [factory],
:defaults => [factory.getIndex(currentMin)]
});
System.println("[DEBUG] Picker created");
WatchUi.pushView(picker, new CadenceRangePickerDelegate(:cadence_min, _menu), WatchUi.SLIDE_LEFT);
System.println("[DEBUG] Picker pushed to view");
}
catch (ex) {
System.println("[ERROR] Exception in minCadencePicker: " + ex.getErrorMessage());
}
}
function maxCadencePicker() as Void {
System.println("[DEBUG] maxCadencePicker() started");
var currentMax = app.getMaxCadence();
if (currentMax == null) { currentMax = 150; } // Default 150 spm
System.println("[DEBUG] Current max cadence: " + currentMax);
try {
// Range: 50-200, increment by 1, label " spm"
var factory = new ProfilePickerFactory(50, 200, 1, {:label=>" spm"});
System.println("[DEBUG] ProfilePickerFactory created");
var picker = new WatchUi.Picker({
:title => new WatchUi.Text({
:text=>"Max Cadence",
:locX=>WatchUi.LAYOUT_HALIGN_CENTER,
:locY=>WatchUi.LAYOUT_VALIGN_BOTTOM,
:color=>Graphics.COLOR_WHITE
}),
:pattern => [factory],
:defaults => [factory.getIndex(currentMax)]
});
System.println("[DEBUG] Picker created");
WatchUi.pushView(picker, new CadenceRangePickerDelegate(:cadence_max, _menu), WatchUi.SLIDE_LEFT);
System.println("[DEBUG] Picker pushed to view");
}
catch (ex) {
System.println("[ERROR] Exception in maxCadencePicker: " + ex.getErrorMessage());
}
}
} this also selsec cadance
im going to delete all the green once in tyhe folder
so for the cadance setting menu dleegete import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
import Toybox.Application;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(new SimpleView(), new SimpleViewDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
// Handles the SELECT/START button (or screen tap)
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceMinView");
WatchUi.switchToView(
new CadenceMinView(),
new CadenceMinDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button (or swipe up)
function onNextPage() as Boolean {
System.println("Down button pressed");
// Push the bar chart settings view
WatchUi.pushView(new BarChartSettingsMenuView(), new BarChartSettingsMenuDelegate(), WatchUi.SLIDE_UP);
return true;
}
// Handles the UP button (or swipe down)
function onPreviousPage() as Boolean {
System.println("Up button pressed");
// Push the profile settings view
WatchUi.pushView(new SummarySettingsMenuView(), new SummarySettingsMenuDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
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_set_min), null, :item_set_min, null));
menu.addItem(new WatchUi.MenuItem(WatchUi.loadResource(Rez.Strings.menu_set_max), null, :item_set_max, null));
WatchUi.pushView(menu, new SelectCadenceDelegate(menu), WatchUi.SLIDE_LEFT);
}
}i have this what i need to change it
import Toybox.System;
import Toybox.WatchUi;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(new SimpleView(), new SimpleViewDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
// Handles the SELECT/START button (or screen tap)
System.println("Select pressed: Opening CadenceTargetView");
WatchUi.switchToView(
new CadenceTargetView(),
new CadenceTargetDelegate(),
WatchUi.SLIDE_UP
);
// Handles the DOWN button (or swipe up)
function onNextPage() as Boolean {
System.println("Down button pressed");
// Push the bar chart settings view
WatchUi.pushView(new BarChartSettingsMenuView(), new BarChartSettingsMenuDelegate(), WatchUi.SLIDE_UP);
return true;
}
// Handles the UP button (or swipe down)
function onPreviousPage() as Boolean {
System.println("Up button pressed");
// Push the profile settings view
WatchUi.pushView(new SummarySettingsMenuView(), new SummarySettingsMenuDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
} chekc this correct
import Toybox.System;
import Toybox.WatchUi;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(
new SimpleView(),
new SimpleViewDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// Handles the SELECT/START button
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceTargetView");
WatchUi.switchToView(
new CadenceTargetView(),
new CadenceTargetDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button
function onNextPage() as Boolean {
System.println("Down button pressed");
WatchUi.pushView(
new BarChartSettingsMenuView(),
new BarChartSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the UP button
function onPreviousPage() as Boolean {
System.println("Up button pressed");
WatchUi.pushView(
new SummarySettingsMenuView(),
new SummarySettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
} has errors
import Toybox.Lang;
import Toybox.WatchUi;
import Toybox.System;
import Toybox.Application;
class CadenceTargetDelegate extends WatchUi.BehaviorDelegate {
private var _target as Number;
function initialize() {
BehaviorDelegate.initialize();
var app = Application.getApp() as GarminApp;
_target = app.getTargetCadence();
}
function onBack() as Boolean {
WatchUi.switchToView(
new CadenceSettingsMenuView(),
new CadenceSettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
function onSelect() as Boolean {
var app = Application.getApp() as GarminApp;
app.setTargetCadence(_target);
WatchUi.switchToView(
new CadenceSettingsMenuView(),
new CadenceSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
function onKey(keyEvent as WatchUi.KeyEvent) as Boolean {
var key = keyEvent.getKey();
var app = Application.getApp() as GarminApp;
if (key == WatchUi.KEY_UP) {
_target = _target + 1;
app.setTargetCadence(_target);
WatchUi.requestUpdate();
return true;
}
if (key == WatchUi.KEY_DOWN) {
_target = _target - 1;
app.setTargetCadence(_target);
WatchUi.requestUpdate();
return true;
}
return false;
}
} this one cadancew targetdeleget.mc
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
import Toybox.Application;
import Toybox.Graphics;
class SelectCadenceDelegate extends WatchUi.Menu2InputDelegate {
private var _menu as WatchUi.Menu2;
var app = Application.getApp() as GarminApp;
function initialize(menu as WatchUi.Menu2) {
Menu2InputDelegate.initialize();
_menu = menu;
}
function onSelect(item) as Void {
var id = item.getId();
System.println("[DEBUG] SelectCadenceDelegate onSelect called with id: " + id);
// Show picker for min or max cadence
if (id == :item_set_min) {
System.println("[DEBUG] Opening minCadencePicker");
minCadencePicker();
}
else if (id == :item_set_max) {
System.println("[DEBUG] Opening maxCadencePicker");
maxCadencePicker();
}
else {
System.println("[DEBUG] Unknown menu item id: " + id);
}
}
function onMenuItem(item as Symbol) as Void {
System.println("[DEBUG] onMenuItem called with: " + item);
// Legacy code - no longer used with pickers
// Keeping for backwards compatibility if needed
}
// Returns back one menu
function onBack() as Void {
System.println("[DEBUG] SelectCadenceDelegate onBack called");
WatchUi.popView(WatchUi.SLIDE_BLINK);
}
function minCadencePicker() as Void {
System.println("[DEBUG] minCadencePicker() started");
var currentMin = app.getMinCadence();
if (currentMin == null) { currentMin = 120; } // Default 120 spm
System.println("[DEBUG] Current min cadence: " + currentMin);
try {
// Range: 50-200, increment by 1, label " spm"
var factory = new ProfilePickerFactory(50, 200, 1, {:label=>" spm"});
System.println("[DEBUG] ProfilePickerFactory created");
var picker = new WatchUi.Picker({
:title => new WatchUi.Text({
:text=>"Min Cadence",
:locX=>WatchUi.LAYOUT_HALIGN_CENTER,
:locY=>WatchUi.LAYOUT_VALIGN_BOTTOM,
:color=>Graphics.COLOR_WHITE
}),
:pattern => [factory],
:defaults => [factory.getIndex(currentMin)]
});
System.println("[DEBUG] Picker created");
WatchUi.pushView(picker, new CadenceRangePickerDelegate(:cadence_min, _menu), WatchUi.SLIDE_LEFT);
System.println("[DEBUG] Picker pushed to view");
}
catch (ex) {
System.println("[ERROR] Exception in minCadencePicker: " + ex.getErrorMessage());
}
}
function maxCadencePicker() as Void {
System.println("[DEBUG] maxCadencePicker() started");
var currentMax = app.getMaxCadence();
if (currentMax == null) { currentMax = 150; } // Default 150 spm
System.println("[DEBUG] Current max cadence: " + currentMax);
try {
// Range: 50-200, increment by 1, label " spm"
var factory = new ProfilePickerFactory(50, 200, 1, {:label=>" spm"});
System.println("[DEBUG] ProfilePickerFactory created");
var picker = new WatchUi.Picker({
:title => new WatchUi.Text({
:text=>"Max Cadence",
:locX=>WatchUi.LAYOUT_HALIGN_CENTER,
:locY=>WatchUi.LAYOUT_VALIGN_BOTTOM,
:color=>Graphics.COLOR_WHITE
}),
:pattern => [factory],
:defaults => [factory.getIndex(currentMax)]
});
System.println("[DEBUG] Picker created");
WatchUi.pushView(picker, new CadenceRangePickerDelegate(:cadence_max, _menu), WatchUi.SLIDE_LEFT);
System.println("[DEBUG] Picker pushed to view");
}
catch (ex) {
System.println("[ERROR] Exception in maxCadencePicker: " + ex.getErrorMessage());
}
}
} selectcadancedelege.mc
import Toybox.Graphics;
import Toybox.WatchUi;
class CadenceTargetView extends WatchUi.View {
function initialize() {
View.initialize();
}
function onUpdate(dc as Dc) as Void {
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
dc.clear();
var width = dc.getWidth();
var height = dc.getHeight();
var app = getApp();
var targetCadence = app.getTargetCadence();
// Title
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
height / 3,
Graphics.FONT_MEDIUM,
"Target Cadence",
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
// Cadence Number
dc.setColor(Graphics.COLOR_GREEN, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
height / 2,
Graphics.FONT_NUMBER_HOT,
targetCadence.toString(),
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
// Unit
dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
(height / 2) + 50,
Graphics.FONT_SMALL,
"spm",
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
}
} cadance target viwe
Pasted text.txt
Document
garmin.m,,c
Pasted text.txt
Document
Pasted text.txt
Document
Pasted text.txt
Document
Pasted text.txt
Document
Pasted text.txt
Document
where do i need to change
Pasted text.txt
Document
Pasted text.txt
Document
this has a issue
Pasted text.txt
Document
Pasted text.txt
Document
function initialize() {
View.initialize();
}
function onShow() as Void {
_simulationTimer = new Timer.Timer();
_simulationTimer.start(method(:refreshScreen), 1000, true);
System.println("[AdvancedView] screen opened");
}
function onHide() as Void {
if (_simulationTimer != null) {
_simulationTimer.stop();
_simulationTimer = null;
}
// Reset alert state
_alertStartTime = null;
_lastAlertTime = 0;
_pendingSecondVibe = false;
}
function onUpdate(dc as Dc) as Void {
// Check cadence zone for vibration alerts
checkCadenceZone();
// Check for pending second vibration
checkPendingVibration();
View.onUpdate(dc);
// Draw all the elements
drawElements(dc);
}
function refreshScreen() as Void {
var info = Activity.getActivityInfo();
var app = getApp();
if (info != null && info.currentCadence != null) {
app.updateCadenceHistory(info.currentCadence.toFloat());
}
WatchUi.requestUpdate();
}this funchin ok
function checkPendingVibration() as Void {
if (!_pendingSecondVibe) {
return;
}
// If user turned vibration off before second buzz plays, cancel it
if (!isHapticEnabled()) {
_pendingSecondVibe = false;
return;
}
var currentTime = System.getTimer();
if (currentTime >= _secondVibeTime) {
if (Attention has :vibrate) {
var vibeData = [new Attention.VibeProfile(50, 200)];
Attention.vibrate(vibeData);
}
_pendingSecondVibe = false;
}
}
function isHapticEnabled() as Boolean {
var app = getApp();
// Change this getter name if your app uses a different one
if (app has :getVibrationEnabled) {
return app.getVibrationEnabled();
}
// Safe fallback if setting does not exist yet
return true;
} what about here
give the update code
if (Attention has :vibrate) {
// First vibration
var vibeData = [new Attention.VibeProfile(50, 200)];
Attention.vibrate(vibeData);
// Schedule second vibration after 240ms
_pendingSecondVibe = true;
_secondVibeTime = System.getTimer() + 240;
}
}
class AdvancedView extends WatchUi.View {
const MAX_BARS = 280;
const MAX_CADENCE_DISPLAY = 200;
// // Cadence zone colours
// const COLOR_BELOW_FAR = 0x969696; // grey
// const COLOR_BELOW_NEAR = 0x0CC0DF; // blue
// const COLOR_IN_ZONE = 0x00BF63; // green
// const COLOR_ABOVE_NEAR = 0xFF751F; // orange
// const COLOR_ABOVE_FAR = 0xFF0000; // red
const COLOR_BELOW = 0xFF0000; // red
const COLOR_IN_ZONE = 0x00BF63; // green
const COLOR_TEXT_MUTED = 0x969696;
const COLOR_CHART_BORDER = 0x969696;
private var _simulationTimer;
// Vibration alert tracking (no extra timers needed!)
private var _lastZoneState = 0; // -1 = below, 0 = inside, 1 = above
private var _alertStartTime = null;
private var _alertDuration = 180000; // 3 minutes in milliseconds
private var _alertInterval = 30000; // 30 seconds in milliseconds
private var _lastAlertTime = 0;
private var _pendingSecondVibe = false;
private var _secondVibeTime = 0;
function initialize() {
View.initialize();
}
function onShow() as Void {
_simulationTimer = new Timer.Timer();
_simulationTimer.start(method(:refreshScreen), 1000, true);
System.println("[AdvancedView] screen opened");
}
function onHide() as Void {
if (_simulationTimer != null) {
_simulationTimer.stop();
_simulationTimer = null;
}
// Reset alert state
_alertStartTime = null;
_lastAlertTime = 0;
}
function onUpdate(dc as Dc) as Void {
// Check cadence zone alerts
checkCadenceZone();
View.onUpdate(dc);
// Draw all UI elements
drawElements(dc);
}
function refreshScreen() as Void {
var info = Activity.getActivityInfo();
var app = getApp();
if (info != null && info.currentCadence != null) {
app.updateCadenceHistory(info.currentCadence.toFloat());
}
WatchUi.requestUpdate();
}
function isHapticEnabled() as Boolean {
var app = getApp();
// Check if vibration setting exists
if (app has :getVibrationEnabled) {
return app.getVibrationEnabled();
}
// Default fallback
return true;
}
function triggerSingleVibration() as Void {
if (!isHapticEnabled()) {
return;
}
if (Attention has :vibrate) {
var vibeData = [
new Attention.VibeProfile(50, 200)
];
Attention.vibrate(vibeData);
}
}
function triggerSingleVibration() as Void {
if (!isHapticEnabled()) {
return;
}
if (Attention has :vibrate) {
var vibeData = [new Attention.VibeProfile(50, 200)];
Attention.vibrate(vibeData);
}
}
// function triggerDoubleVibration() as Void {
// if (!isHapticEnabled()) {
// _pendingSecondVibe = false;
// return;
// }
if (Attention has :vibrate) {
// First vibration
var vibeData = [new Attention.VibeProfile(50, 200)];
Attention.vibrate(vibeData);
// Schedule second vibration after 240ms
_pendingSecondVibe = true;
_secondVibeTime = System.getTimer() + 240;
}
}update version
Pasted text.txt
Document
in here give me one by one what to do
// Trigger alerts on zone crossing
if (newZoneState != _lastZoneState) {
if (newZoneState == -1) {
// Below minimum - start alert cycle
_alertStartTime = System.getTimer();
_lastAlertTime = System.getTimer();
triggerSingleVibration();
// } else if (newZoneState == 1) {
// // Above maximum - start alert cycle
// _alertStartTime = System.getTimer();
// _lastAlertTime = System.getTimer();
// // triggerDoubleVibration();
} else {
// Back in zone - stop alerts
_alertStartTime = null;
_lastAlertTime = 0;
}
_lastZoneState = newZoneState;
} else {
// Still out of zone - check if we need to alert again
checkAndTriggerAlerts();
} this has issues
function checkAndTriggerAlerts() as Void {
var app = Application.getApp();
var isVibrationOn = app.getVibrationEnabled();
// Only check if we're in an alert period
if (_alertStartTime == null) {
return;
}
var currentTime = System.getTimer();
var elapsed = currentTime - _alertStartTime;
// Stop alerting after 3 minutes
if (elapsed >= _alertDuration) {
_alertStartTime = null;
_lastAlertTime = 0;
return;
}
// Check if it's time for next alert
var timeSinceLastAlert = currentTime - _lastAlertTime;
if (timeSinceLastAlert >= _alertInterval) {
_lastAlertTime = currentTime;
// Only alert when cadence is too low
if (_lastZoneState == -1) {
WatchUi.pushView(
new CadenceAlertView("Increase Cadence", isVibrationOn),
new CadenceAlertDelegate(),
WatchUi.SLIDE_IMMEDIATE
);
if (isVibrationOn) {
triggerSingleVibration();
}
}
}
} tthis also re d
Pasted text.txt
Document
check now
Pasted text.txt
Document
no erros
function checkCadenceZone() as Void {
// Alert mappings:
// - Below target cadence -> single vibration
// - Above target cadence -> double vibration
// - Back inside zone -> stop alert cycle
var info = Activity.getActivityInfo();
var app = getApp();
var minZone = app.getCalculatedMinCadence();
//var maxZone = app.getCalculatedMaxCadence();
// Determine zone state
var newZoneState = 0;
if (info != null && info.currentCadence != null) {
var c = info.currentCadence;
if (c < minZone) {
newZoneState = -1;
} else {
newZoneState = 0;
}
}
// // Trigger alerts on zone crossing
// if (newZoneState != _lastZoneState) {
// if (newZoneState == -1) {
// // Below minimum - start alert cycle
// _alertStartTime = System.getTimer();
// _lastAlertTime = System.getTimer();
// triggerSingleVibration();
// // } else if (newZoneState == 1) {
// // // Above maximum - start alert cycle
// // _alertStartTime = System.getTimer();
// // _lastAlertTime = System.getTimer();
// // // triggerDoubleVibration();
// } else {
// // Back in zone - stop alerts
// _alertStartTime = null;
// _lastAlertTime = 0;
// }
// _lastZoneState = newZoneState;
// } else {
// // Still out of zone - check if we need to alert again
// checkAndTriggerAlerts();
// }
// Trigger alerts on zone crossing
if (newZoneState != _lastZoneState) {
if (newZoneState == -1) {
// Below target cadence
_alertStartTime = System.getTimer();
_lastAlertTime = System.getTimer();
triggerSingleVibration();
} else {
// Back inside range
_alertStartTime = null;
_lastAlertTime = 0;
}
_lastZoneState = newZoneState;
} else {
// Still outside range
checkAndTriggerAlerts();
}
} this?
import Toybox.WatchUi;
import Toybox.System;
import Toybox.Application;
import Toybox.Graphics;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(
new SimpleView(),
new SimpleViewDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// Handles the SELECT/START button
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceTargetView");
WatchUi.switchToView(
new CadenceTargetView(),
new CadenceTargetDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button
function onNextPage() as Boolean {
System.println("Down button pressed");
WatchUi.pushView(
new BarChartSettingsMenuView(),
new BarChartSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the UP button
function onPreviousPage() as Boolean {
System.println("Up button pressed");
WatchUi.pushView(
new SummarySettingsMenuView(),
new SummarySettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
}
import Toybox.WatchUi;
import Toybox.System;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(
new SimpleView(),
new SimpleViewDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// Handles the SELECT/START button
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceTargetView");
WatchUi.switchToView(
new CadenceTargetView(),
new CadenceTargetDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button
function onNextPage() as Boolean {
System.println("Down button pressed");
WatchUi.pushView(
new BarChartSettingsMenuView(),
new BarChartSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the UP button
function onPreviousPage() as Boolean {
System.println("Up button pressed");
WatchUi.pushView(
new SummarySettingsMenuView(),
new SummarySettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
} all the fumchions are red
// import Toybox.WatchUi;
// import Toybox.System;
// import Toybox.Application;
// import Toybox.Graphics;
// class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
// function initialize() {
// BehaviorDelegate.initialize();
// }
// // Handles the BACK button
// function onBack() as Boolean {
// System.println("Back pressed: Returning to main view");
// WatchUi.pushView(
// new SimpleView(),
// new SimpleViewDelegate(),
// WatchUi.SLIDE_DOWN
// );
// return true;
// }
// // Handles the SELECT/START button
// function onSelect() as Boolean {
// System.println("Select pressed: Opening CadenceTargetView");
// WatchUi.switchToView(
// new CadenceTargetView(),
// new CadenceTargetDelegate(),
// WatchUi.SLIDE_UP
// );
// return true;
// }
// // Handles the DOWN button
// function onNextPage() as Boolean {
// System.println("Down button pressed");
// WatchUi.pushView(
// new BarChartSettingsMenuView(),
// new BarChartSettingsMenuDelegate(),
// WatchUi.SLIDE_UP
// );
// return true;
// }
// // Handles the UP button
// function onPreviousPage() as Boolean {
// System.println("Up button pressed");
// WatchUi.pushView(
// new SummarySettingsMenuView(),
// new SummarySettingsMenuDelegate(),
// WatchUi.SLIDE_DOWN
// );
// return true;
// }
// }
import Toybox.WatchUi;
import Toybox.System;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(
new SimpleView(),
new SimpleViewDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// Handles the SELECT/START button
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceTargetView");
WatchUi.switchToView(
new CadenceTargetView(),
new CadenceTargetDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button
function onNextPage() as Boolean {
System.println("Down button pressed");
WatchUi.pushView(
new BarChartSettingsMenuView(),
new BarChartSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the UP button
function onPreviousPage() as Boolean {
System.println("Up button pressed");
WatchUi.pushView(
new SummarySettingsMenuView(),
new SummarySettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
}
import Toybox.Graphics;
import Toybox.WatchUi;
import Toybox.Application;
class CadenceTargetView extends WatchUi.View {
function initialize() {
View.initialize();
}
function onUpdate(dc as Dc) as Void {
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
dc.clear();
var width = dc.getWidth();
var height = dc.getHeight();
var app = Application.getApp() as GarminApp;
var targetCadence = app.getTargetCadence();
// Title
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
height / 3,
Graphics.FONT_MEDIUM,
"Target Cadence",
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
// Cadence Number
dc.setColor(Graphics.COLOR_GREEN, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
height / 2,
Graphics.FONT_NUMBER_HOT,
targetCadence.toString(),
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
// Unit
dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_TRANSPARENT);
dc.drawText(
width / 2,
(height / 2) + 50,
Graphics.FONT_SMALL,
"spm",
Graphics.TEXT_JUSTIFY_CENTER | Graphics.TEXT_JUSTIFY_VCENTER
);
}
}adence target viwe
import Toybox.WatchUi;
import Toybox.System;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(
new SimpleView(),
new SimpleViewDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// Handles the SELECT/START button
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceTargetView");
WatchUi.switchToView(
new CadenceTargetView(),
new CadenceTargetDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button
function onNextPage() as Boolean {
System.println("Down button pressed");
WatchUi.pushView(
new BarChartSettingsMenuView(),
new BarChartSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the UP button
function onPreviousPage() as Boolean {
System.println("Up button pressed");
WatchUi.pushView(
new SummarySettingsMenuView(),
new SummarySettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
} only issue in cadance settings manudele other all good
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
import Toybox.Application;
class BarChartSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean{
System.println("Back pressed: Returning to main view");
WatchUi.pushView(new SimpleView(), new SimpleViewDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
// Handles the SELECT/START button (or screen tap)
function onSelect() as Boolean {
System.println("Select button pressed: Opening bar chart settings");
WatchUi.pushView(new BarChartSelectView(), new SelectBarChartDelegate(), WatchUi.SLIDE_LEFT);
return true;
}
// Handles the DOWN button (or swipe up)
function onNextPage() as Boolean {
System.println("Down button pressed");
// Push the cadence settings view
WatchUi.pushView(new SummarySettingsMenuView(), new SummarySettingsMenuDelegate(), WatchUi.SLIDE_UP);
return true;
}
// Handles the UP button (or swipe down)
function onPreviousPage() as Boolean {
System.println("Up button pressed");
// Push the profile settings view
WatchUi.pushView(new CadenceSettingsMenuView(), new CadenceSettingsMenuDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
} rhis one a nother ine for barchartmenu deleteg
import Toybox.WatchUi;
import Toybox.System;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(
SimpleView(),
SimpleViewDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// Handles the SELECT/START button
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceTargetView");
WatchUi.switchToView(
CadenceTargetView(),
CadenceTargetDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button
function onNextPage() as Boolean {
System.println("Down button pressed");
WatchUi.pushView(
BarChartSettingsMenuView(),
BarChartSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the UP button
function onPreviousPage() as Boolean {
System.println("Up button pressed");
WatchUi.pushView(
SummarySettingsMenuView(),
SummarySettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
}
wehy use new
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
import Toybox.Application;
class ProfileSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.pushView(new SimpleView(), new SimpleViewDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
// Handles the SELECT/START button (or screen tap)
function onSelect() as Boolean {
System.println("Select/Tap pressed: toggle summary on/off ");
// Goes to profile settings
pushProfileMenu();
return true;
}
// Handles the DOWN button (or swipe up)
function onNextPage() as Boolean {
System.println("Down button pressed");
// Push the cadence settings view
WatchUi.pushView(new CadenceSettingsMenuView(), new CadenceSettingsMenuDelegate(), WatchUi.SLIDE_UP);
return true;
}
// Handles the UP button (or swipe down)
function onPreviousPage() as Boolean {
System.println("Up button pressed");
// Push the profile settings view
WatchUi.pushView(new SummarySettingsMenuView(), new SummarySettingsMenuDelegate(), WatchUi.SLIDE_DOWN);
return true;
}
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);
}
}thses are other once are they using it?
what codes do you want to chewkc i can give all the code u want
import Toybox.Lang;
import Toybox.WatchUi;
import Toybox.System;
import Toybox.Application;
class CadenceTargetDelegate extends WatchUi.BehaviorDelegate {
private var _target as Number;
function initialize() {
BehaviorDelegate.initialize();
var app = Application.getApp() as GarminApp;
_target = app.getTargetCadence();
}
function onBack() as Boolean {
WatchUi.popView(WatchUi.SLIDE_DOWN);
return true; CadenceTargetDelegate.mc
}
function onSelect() as Boolean {
var app = Application.getApp() as GarminApp;
app.setTargetCadence(_target);
WatchUi.popView(WatchUi.SLIDE_UP);
return true;
}
function onKey(keyEvent as WatchUi.KeyEvent) as Boolean {
var key = keyEvent.getKey();
var app = Application.getApp() as GarminApp;
if (key == WatchUi.KEY_UP) {
_target = _target + 1;
app.setTargetCadence(_target);
WatchUi.requestUpdate();
return true;
}
if (key == WatchUi.KEY_DOWN) {
_target = _target - 1;
app.setTargetCadence(_target);
WatchUi.requestUpdate();
return true;
}
return false;
}
}
import Toybox.Lang;
import Toybox.WatchUi;
import Toybox.System;
import Toybox.Application;
class CadenceTargetDelegate extends WatchUi.BehaviorDelegate {
private var _target as Number;
function initialize() {
BehaviorDelegate.initialize();
var app = Application.getApp() as GarminApp;
_target = app.getTargetCadence();
}
function onBack() as Boolean {
WatchUi.popView(WatchUi.SLIDE_DOWN);
return true;
}
function onSelect() as Boolean {
var app = Application.getApp() as GarminApp;
app.setTargetCadence(_target);
WatchUi.popView(WatchUi.SLIDE_UP);
return true;
}
function onKey(keyEvent as WatchUi.KeyEvent) as Boolean {
var key = keyEvent.getKey();
var app = Application.getApp() as GarminApp;
if (key == WatchUi.KEY_UP) {
_target = _target + 1;
app.setTargetCadence(_target);
WatchUi.requestUpdate();
return true;
}
if (key == WatchUi.KEY_DOWN) {
_target = _target - 1;
app.setTargetCadence(_target);
WatchUi.requestUpdate();
return true;
}
return false;
}
}
import Toybox.WatchUi;
import Toybox.System;
class CadenceSettingsMenuDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
// Handles the BACK button
function onBack() as Boolean {
System.println("Back pressed: Returning to main view");
WatchUi.switchToView(
new SimpleView(),
new SimpleViewDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
// Handles the SELECT/START button
function onSelect() as Boolean {
System.println("Select pressed: Opening CadenceTargetView");
WatchUi.pushView(
new CadenceTargetView(),
new CadenceTargetDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the DOWN button
function onNextPage() as Boolean {
System.println("Down button pressed");
WatchUi.switchToView(
new BarChartSettingsMenuView(),
new BarChartSettingsMenuDelegate(),
WatchUi.SLIDE_UP
);
return true;
}
// Handles the UP button
function onPreviousPage() as Boolean {
System.println("Up button pressed");
WatchUi.switchToView(
new SummarySettingsMenuView(),
new SummarySettingsMenuDelegate(),
WatchUi.SLIDE_DOWN
);
return true;
}
}
on the cadavce taget rage wen we put 107 ehat it shopud show
i need push to my branch now
discription and summary i need to right tell mestuff to right
Changes Made
Added targetCadence setting and removed old min/max cadence storage
Added dynamic cadence range calculation using ±5%
Created CadenceTargetView and CadenceTargetDelegate
Removed old cadence min/max views and picker-based cadence flow
Updated CadenceSettingsMenuDelegate navigation flow
Refactored cadence alert system to only alert for low cadence
Removed double vibration and high cadence alert logic
Simplified cadence graph colour system to red/green only
Updated cadence zone checks and CQ calculations to use calculated cadence range
Updated summary and advanced views to display calculated cadence range
Removed obsolete cadence alert states, colours, and unused logic
Cleaned up legacy cadence-related code and references
Changes Made
Added targetCadence setting and removed old min/max cadence storage
Added dynamic cadence range calculation using ±5%
Created CadenceTargetView and CadenceTargetDelegate
Removed old cadence min/max views and picker-based cadence flow
Updated CadenceSettingsMenuDelegate navigation flow
Refactored cadence alert system to only alert for low cadence
Removed double vibration and high cadence alert logic
Simplified cadence graph colour system to red/green only
Updated cadence zone checks and CQ calculations to use calculated cadence range
Updated summary and advanced views to display calculated cadence range
Removed obsolete cadence alert states, colours, and unused logic
Cleaned up legacy cadence-related code and references
Fixed the Workout Summary issue where cadence and quality were showing as `--` and `N/A`. Added cadence debugging and validated CQ calculation and summary display after workout completion.
BUGFIX: Fix cadence and quality display in Workout Summary
Consolidate cadence alert logic and stabilize view timers across the app. AdvancedView and SimpleView now run a single background refresh timer (preventing duplicate timers / timer leaks), move cadence-zone checking into standalone functions (checkCadenceZone / checkAndTriggerAlerts), and ensure alerts trigger even when views are hidden. Chart rendering and pace/time formatting were cleaned up and simplified; cadence zone color logic simplified. CadenceAlertView signature updated to accept an extra view identifier, and usages updated accordingly. Minor tweaks in GarminApp (commented deprecated session start vars) and SelectProfileDelegate (removed hardcoded fallback height). Small fix in VibrationView to ensure proper view pop behavior.
Update/cadance settings
Introduce a user-toggleable summary flow: add SummaryPromptView and SummaryPromptDelegate to prompt the user whether to view the summary after saving an activity, and persist the preference in GarminApp (PROP_SUMMARY_ENABLED, getters/setters, load/save). Update SimpleViewDelegate to show the SummaryView only when the setting is enabled (otherwise return to SimpleView). Add summary and cadence icons and register them in resources/drawables.xml. Improve Settings views: SummarySettingsMenuView and CadenceSettingsMenuView show new icons and updated layout; CadenceTargetView layout/typography tweaks. Overall this wires up UI, persistence, and behavior for optional summary display. - summary view backend has not been deployed .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary on/off