Skip to content

Commit

Permalink
Added touch event to hide appointment
Browse files Browse the repository at this point in the history
  • Loading branch information
smirko-dev committed Dec 21, 2020
1 parent 941465b commit 8a176ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import document from "document";
import { battery } from "power";
import { preferences } from "user-settings";
import { display } from "display";
import { today } from 'user-activity';
import { me } from "appbit";
import { me as device } from "device";
import * as util from "../common/utils";
import * as appointment from "./appointment";
import * as clock from "./clock";
import * as messaging from "messaging";
Expand Down Expand Up @@ -67,8 +64,6 @@ clock.initialize("minutes", data => {
dateLabel.text = data.date;
// Update appointment
renderAppointment();
// Update battery
renderBattery();
});

battery.onchange = (evt) => {
Expand All @@ -86,8 +81,18 @@ display.addEventListener("change", () => {
renderAppointment();
renderBattery();
}
// Stop updating activity info
else {
hideActivity();
}
});

// Hide event when touched
appointmentsLabel.addEventListener("mousedown", () => {
showActivity();
updateActivity();
})

function renderAppointment() {
// Upate the appointment <text> element
let event = appointment.next();
Expand Down Expand Up @@ -150,3 +155,5 @@ function renderBattery() {
batteryImage.image = `battery-${Math.floor(battery.chargeLevel / 10) * 10}.png`;
}
}

renderBattery();
2 changes: 1 addition & 1 deletion resources/index.gui
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<text id="hourLabel" />
<text id="minuteLabel" />
<text id="dateLabel" opacity=".8" />
<textarea id="appointmentsLabel" opacity=".8" />
<textarea id="appointmentsLabel" opacity=".8" pointer-events="visible" />
<image id="batteryImage" href="battery-alert.png" x="275" y="5" width="24" height="24" opacity=".6" class="batteryIcon" />
<text id="batteryLabel" opacity=".8" />
<image id="activityIcon" href="steps.png" x="35%" y="80%" width="32" height="32" opacity=".8" class="activityIcon" />
Expand Down

0 comments on commit 8a176ce

Please sign in to comment.