From d03749ed92fd10fa690a7e79c6a5da857a826297 Mon Sep 17 00:00:00 2001 From: 7kasper <7kasper@users.noreply.github.com> Date: Sun, 26 Dec 2021 17:14:08 +0100 Subject: [PATCH 01/45] Initial release of presentor app. --- apps/presentor/app.js | 277 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 apps/presentor/app.js diff --git a/apps/presentor/app.js b/apps/presentor/app.js new file mode 100644 index 000000000..d9b032bd0 --- /dev/null +++ b/apps/presentor/app.js @@ -0,0 +1,277 @@ +// Presentor by 7kasper +// Licensed under MIT. +// Version 2.1 + +const MouseReport = new Uint8Array([ + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x02, // USAGE (Mouse) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, 0x01, // REPORT_ID (1) + 0x09, 0x01, // USAGE (Pointer) + 0xa1, 0x00, // COLLECTION (Physical) + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x05, // USAGE_MAXIMUM (Button 5) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x95, 0x05, // REPORT_COUNT (5) + 0x75, 0x01, // REPORT_SIZE (1) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x95, 0x01, // REPORT_COUNT (1) + 0x75, 0x03, // REPORT_SIZE (3) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x09, 0x38, // USAGE (Wheel) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x03, // REPORT_COUNT (3) + 0x81, 0x06, // INPUT (Data,Var,Rel) + 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) + 0x0a, 0x38, 0x02, // USAGE (AC Pan) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x06, // INPUT (Data,Var,Rel) + 0xc0, // END_COLLECTION + 0xc0, // END_COLLECTION + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x85, 0x02, // REPORT_ID (2) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x01, // INPUT (Cnst,Ary,Abs) + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0x73, // USAGE_MAXIMUM (Keyboard F24) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x73, // LOGICAL_MAXIMUM (115) + 0x95, 0x05, // REPORT_COUNT (5) + 0x75, 0x08, // REPORT_SIZE (8) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0 // END_COLLECTION +]); + +const MouseButton = { + NONE : 0, + LEFT : 1, + RIGHT : 2, + MIDDLE : 4, + BACK : 8, + FORWARD: 16 +}; + +const kb = require("ble_hid_keyboard"); + +function drawMain() { + g.clear(); + E.showMessage('Presentor'); +} + +let HIDenabled = true; +let lastx = 0; +let lasty = 0; +let timeoutId = -1; +let holding = false; +let timeoutHolding = -1; + +let homeRoll = 0; +let homePitch = 0; + +let trackPadMode = false; + +let mCal = 0; + +let clearToSend = true; +let mttl = 0; +let cttl = 0; + +NRF.setServices(undefined, { hid : MouseReport }); +NRF.on('HID', function() { + HIDenabled = true; +}); + +function moveMouse(x,y,b,wheel,hwheel,callback) { + if (!HIDenabled) return; + if (!b) b = 0; + if (!wheel) wheel = 0; + if (!hwheel) hwheel = 0; + NRF.sendHIDReport([1,b,x,y,wheel,hwheel,0,0], function() { + if (callback) callback(); + }); +} + +function getSign(x) { + return ((x > 0) - (x < 0)) || +x; +} + +function scroll(wheel,hwheel,callback) { + moveMouse(0,0,0,wheel,hwheel,callback); +} + +// Single click a certain button (immidiatly release). +function clickMouse(b, callback) { + if (!HIDenabled) return; + NRF.sendHIDReport([1,b,0,0,0,0,0,0], function() { + NRF.sendHIDReport([1,0,0,0,0,0,0,0], function() { + if (callback) callback(); + }); + }); +} + +function pressKey(keyCode, modifiers, callback) { + if (!HIDenabled) return; + if (!modifiers) modifiers = 0; + NRF.sendHIDReport([2, modifiers,0,keyCode,0,0,0,0], function() { + NRF.sendHIDReport([2,0,0,0,0,0,0,0], function() { + if (callback) callback(); + }); + }); +} + +function handleAcc(acc) { + let rRoll = acc.y * -50; + let rPitch = acc.x * -100; + if (mCal > 10) { + //console.log("x: " + (rRoll - homeRoll) + " y:" + (rPitch - homePitch)); + moveMouse(acc.y * -50 - homeRoll, acc.x * -100 - homePitch); + } else { + //console.log("homeroll: " +homeRoll +"homepitch: " + homePitch); + homeRoll = rRoll * 0.7 + homeRoll * 0.3; + homePitch = rPitch * 0.7 + homePitch * 0.3; + mCal = mCal + 1; + } +} +Bangle.on('lock', function(on) { + if (on && holding) { + Bangle.setLocked(false); + Bangle.setLCDPower(1); + } +}); + +function startHolding() { + pressKey(kb.KEY.F10); + holding = true; + Bangle.buzz(); + E.showMessage('Holding'); + Bangle.on('accel', handleAcc); + Bangle.setLCDPower(1); +} +function stopHolding() { + clearTimeout(timeoutId); + if (holding) { + pressKey(kb.KEY.F10); + homePitch = 0; + homeRoll = 0; + holding = false; + mCal = 0; + Bangle.removeListener('accel', handleAcc); + Bangle.buzz(); + drawMain(); + } else { + timeoutId = setTimeout(drawMain, 1000); + } + clearTimeout(timeoutHolding); + timeoutHolding = -1; +} + +Bangle.on('drag', function(e) { + if (cttl == 0) { cttl = getTime(); } + if (trackPadMode) { + if (lastx + lasty == 0) { + lastx = e.x; + lasty = e.y; + mttl = getTime(); + } + if (clearToSend) { + clearToSend = false; + let difX = e.x - lastx, difY = e.y - lasty; + let dT = getTime() - mttl; + let vX = difX / dT, vY = difY / dT; + //let qX = getSign(difX) * Math.pow(Math.abs(difX), 1.2); + //let qY = getSign(difY) * Math.pow(Math.abs(difY), 1.2); + let qX = difX + 0.02 * vX, qY = difY + 0.02 * vY; + moveMouse(qX, qY, 0, 0, 0, function() { + setTimeout(function() {clearToSend = true;}, 50); + }); + lastx = e.x; + lasty = e.y; + mttl = getTime(); + console.log("Dx: " + (qX) + " Dy: " + (qY)); + } + if (!e.b) { + // short press + if (getTime() - cttl < 0.2) { + clickMouse(MouseButton.LEFT); + console.log("click left"); + } + // longer press in center + else if (getTime() - cttl < 0.6 && e.x > g.getWidth()/4 && e.x < 3 * g.getWidth()/4 && e.y > g.getHeight() / 4 && e.y < 3 * g.getHeight() / 4) { + clickMouse(MouseButton.RIGHT); + console.log("click right"); + } + cttl = 0; + lastx = 0; + lasty = 0; + } + } else { + if(!e.b){ + Bangle.buzz(100); + if(lasty > 40){ + E.showMessage('down'); + scroll(0,1); + } else if(lasty < -40){ + E.showMessage(kb.KEY.A); + pressKey(kb.KEY.A); + } else if(lastx > 40){ + E.showMessage('right'); + //kb.tap(kb.KEY.RIGHT, 0); + scroll(-1); + } else if(lastx < -40){ + E.showMessage('left'); + //kb.tap(kb.KEY.LEFT, 0); + scroll(1); + } else if(lastx==0 && lasty==0 && holding == false){ + E.showMessage('press'); + clickMouse(MouseButton.LEFT); + } + stopHolding(); + lastx = 0; + lasty = 0; + } else{ + lastx = lastx + e.dx; + lasty = lasty + e.dy; + if (timeoutHolding == -1) { + timeoutHolding = setTimeout(startHolding, 500); + } + } + } +}); + + +function onBtn() { + if (trackPadMode) { + trackPadMode = false; + stopHolding(); + drawMain(); + } else { + clearToSend = true; + trackPadMode = true; + E.showMessage('Mouse'); + } + Bangle.buzz(); +} +setWatch(onBtn, (process.env.HWVERSION==2) ? BTN1 : BTN2, {repeat: true}); + +drawMain(); From 5f5b32eb148af5d44c15247576c010d5ea2691cc Mon Sep 17 00:00:00 2001 From: 7kasper <7kasper@users.noreply.github.com> Date: Sun, 26 Dec 2021 17:28:22 +0100 Subject: [PATCH 02/45] Add app image. --- apps/presentor/app.png | Bin 0 -> 2208 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/presentor/app.png diff --git a/apps/presentor/app.png b/apps/presentor/app.png new file mode 100644 index 0000000000000000000000000000000000000000..d29cf7be6f4ce71b2de84afbb97cc8c3085dc3bb GIT binary patch literal 2208 zcmV;R2w(S!P)VL{@Xy-X{om%s;f+QiB#6t8QqDST47r zc@(s*wfJf0zFqH4?{~@U!1NgUv~?mLYi+BnkM2^*pic;~r=q6rR6N%9;ko@TnH^ZU z`CgyT@He9w5%7^AvTq!1*>h^DeQje?qkvb0(2pEzY5vR9_m|8L4BvaJs^}T3LQst0 zdrHeE!qJ9E@v5s14t2Ms6S3ADaQl@iL=bL+C0PD9jJ*qW7?kG>x^76~BTq^i=Tbgcm4b>Vl z-Mfms?sfz5?%Hdc?#kD{eczw|+fkmlL2KTTj`@$(TYp{*AeSYcLW|(qMED+9q7+)w z_`p^ncs=6F8YMo5vXGaMUm7Dex0ct`cPC=4AJ=WWKTxu~;osqC{Y@1s8^+^3t;cC^ z*YSqvKf|_vyWy%0@mTBL)9vkUc};yrz`gNU>$8h4U`^u#Tcyx%M0{Bz7Ey+HM%2q+YOHW3>24w}o)@(S@OS{I)kq-D2Os(8T#|xHyBjcO|>7prt;~OPBl$^Hp=4eE@&N?4)68(8A(aTGlEgu0YC~tk>8-$ zrzs1}T)(lDq9?AhO6Z?-w(NRwuHRfR0n_14kDvZ=Nx>O8N8k4I&p33sb^9LCm zA7fcy=A4C!xL^V6wlv)gycY3ijgU2&^MfgY&l}*c4{gDef>;03%?m9Z45YGLQRL;m z8^2ED#%df_air%Id){ixIro^Y=^1n~uI8G2*NzK1#JS)N%VgMwrt3Fi8Ir#pIL?c2 zw)5NSa^BpqoO^Vdov*a=_R&5}LsGY@imI}robwm?1>umiOvEqpG0a;)E_l;2$vB#f zquI1Nf~z#owj5(;^fJCv5+pP>M5D~`Gb_uUy+_Z^<@NaU{*KaUjdmAQKt6Z?M`?l{ z6R%~^Ka#{%ny-btlWpk~0JWB;cQ}dTDjZkw#^IA>b07}en!yR>xLQBCU;@@OKCl&d zE#jLA4`2w%M8?5!6_Mh}mHoudOtyJE033HAQsl)nB#H49XpJ$AWW-kVCY-EN;?Ayp z%|{kQKp_>@XMrUJZQZA_49WMuRl{Skem=1?_{+i^)do*xJpAa|bpRYXK0tB6kER?fZ&;yW7MyXaNi9Z0r+zu>r>jN2AkLpqfzc<@kCAwyvrc05k7dNqmhFSjo?Jb?V{{Xf_Ow?3IQ z`c5Z3IN2;I+XkSs-(fVB-^+ynHmCBo;=|L8t9mKq-N7|wh|Tnu=a#WBxE#KnS#IV`^r5f>943aDALiMZJCP+-x` zB_fUYqQk>^{JFdSn)|DyM;tN?ak(X2k<1#77HnV4B2`G7*V}OU)xY!?1(H7mQSJ)y iO4q-h?p`dgLgW8Yi`ZcrY`y>h0000 Date: Sun, 26 Dec 2021 17:31:16 +0100 Subject: [PATCH 03/45] Add app icon file. --- apps/presentor/app-icon.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 apps/presentor/app-icon.js diff --git a/apps/presentor/app-icon.js b/apps/presentor/app-icon.js new file mode 100644 index 000000000..76939d548 --- /dev/null +++ b/apps/presentor/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+AH4ASlgADGmIxwLV4wqGQowfWZQwjKw4wJF7ghBmVWmQlELYoweFwYABGAwrHF7IuFGAwrIF7AuHMJADGF0AwHAYovWFxaSHADQuDEgIADYZYucAQOB1fQ1eBmQwiFwlX6AAE1gqBGD6MEmQqBwIICwIGB0rDeWYksFAIuBz+fvQHC6D0dcQssEwIuB4fC4V0M4VXF7YuFDYLqBlnDF4WeHAYugL5N6L4I4BF0IvB0vQvdQGAJeBY4YucmQxEAgJgBvYOBdwYQDFzUzmZ/EllXFIKKBAYVXBwSMaller7fFAoKSBAAOBFQK7dPoJfFEoYADRjgmEeIzFFdUQAOdUIumdRLtDAAIufdRQKCr8zCQjqmE4NeF4YudWxpqCFyovBK5LqiF6DqdR6D0BdTYwJGg5sBdTQwKEAIwHdTQwMSpQueYaAufGBouiGBYukGBIumGA4uoGAouqGAYABF1QAl")) From 1bac672658ea5b37a6220729a1bf429768893657 Mon Sep 17 00:00:00 2001 From: 7kasper <7kasper@users.noreply.github.com> Date: Sun, 26 Dec 2021 17:35:12 +0100 Subject: [PATCH 04/45] Create ChangeLog --- apps/presentor/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 apps/presentor/ChangeLog diff --git a/apps/presentor/ChangeLog b/apps/presentor/ChangeLog new file mode 100644 index 000000000..a7d747684 --- /dev/null +++ b/apps/presentor/ChangeLog @@ -0,0 +1,6 @@ +0.1: Start of app. +0.5: BLE keyboard functionality. +1.0: BLE mouse functionality to scroll back/forward. +1.5: Added accelerator style mouse. +2.0: Added touchpad style mouse. +2.1: Initial internal git(hub) release. Added icon and such. From 6a25e7901fd1e9a90359fb30bc3b1f9baedebcfa Mon Sep 17 00:00:00 2001 From: 7kasper <7kasper@users.noreply.github.com> Date: Sun, 26 Dec 2021 17:57:56 +0100 Subject: [PATCH 05/45] Add presentor to the banglejs app repository. --- apps.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps.json b/apps.json index e5e9f8f02..e4e53470d 100644 --- a/apps.json +++ b/apps.json @@ -5062,5 +5062,22 @@ {"name":"ltherm.app.js","url":"app.js"}, {"name":"ltherm.img","url":"icon.js","evaluate":true} ] + }, + { + "id": "presentor", + "name": "Presentor", + "version": "2.1", + "description": "Use your Bangle to present!", + "icon": "app.png", + "type": "app", + "tags": "tool,outdoors", + "interface": "interface.html", + "readme":"README.md", + "supports": ["BANGLEJS", "BANGLEJS2"], + "allow_emulator": true, + "storage": [ + {"name":"presentor.app.js","url":"app.js"}, + {"name":"presentor.img","url":"app-icon.js","evaluate":true} + ] } ] From 3b4cfe038d305974e4333ff6a940acd05bb5b2d1 Mon Sep 17 00:00:00 2001 From: 7kasper <7kasper@users.noreply.github.com> Date: Sun, 26 Dec 2021 18:03:55 +0100 Subject: [PATCH 06/45] Changed outdoor to bluetooth catagory >.< --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index e4e53470d..97cd97e4d 100644 --- a/apps.json +++ b/apps.json @@ -5070,7 +5070,7 @@ "description": "Use your Bangle to present!", "icon": "app.png", "type": "app", - "tags": "tool,outdoors", + "tags": "tool,bluetooth", "interface": "interface.html", "readme":"README.md", "supports": ["BANGLEJS", "BANGLEJS2"], From efd6e531c5023a645331ab9f72eb22b6f7e8b2d7 Mon Sep 17 00:00:00 2001 From: 7kasper <7kasper@users.noreply.github.com> Date: Sun, 26 Dec 2021 23:29:31 +0100 Subject: [PATCH 07/45] Test gestures on BS2.. :F --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 97cd97e4d..317b809dd 100644 --- a/apps.json +++ b/apps.json @@ -1324,7 +1324,7 @@ "icon": "gesture.png", "type": "app", "tags": "gesture,ai", - "supports": ["BANGLEJS"], + "supports": ["BANGLEJS", "BANGLEJS2"], "storage": [ {"name":"gesture.app.js","url":"gesture.js"}, {"name":".tfnames","url":"gesture-tfnames.js","evaluate":true}, From 54475bf5e6123ca4c5983556948400c45b65e8f0 Mon Sep 17 00:00:00 2001 From: 7kasper <7kasper@users.noreply.github.com> Date: Sat, 1 Jan 2022 16:27:31 +0100 Subject: [PATCH 08/45] Create template.html --- apps/presentor/template.html | 73 ++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 apps/presentor/template.html diff --git a/apps/presentor/template.html b/apps/presentor/template.html new file mode 100644 index 000000000..e3a5f71ef --- /dev/null +++ b/apps/presentor/template.html @@ -0,0 +1,73 @@ + + + + + + + +
+ + + + + + + From cfcf7908decd1cd661749bd6836b6414cc3c7bac Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 20:00:08 +0100 Subject: [PATCH 09/45] Create basic UI for adding subjects. --- apps/presentor/template.html | 281 ++++++++++++++++++++++++++++------- 1 file changed, 225 insertions(+), 56 deletions(-) diff --git a/apps/presentor/template.html b/apps/presentor/template.html index e3a5f71ef..2b0ddc1ec 100644 --- a/apps/presentor/template.html +++ b/apps/presentor/template.html @@ -2,71 +2,240 @@ + + -
- - +
+

