Skip to content

Commit

Permalink
Adding logic to make the current secondary zone the main watch zone, …
Browse files Browse the repository at this point in the history
…and adding timezone data for the Azores
  • Loading branch information
dgnuff committed Oct 8, 2023
1 parent 6fbda64 commit a54708a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
24 changes: 17 additions & 7 deletions apps/travelwatch/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var lastDow;
var drawTimeout;
var watchIndex;
var zoneIndex;

Graphics.prototype.setFontOxaniumTime = function() {
Expand Down Expand Up @@ -208,7 +209,7 @@ function ComputeOffsetAndChange(first, last)

function draw()
{
var date = GetDate(0);
var date = GetDate(watchIndex);

var y = 66;

Expand Down Expand Up @@ -286,22 +287,31 @@ function draw()

function onTouch(button, xy)
{
if (zones.length == 2)
if (xy.type == 2)
{
// If we only have one extra timezone, there's nothing to do. Save the cost of
// a wasted draw call.
return;
// Long touch: make the current selected travel zone the main watch zone.
watchIndex = zoneIndex;
// Don't need to do anything else, the remaining logic will sort out the travel zone
}
if (++zoneIndex >= zones.length)
else if (zones.length == 2)
{
zoneIndex = 1;
// Short touch and we only have two zones. Nothing to do, so return immediately
return;
}
do
{
if (++zoneIndex >= zones.length)
{
zoneIndex = 1;
}
} while (zoneIndex == watchIndex);
clearTimeout(drawTimeout);
draw();
}

// Clear the screen once, at startup
g.clear().setColor(0, 0, 0).fillRect(0, 0, 176, 176);
watchIndex = 0;
zoneIndex = 1;

Bangle.loadWidgets();

Check warning on line 317 in apps/travelwatch/app.js

View workflow job for this annotation

GitHub Actions / build

Clock travelwatch file calls loadWidgets before setUI (clock widget/etc won't be aware a clock app is running)
Expand Down
1 change: 1 addition & 0 deletions apps/travelwatch/custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
{ "name": "America/Chicago", "offset": -360, "dst_month": 3, "dst_date": 8, "dst_dow": 0, "dst_hour": 2, "std_month": 11, "std_date": 1, "std_dow": 0, "std_hour": 2 },
{ "name": "America/New_York", "offset": -300, "dst_month": 3, "dst_date": 8, "dst_dow": 0, "dst_hour": 2, "std_month": 11, "std_date": 1, "std_dow": 0, "std_hour": 2 },
{ "name": "America/Sao_Paulo", "offset": -180, "dst_month": 0, "dst_date": 0, "dst_dow": 0, "dst_hour": 0, "std_month": 0, "std_date": 0, "std_dow": 0, "std_hour": 0 },
{ "name": "Atlantic/Azores", "offset": -60, "dst_month": 3, "dst_date": -7, "dst_dow": 0, "dst_hour": 0, "std_month": 10, "std_date": -7, "std_dow": 0, "std_hour": 1 },
{ "name": "Europe/London", "offset": 0, "dst_month": 3, "dst_date": -7, "dst_dow": 0, "dst_hour": 1, "std_month": 10, "std_date": -7, "std_dow": 0, "std_hour": 2 },
{ "name": "Europe/Lisbon", "offset": 0, "dst_month": 3, "dst_date": -7, "dst_dow": 0, "dst_hour": 1, "std_month": 10, "std_date": -7, "std_dow": 0, "std_hour": 2 },
{ "name": "Europe/Berlin", "offset": 60, "dst_month": 3, "dst_date": -7, "dst_dow": 0, "dst_hour": 2, "std_month": 10, "std_date": -7, "std_dow": 0, "std_hour": 3 },
Expand Down
2 changes: 1 addition & 1 deletion apps/travelwatch/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "id": "travelwatch",

Check warning on line 1 in apps/travelwatch/metadata.json

View workflow job for this annotation

GitHub Actions / build

App travelwatch has no ChangeLog
"name": "Travel Watch",
"icon": "app.png",
"version":"1.15",
"version":"1.16",
"description": "Watch face that shows world wide time for travelers",
"tags": "clock",
"type": "clock",
Expand Down

0 comments on commit a54708a

Please sign in to comment.