Merge branch 'espruino:master' into master

master
Peer David 2022-02-11 15:32:07 +01:00 committed by GitHub
commit eebec3b832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 153 additions and 131 deletions

2
apps/ac_ac/ChangeLog.txt Normal file
View File

@ -0,0 +1,2 @@
0.01: initial release
1.00: first official release (also fixes bug in Customizer)

View File

@ -321,7 +321,7 @@
function chosenClockHands () {
switch (ClockHands) {
case 'simple': return "require('https://raw.githubusercontent.com/rozek/banglejs-2-simpled-clock-hands/main/ClockHands.js')"
case 'simple': return "require('https://raw.githubusercontent.com/rozek/banglejs-2-simple-clock-hands/main/ClockHands.js')"
case 'rounded': return "require('https://raw.githubusercontent.com/rozek/banglejs-2-rounded-clock-hands/main/ClockHands.js')"
case 'hollow': return "require('https://raw.githubusercontent.com/rozek/banglejs-2-hollow-clock-hands/main/ClockHands.js')"
case 'custom': return "require('" + ClockHandsURL + "')"

View File

@ -1,7 +1,7 @@
{ "id": "ac_ac",
"name": "A Configurable Analog Clock",
"shortName":"Configurable Clock",
"version":"0.03",
"version":"1.00",
"description": "AC-AC, a highly customizable analog clock with several clock faces, hands and complications to choose from",
"icon": "app-icon.png",
"type": "clock",

View File

@ -10,6 +10,9 @@
<select id="languages" class="form-select">
</select>
</div>
<div class="form-group">
<input id="translations" type="checkbox" /> <label for="translations">Add common language translations like "Yes", "No", "On", "Off"<br/><i>(Not recommended. For translations use the option under <code>More...</code> in the app loader.</i></label>
</div>
<p>Then click <button id="upload" class="btn btn-primary">Upload</button></p>
<script src="../../core/lib/customize.js"></script>
@ -106,12 +109,18 @@ exports = { name : "en_GB", currencySym:"£",
const lang = languageSelector.options[languageSelector.selectedIndex].value;
console.log(`Language ${lang}`);
const translations = document.getElementById('translations').checked;
console.log(`Translations: ${translations}`);
const locale = locales[lang];
if (!locale) {
alert(`Language ${lang} not found!`);
return;
}
if (!translations)
locale.trans = null;
const codePageName = "ISO8859-1";
if (locale.codePage)
codePageName = locale.codePage;

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Change color from red->yellow to ease readability (fix #710)
0.03: Color/positioning change to allow it to work with Bangle.js 1 (although not pretty)

View File

@ -17,7 +17,7 @@
<li>Go to <a href="https://umap.openstreetmap.fr/en/">https://umap.openstreetmap.fr/en/</a></li>
<li>Create a map</li>
<li>Draw a polyline (right hand side)</li>
<li>Embed and share (leb>ft hand side)</li>
<li>Embed and share (left hand side)</li>
<li>Download data as KML</li>
</ul>
@ -106,13 +106,15 @@ document.getElementById("upload").addEventListener("click", function() {
var app = `${js}
var gcoords = new Uint8Array(coords.length);
var coordDistance = new Uint16Array(coords.length/2);
var colHL = g.theme.dark ? "#FF0" : "#00F";
var W = g.getWidth(), H = g.getHeight();
var PT_DISTANCE = 30; // distance to a point before we consider it complete
function toScr(p) {
return {
x : 10 + (p.x-min.x)*100/(max.x-min.x),
y : 230 - (p.y-min.y)*100/(max.y-min.y)
y : H - 10 - (p.y-min.y)*100/(max.y-min.y)
};
}
@ -141,37 +143,40 @@ var currentDist = 0;
function drawMap() {
g.clearRect(0,0,239,120);
var R = W*180/240;
var L = W*50/240;
g.clearRect(0,0,W,H/2);
g.setFontAlign(0,0);
g.setColor(1,1,0);
g.setColor(colHL);
g.setFontVector(40);
g.drawString((currentDist===undefined)?"?":(Math.round(currentDist)+"m"), 160, 30);
g.setColor(1,1,1);
g.drawString((currentDist===undefined)?"?":(Math.round(currentDist)+"m"), R, 30);
g.setColor(g.theme.fg);
g.setFont("6x8",2);
g.drawString(Math.round(totalDistance)+"m", 160, 70);
g.drawString((nextPtIdx/2)+"/"+coordDistance.length, 50, 20);
g.drawString(Math.round(totalDistance)+"m", R, 70);
g.drawString((nextPtIdx/2)+"/"+coordDistance.length, L, 20);
if (!fix.fix) {
g.setColor(1,1,0);
g.drawString("No GPS", 50, 50);
g.setColor(colHL);
g.drawString("No GPS", L, 50);
g.setFont("6x8",1);
g.drawString(fix.satellites+" Sats", 50, 70);
g.drawString(fix.satellites+" Sats", L, 70);
}
if (lastFix && lastFix.fix) {
g.setColor(0,0,0);
g.setColor(g.theme.bg);
g.drawCircle(lastFix.s.x,lastFix.s.y,10);
}
var c1 = g.toColor(1,1,0);
var c2 = g.toColor(0.7,0.7,0.7);
var c1 = g.toColor(colHL);
var c2 = g.toColor("#888");
for (var i=0;i<gcoords.length;i+=2)
g.setColor((i<=nextPtIdx) ? c1 : c2).fillRect(gcoords[i]-2,gcoords[i+1]-2,gcoords[i]+2,gcoords[i+1]+2);
g.setColor(1,1,0); // first part of path
g.setColor(colHL); // first part of path
g.drawPoly(new Uint8Array(gcoords.buffer, 0, nextPtIdx+2));
g.setColor(1,1,1); // remaining part of path
g.setColor(g.theme.fg); // remaining part of path
g.drawPoly(new Uint8Array(gcoords.buffer, nextPtIdx));
if (fix && fix.fix) {
g.setColor(1,1,0);
g.setColor(colHL);
g.drawCircle(fix.s.x,fix.s.y,10);
}
lastFix = fix;
@ -225,9 +230,9 @@ function arrow(r,c) {
function onCompass(m) {
if (!Bangle.isLCDOn()) return;
arrow(oldHeading,0);
arrow(oldHeading,g.theme.bg);
var heading = m.heading + nextAngle;
arrow(heading,0xF800);
arrow(heading,"#f00");
oldHeading = heading;
}

View File

@ -1,11 +1,11 @@
{
"id": "route",
"name": "Route Viewer",
"version": "0.02",
"version": "0.03",
"description": "Upload a KML file of a route, and have your watch display a map with how far around it you are",
"icon": "app.png",
"tags": "",
"supports": ["BANGLEJS"],
"supports": ["BANGLEJS","BANGLEJS2"],
"custom": "custom.html",
"storage": [
{"name":"route.app.js"},

View File

@ -188,7 +188,7 @@ function showBLEMenu() {
},
/*LANG*/'HID': {
value: Math.max(0,0 | hidV.indexOf(settings.HID)),
min: 0, max: 3,
min: 0, max: hidN.length-1,
format: v => hidN[v],
onchange: v => {
settings.HID = hidV[v];

View File

@ -1 +1,2 @@
0.01: New App!
0.02: Fix crash on start

View File

@ -90,7 +90,10 @@ if (global.sleeplog.enabled) {
var storage = require("Storage");
// read previous logfile
var log = JSON.parse(atob(storage.read(this.logfile)));
var logContent = storage.read(this.logfile) || "";
// parse previous logfile
var log = JSON.parse(logContent.length > 0 ? atob(logContent) : "[]") ;
// remove last state if it was unknown and is less then 10min ago
if (log.length > 0 && log[0][1] === 0 &&

View File

@ -2,7 +2,7 @@
"id":"sleeplog",
"name":"Sleep Log",
"shortName": "SleepLog",
"version": "0.01",
"version": "0.02",
"description": "Log and view your sleeping habits. This app derived from SleepPhaseAlarm and uses also the principe of Estimation of Stationary Sleep-segments (ESS).",
"icon": "app.png",
"type": "app",

View File

@ -144,7 +144,7 @@
<div class="form-group">
<select class="form-select form-inline" id="settings-lang" style="width: 10em">
<option value="">None (English)</option>
</select>&nbsp;&nbsp;<span>Translations (<a href="https://github.com/espruino/BangleApps/issues/1311" target="_blank">BETA - more info</a>)</span>
</select>&nbsp;&nbsp;<span>Translations (<a href="https://github.com/espruino/BangleApps/issues/1311" target="_blank">BETA - more info</a>). Any apps that are uploaded to Bangle.js after changing this will have any text automatically translated.</span>
</div>
<button class="btn" id="defaultsettings">Default settings</button>
</div>

View File

@ -10,11 +10,11 @@
{"code":"nl_NL","name":"Dutch","url":"nl_NL.json"},
{"code":"sv_SE","name":"Swedish","url":"sv_SE.json"},
{"code":"tr_TR","name":"Turkish","url":"tr_TR.json"},
{"code":"ru_RU","name":"Russian","url":"ru_RU.json"},
{"code":"ru_RU","name":"Russian","url":"ru_RU.json", "disabled":"Characters not in ISO Latin codepage"},
{"code":"pt_PT","name":"Portuguese","url":"pt_PT.json"},
{"code":"bg_BG","name":"Bulgarian","url":"bg_BG.json"},
{"code":"bg_BG","name":"Bulgarian","url":"bg_BG.json", "disabled":"Characters not in ISO Latin codepage"},
{"code":"da_DA","name":"Danish","url":"da_DA.json"},
{"code":"el_EL","name":"Greek","url":"el_EL.json"},
{"code":"el_EL","name":"Greek","url":"el_EL.json", "disabled":"Characters not in ISO Latin codepage"},
{"code":"et_ET","name":"Estonian","url":"et_ET.json"},
{"code":"lt_LT","name":"Lithuanian","url":"lt_LT.json"},
{"code":"lv_LV","name":"Latvian","url":"lv_LV.json"},

View File

@ -179,6 +179,7 @@ window.addEventListener('load', (event) => {
} catch(e) {
console.error("lang/index.json Corrupted", e);
}
languages = languages.filter( l=> l.disabled===undefined );
function reloadLanguage() {
LANGUAGE = undefined;