findphone Remove HID requirement, update screen (fix #565)
parent
2e45174d4a
commit
9f7461f434
|
|
@ -1768,8 +1768,8 @@
|
||||||
"name": "Find Phone",
|
"name": "Find Phone",
|
||||||
"shortName":"Find Phone",
|
"shortName":"Find Phone",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version":"0.01",
|
"version":"0.02",
|
||||||
"description": "Find your phone via Gadgetbridge. Click any button to let your phone ring. 📳",
|
"description": "Find your phone via Gadgetbridge. Click any button to let your phone ring. 📳 Note: The functionality is available even without this app, just go to Settings, App Settings, Gadgetbridge, Find Phone.",
|
||||||
"tags": "tool,android",
|
"tags": "tool,android",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"allow_emulator": true,
|
"allow_emulator": true,
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
0.01: First Version
|
0.01: First Version
|
||||||
|
0.02: Remove HID requirement, update screen
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
Ring your phone via GadgetBridge if you lost it somewhere.
|
Ring your phone via GadgetBridge if you lost it somewhere.
|
||||||
|
|
||||||
1. Enable HID in settings
|
1. Connect GadgetBridge
|
||||||
2. Connect GadgetBridge
|
2. Lose phone
|
||||||
3. Lose phone
|
3. Open app
|
||||||
4. Open app
|
4. Click any button or screen
|
||||||
5. Click any button or screen
|
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,34 @@
|
||||||
var storage = require('Storage');
|
|
||||||
|
|
||||||
//notify your phone
|
//notify your phone
|
||||||
function find(){
|
|
||||||
Bluetooth.println(JSON.stringify({t:"findPhone", n:true}));
|
var finding = false;
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
// show message
|
||||||
|
g.clear();
|
||||||
|
require("Font8x12").add(Graphics);
|
||||||
|
g.setFont("8x12",3);
|
||||||
|
g.setFontAlign(0,0);
|
||||||
|
g.setColor(0x03E0);
|
||||||
|
if (finding) {
|
||||||
|
g.drawString("Finding...", g.getWidth()/2, (g.getHeight()/2)-20);
|
||||||
|
g.drawString("Click to stop", g.getWidth()/2, (g.getHeight()/2)+20);
|
||||||
|
} else {
|
||||||
|
g.drawString("Click to find", g.getWidth()/2, g.getHeight()/2);
|
||||||
|
}
|
||||||
|
g.flip();
|
||||||
}
|
}
|
||||||
|
|
||||||
//init graphics
|
function find(){
|
||||||
g.clear();
|
finding = !finding;
|
||||||
require("Font8x12").add(Graphics);
|
draw();
|
||||||
g.setFont("8x12",3);
|
Bluetooth.println("\n"+JSON.stringify({t:"findPhone", n:finding}));
|
||||||
g.setFontAlign(0,0);
|
}
|
||||||
g.flip();
|
|
||||||
|
|
||||||
//init settings
|
draw();
|
||||||
const settings = storage.readJSON('setting.json',1) || { HID: false };
|
|
||||||
|
|
||||||
//check if HID enabled and show message
|
//register all buttons and screen to find phone
|
||||||
if (settings.HID=="kb" || settings.HID=="kbmedia") {
|
setWatch(find, BTN1, {repeat:true});
|
||||||
g.setColor(0x03E0);
|
setWatch(find, BTN2, {repeat:true});
|
||||||
g.drawString("click to find", g.getWidth()/2, g.getHeight()/2);
|
setWatch(find, BTN3, {repeat:true});
|
||||||
|
setWatch(find, BTN4, {repeat:true});
|
||||||
//register all buttons and screen to find phone
|
setWatch(find, BTN5, {repeat:true});
|
||||||
setWatch(find, BTN1);
|
|
||||||
setWatch(find, BTN2);
|
|
||||||
setWatch(find, BTN3);
|
|
||||||
setWatch(find, BTN4);
|
|
||||||
setWatch(find, BTN5);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
g.setColor(0xf800);
|
|
||||||
g.drawString("enable HID!", g.getWidth()/2, g.getHeight()/2);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue