diff --git a/apps/sevenmin/ChangeLog b/apps/sevenmin/ChangeLog new file mode 100644 index 000000000..1a3bc1757 --- /dev/null +++ b/apps/sevenmin/ChangeLog @@ -0,0 +1 @@ +0.01: New app! diff --git a/apps/sevenmin/README.md b/apps/sevenmin/README.md new file mode 100644 index 000000000..dfcd21999 --- /dev/null +++ b/apps/sevenmin/README.md @@ -0,0 +1,19 @@ +Do a seven minute workout - or three! + +Touch the screen to start the workout and follow the instructions. + +Once the workout is finished the screen can be touched to go again - but get a minute or two of rest inbetween! + +Search the web if you want further instructions, videos are helpful! + +TODO: +- Add visible countdowns +- Add tracking of excercises, number of repetitions done etc. (Integration with BanglExercise app?) +- Add tracking of workouts over time. +- Move the whole app into BangleExercise app? +- + +Creator: +Thyttan + +Jump icon by Icons8 diff --git a/apps/sevenmin/app-icon.js b/apps/sevenmin/app-icon.js new file mode 100644 index 000000000..2e8f63f7e --- /dev/null +++ b/apps/sevenmin/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwwhC/AFfd7oWUhoXB6AuVGCoX/CQZwDO4wGBRJ4uESpYLCBg4KKLQw+EBBAYK6Wq1UtPaAPC7QXB1qSRLAMqC4OiLZQYIC4YWRAAIWBAALvTC/7DLCySoBAASPSCgPc5owSFwXM5gwSFwQXBGCQuC4EMGARGSAoJIRIwXAAoMMJB4uFGCIuFGCIuGGAhGM7gKHGAJIKC4IMIBRRHDAYUzAAQKGABUDCwYABmDvPC4IFDC6IAYJAhGSAAwZNCwQQEA44WJBQ4YMgYLWAH4AaA==")) diff --git a/apps/sevenmin/app.js b/apps/sevenmin/app.js new file mode 100644 index 000000000..be2d4ae11 --- /dev/null +++ b/apps/sevenmin/app.js @@ -0,0 +1,106 @@ +/* +'Jumping jacks', +'Wall sit', +'Pushups', +'Crunches', +'Step-up onto chair, alternating legs', +'Squats', +'Triceps dips, using a chair or bench', +'Forearm plank', +'High-knees or running in place', +'Lunges, alternating legs', +'Pushups with rotation, alternating sides', +'Side plank', + +Once you've completed all 12 exercises, take a break for 1–2 minutes and repeat the circuit another 2–3 times. + +*/ +{ + + let R = Bangle.appRect; + let instructions = ['Rest\n\nNext up:\n\n', + 'Tap to start!', + 'Get ready!\nFirst up:\n', + 'Jumping jacks', + 'Wall sit', + 'Pushups', + 'Crunches', + 'Step-up onto\nchair,\nalternating legs', + 'Squats', + 'Triceps dips,\n using\ a\nchair or bench', + 'Forearm plank', + 'High-knees or\nrunning in place', + 'Lunges,\nalternating legs', + 'Pushups with\nrotation,\nalternating sides', + 'Side plank', + 'Workout done!' + ]; + + Bangle.setLCDTimeout(0); + Bangle.setLocked(false); + + let draw = function(instruction) { + g.reset(); + g.clearRect(R); + + g.setFont12x20(); + g.setFontAlign(0,0,0); + g.drawString(instruction, R.w/2, R.h/2); + }; + + let endWorkout = function(interval) { + draw(instructions[instructions.length-1]); + clearInterval(interval); + ongoing = false; + }; + + let cycle = 40; // standard cycle is 40 seconds + let scaling = cycle/40; // scaling if changing cycle length + let ongoing = false; + let touchHandler = function() { + if (!ongoing) { + Bangle.buzz(); + ongoing = true; + // Get ready! + draw(instructions[2]+instructions[3]); + let i = 3; + // buzzes before start + setTimeout(()=>{let j = 0; let buzzes = setInterval(()=>{Bangle.buzz(200*scaling); j++; if (j==5) clearInterval(buzzes);}, 1*1000*scaling);}, 4*1000*scaling); + // timeout till first excercise + let timeout = setTimeout(()=>{draw(instructions[i]);i++;}, 10*1000*scaling); + // buzzes before first rest + setTimeout(()=>{let j = 0; let buzzes = setInterval(()=>{Bangle.buzz(200*scaling); j++; if (j==5) clearInterval(buzzes);}, 1*1000*scaling);}, 34*1000*scaling); + // interval containing rest and excercises 10+30=40 + let interval = setInterval(()=>{ + if (i==instructions.length-1) { + endWorkout(interval); + } else { + // draw pause message + draw(instructions[0]+instructions[i]); + // buzzes before next excercise + setTimeout(()=>{let j = 0; let buzzes = setInterval(()=>{Bangle.buzz(200*scaling); j++; if (j==5) clearInterval(buzzes);}, 1*1000*scaling);}, 4*1000*scaling); + // timeout till next excercise + setTimeout(()=>{draw(instructions[i]);i++;}, 10*1000*scaling); + // buzzes before next rest + setTimeout(()=>{let j = 0; let buzzes = setInterval(()=>{Bangle.buzz(200*scaling); j++; if (j==5) clearInterval(buzzes);}, 1*1000*scaling);}, 34*1000*scaling); + } + }, 40*1000*scaling); + } + }; + + let swipeHandler = function() { + + }; + + let uiMode = { + mode : 'custom', + back : load, + touch : touchHandler, + //swipe : swipeHandler + }; + Bangle.setUI(uiMode); + + Bangle.loadWidgets(); + // Tap to start! + draw(instructions[1]); +} diff --git a/apps/sevenmin/icon.png b/apps/sevenmin/icon.png new file mode 100644 index 000000000..c84245955 Binary files /dev/null and b/apps/sevenmin/icon.png differ diff --git a/apps/sevenmin/metadata.json b/apps/sevenmin/metadata.json new file mode 100644 index 000000000..f39b23bce --- /dev/null +++ b/apps/sevenmin/metadata.json @@ -0,0 +1,16 @@ +{ "id": "sevenmin", + "name": "Seven minute workout", + "shortName": "7 min wo", + "version": "0.01", + "description": "A basic implementation of the famous consice workout", + "icon": "icon.png", + "type":"app", + "tags": "Training, Workout", + "supports": ["BANGLEJS2"], + "readme": "README.md", + "allow_emulator":true, + "storage": [ + {"name":"sevenmin.app.js", "url":"app.js"}, + {"name":"sevenmin.img", "url":"app-icon.js","evaluate":true} + ] +}