Presentor

+
+
+
+
+
+
#
+
Subject
+
Time
+
Notes
+
+
Loading...
+
+
+
+
+ + +
From aec3df87450e68418f7064002115f31cfec95def Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 20:11:25 +0100 Subject: [PATCH 10/45] Hehe oops --- apps/presentor/{template.html => interface.html} | 8 ++++++++ 1 file changed, 8 insertions(+) rename apps/presentor/{template.html => interface.html} (97%) diff --git a/apps/presentor/template.html b/apps/presentor/interface.html similarity index 97% rename from apps/presentor/template.html rename to apps/presentor/interface.html index 2b0ddc1ec..a3c0fd890 100644 --- a/apps/presentor/template.html +++ b/apps/presentor/interface.html @@ -72,6 +72,14 @@ } .icon-cross { color: #e85600; + cursor: pointer; + transition: transform 0.2s ease-in-out; + } + .icon-cross:hover { + transform: scale(1.1); + } + .draghandle { + cursor: grab; } From b82b65198b3912d79393840c884026ed88a478bb Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 20:18:19 +0100 Subject: [PATCH 11/45] Add actual watch interface --- apps/presentor/interface.html | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index a3c0fd890..ac748a9f9 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -135,7 +135,12 @@ } function save() { - cmpStr = getJSON(); + let savestr = getJSON(); + Util.showModal('Saving...'); + Puck.write(`\x10require('Storage').writeJSON(${JSON.stringify('presentor.json')},${savestr})\n`,()=>{ + Util.hideModal(); + }); + cmpStr = savestr; } function loadJSON(str) { @@ -146,6 +151,14 @@ } } + function load() { + Util.showModal('Loading...'); + Puck.eval(`require('Storage').readJSON(${JSON.stringify('presentor.json')})`,data => { + Util.hideModal(); + loadJSON(data); + }); + } + function addFormPPart(partData = {}) { let part = document.createElement('div'); part.classList.add('ppartrow'); @@ -241,8 +254,9 @@ document.getElementById('loader').style.display = 'none'; // load from watch first. - let qq = `[{"subject":"Hello","minutes":55,"seconds":4,"notes":""},{"subject":"dsfafds","minutes":4,"seconds":33,"notes":"fdasdfsafasfsd"},{"subject":"dsadsf","minutes":0,"seconds":4,"notes":""},{"subject":"sdasf","minutes":0,"seconds":0,"notes":""}]`; - loadJSON(qq); + // let qq = `[{"subject":"Hello","minutes":55,"seconds":4,"notes":""},{"subject":"dsfafds","minutes":4,"seconds":33,"notes":"fdasdfsafasfsd"},{"subject":"dsadsf","minutes":0,"seconds":4,"notes":""},{"subject":"sdasf","minutes":0,"seconds":0,"notes":""}]`; + // loadJSON(qq); + load(); addFormPPart(); // load empty element on startup From 02c432124f78745b6f1920b258af789223cc9b8e Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 20:22:13 +0100 Subject: [PATCH 12/45] Bit more spacing for the drag thing. --- apps/presentor/interface.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index ac748a9f9..aefbdf2c2 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -49,7 +49,7 @@ width: 45%; } .pp-order { - width: calc(50% / 14); + width: calc(100% / 14); display: flex; justify-content: space-between; align-items: center; @@ -65,7 +65,7 @@ width: calc(200% / 14); } .pp-notes { - width: calc(800% / 14); + width: calc(750% / 14); } input { height: 1.5rem; From ce6d4d76fdc1f83035e1e457793a2ddd4c6c2b1a Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 20:23:43 +0100 Subject: [PATCH 13/45] Add readme --- apps/presentor/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 apps/presentor/README.md diff --git a/apps/presentor/README.md b/apps/presentor/README.md new file mode 100644 index 000000000..8b22eb228 --- /dev/null +++ b/apps/presentor/README.md @@ -0,0 +1,2 @@ +# Presentor +Use your Bangle to present! From aa55094e227082dc9aebdbcaeca27ded82516a96 Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 21:46:40 +0100 Subject: [PATCH 14/45] rrr --- apps/presentor/interface.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index aefbdf2c2..ed265e2f6 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -49,7 +49,7 @@ width: 45%; } .pp-order { - width: calc(100% / 14); + width: calc(150% / 14); display: flex; justify-content: space-between; align-items: center; @@ -65,7 +65,7 @@ width: calc(200% / 14); } .pp-notes { - width: calc(750% / 14); + width: calc(700% / 14); } input { height: 1.5rem; @@ -253,11 +253,15 @@ document.getElementById('loader').style.display = 'none'; + function onInit() { + load(); + addFormPPart(); // add empty element on startup + } // load from watch first. // let qq = `[{"subject":"Hello","minutes":55,"seconds":4,"notes":""},{"subject":"dsfafds","minutes":4,"seconds":33,"notes":"fdasdfsafasfsd"},{"subject":"dsadsf","minutes":0,"seconds":4,"notes":""},{"subject":"sdasf","minutes":0,"seconds":0,"notes":""}]`; // loadJSON(qq); - load(); - addFormPPart(); // load empty element on startup + + From 6eed1b5760f303b8b76117cc0d72236dd50c9888 Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 21:59:58 +0100 Subject: [PATCH 15/45] No double json parse >.< --- apps/presentor/interface.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index ed265e2f6..9b79221d3 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -153,7 +153,7 @@ function load() { Util.showModal('Loading...'); - Puck.eval(`require('Storage').readJSON(${JSON.stringify('presentor.json')})`,data => { + Puck.eval(`require('Storage').read(${JSON.stringify('presentor.json')})`,data => { Util.hideModal(); loadJSON(data); }); From d3a2bb4375aa938946280077a071ca17ebdda894 Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 22:06:17 +0100 Subject: [PATCH 16/45] Fix the empty element being loaded in wrongly. --- apps/presentor/interface.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index 9b79221d3..82bb85f57 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -149,6 +149,7 @@ for (let i = 0; i < jparts.length; i++) { addFormPPart(jparts[i]); } + addFormPPart(); // add empty element on startup } function load() { @@ -255,7 +256,6 @@ function onInit() { load(); - addFormPPart(); // add empty element on startup } // load from watch first. // let qq = `[{"subject":"Hello","minutes":55,"seconds":4,"notes":""},{"subject":"dsfafds","minutes":4,"seconds":33,"notes":"fdasdfsafasfsd"},{"subject":"dsadsf","minutes":0,"seconds":4,"notes":""},{"subject":"sdasf","minutes":0,"seconds":0,"notes":""}]`; From b279d3bf69ef3d1a27d0f9720129b0588ac6a560 Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 22:07:45 +0100 Subject: [PATCH 17/45] Bit more time for timer. --- apps/presentor/interface.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index 82bb85f57..460102388 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -59,10 +59,10 @@ padding-right: 0.25rem; } .pp-subject { - width: calc(350% / 14); + width: calc(300% / 14); } .pp-timer { - width: calc(200% / 14); + width: calc(250% / 14); } .pp-notes { width: calc(700% / 14); From c1fdac99929285a603078e67ef1c381a8625de7e Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 22:28:30 +0100 Subject: [PATCH 18/45] Futureproof the settings format. --- apps.json | 5 +++-- apps/presentor/ChangeLog | 1 + apps/presentor/interface.html | 12 +++++++++--- apps/presentor/settings.json | 17 +++++++++++++++++ 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 apps/presentor/settings.json diff --git a/apps.json b/apps.json index 317b809dd..74a24d290 100644 --- a/apps.json +++ b/apps.json @@ -5066,7 +5066,7 @@ { "id": "presentor", "name": "Presentor", - "version": "2.1", + "version": "2.2", "description": "Use your Bangle to present!", "icon": "app.png", "type": "app", @@ -5077,7 +5077,8 @@ "allow_emulator": true, "storage": [ {"name":"presentor.app.js","url":"app.js"}, - {"name":"presentor.img","url":"app-icon.js","evaluate":true} + {"name":"presentor.img","url":"app-icon.js","evaluate":true}, + {"name":"presentor.json","url":"settings.json"} ] } ] diff --git a/apps/presentor/ChangeLog b/apps/presentor/ChangeLog index a7d747684..2e3409855 100644 --- a/apps/presentor/ChangeLog +++ b/apps/presentor/ChangeLog @@ -4,3 +4,4 @@ 1.5: Added accelerator style mouse. 2.0: Added touchpad style mouse. 2.1: Initial internal git(hub) release. Added icon and such. +2.2: Begin work on presentation parts. diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index 460102388..1af0041fb 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -119,7 +119,11 @@ } function getJSON() { - let ret = []; + let ret = { + pparts: [], + sversion: 2.2 + } + let jparts = []; let pparts = subber.children; for (let i = 0; i < pparts.length; i++) { let rpart = {}; @@ -129,8 +133,9 @@ rpart.minutes = ppart.getElementsByClassName('pp-timer')[0].children[0].value | 0; rpart.seconds = ppart.getElementsByClassName('pp-timer')[0].children[2].value | 0; rpart.notes = ppart.getElementsByClassName('pp-notes')[0].value; - ret.push(rpart); + jparts.push(rpart); } + ret.pparts = jparts; return JSON.stringify(ret); } @@ -145,7 +150,8 @@ function loadJSON(str) { cmpStr = str; - let jparts = JSON.parse(str); + let settings = JSON.parse(str); + let jparts = settings.pparts; for (let i = 0; i < jparts.length; i++) { addFormPPart(jparts[i]); } diff --git a/apps/presentor/settings.json b/apps/presentor/settings.json new file mode 100644 index 000000000..7e8d29876 --- /dev/null +++ b/apps/presentor/settings.json @@ -0,0 +1,17 @@ +{ + "pparts": [ + { + "subject":"#1", + "minutes":10, + "seconds":0, + "notes":"This is a note." + }, + { + "subject":"#2", + "minutes":2, + "seconds":50, + "notes":"Change in the app!" + } + ], + "sversion": 2.2 +} \ No newline at end of file From b5ae5c291ee0d1fc62adcd47f3b75a4721c33e4a Mon Sep 17 00:00:00 2001 From: 7kasper Date: Sat, 1 Jan 2022 22:35:48 +0100 Subject: [PATCH 19/45] Add small credits on the page. --- apps/presentor/interface.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/presentor/interface.html b/apps/presentor/interface.html index 1af0041fb..377703898 100644 --- a/apps/presentor/interface.html +++ b/apps/presentor/interface.html @@ -1,6 +1,9 @@ + + + @@ -81,6 +84,13 @@ .draghandle { cursor: grab; } + footer { + display: inline-block; + width: 100%; + text-align: center; + font-size: 0.6rem; + color: grey; + } @@ -104,6 +114,7 @@ +