adds updated server location, ambient mode and logo

- logo.jpg for loading
- ambient mode now shows sun, earth and calendar entries
- server location now updated to static longitude
This commit is contained in:
Raphael Maenle
2020-05-16 17:24:16 +02:00
parent d6732ea134
commit cf8af88eea
7 changed files with 180 additions and 51 deletions

View File

@ -66,7 +66,7 @@ var eventsTimeStamp = 0;
}
function getJSON() {
var downloadRequest = new tizen.DownloadRequest('http://192.168.68.103.xip.io:1234/userinfo/107971745944668140075/calendarevents.json', 'downloads');
var downloadRequest = new tizen.DownloadRequest('https://longitudecalendar.com/userinfo/107971745944668140075/calendarevents.json', 'downloads');
tizen.systeminfo.getPropertyValue('NETWORK', function(networkInfo) {
if (networkInfo.networkType === 'NONE') {
console.log('Network connection is not available.Download is not possible.');
@ -136,11 +136,22 @@ var eventsTimeStamp = 0;
hardStart = false;
if(hardStop == undefined)
hardStop= false;
context.save();
context.beginPath();
seperation = 5;
// if arc size smaller than separation for circles or circle,
// draw a circle
var arcsize = 0;
if(endAngle < startAngle) {
arcsize = 360 - startAngle + endAngle;
} else {
arcsize = endAngle - startAngle;
}
if(arcsize < 2*seperation) {
renderCircle(context, polToCart(radius, startAngle + arcsize /2 ), 9, color);
return;
}
if(!hardStart)
startAngle += seperation;
@ -153,6 +164,12 @@ var eventsTimeStamp = 0;
if(endAngle<0)
endAngle += 360;
// else draw an arc and two circles
context.save();
context.beginPath();
context.arc(center.x, center.y, radius, startAngle * Math.PI / 180., endAngle * Math.PI / 180.);
context.fillStyle = color;
context.strokeStyle = color;
@ -358,11 +375,9 @@ var eventsTimeStamp = 0;
edge = document.body.clientWidth / 2 - thickness / 2 - 2;
for(var event in events.events){
var startedBeforeToday = false;
var endsAfterToday = false;
var e = events.events[event];
// check if not today
if(e.startDateTime.date.year != tizen.time.getCurrentDateTime().getFullYear() ||
e.startDateTime.date.month != tizen.time.getCurrentDateTime().getMonth() + 1 ||
@ -477,9 +492,32 @@ var eventsTimeStamp = 0;
// Update the content of the watch every second
setInterval(function() {
drawWatchContent();
updateCalendar(60000);
// updateCalendar(60000);
}, 1000);
}
window.onload = init;
}());
}());
document.addEventListener('ambientmodechanged', function(ev) {
var mode = ev.detail.ambientMode;
if (mode == true) {
/* Change the UI for ambient mode */
//updateAmbientWatchFaceDOM(); // function to rearange DOM for AOD mode
updateTime();
} else {
/* Change the UI for normal mode */
// updateNormalWatchFaceDOM(); // function to rearange DOM for AOD mode
updateTime();
}
});
document.addEventListener('timetick', function(ev) {
/* Update the UI */
drawWatchContent();
});