Swipe to back prototype
parent
57f5f92334
commit
5e87fc2bcf
|
|
@ -0,0 +1 @@
|
|||
0.01: New App!
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -0,0 +1,33 @@
|
|||
(function () {
|
||||
// Overrride the default setUI method, so we can save the back button callback
|
||||
var setUI = Bangle.setUI;
|
||||
Bangle.setUI = function (mode, cb) {
|
||||
var options = {};
|
||||
if ("object"==typeof mode) {
|
||||
options = mode;
|
||||
}
|
||||
|
||||
print("Setting UI");
|
||||
if(global.BACK) delete global.BACK;
|
||||
if (options && options.back) {
|
||||
print("Saving back callback");
|
||||
global.BACK = options.back;
|
||||
}
|
||||
setUI(mode, cb);
|
||||
};
|
||||
|
||||
function goBack(lr, ud) {
|
||||
// if it is a left to right swipe
|
||||
if (lr === 1) {
|
||||
print("Back swipe detected");
|
||||
// if we're in an app that has a back button, run the callback for it
|
||||
if (global.BACK) {
|
||||
print("Running back callback");
|
||||
global.BACK();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Listen to left to right swipe
|
||||
Bangle.on("swipe", goBack);
|
||||
})();
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{ "id": "backswipe",
|
||||
"name": "Back Swipe",
|
||||
"shortName":"BackSwipe",
|
||||
"version":"0.01",
|
||||
"description": "Service that allows you to use an app's back button using left to right swipe gesture",
|
||||
"icon": "app.png",
|
||||
"tags": "back,gesture,swipe",
|
||||
"supports" : ["BANGLEJS2"],
|
||||
"type": "bootloader",
|
||||
"storage": [
|
||||
{"name":"backswipe.boot.js","url":"boot.js"}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue