timer_out.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. (() => {
  2. let __$$app$$__ = __$$hmAppManager$$__.currentApp;
  3. let __$$module$$__ = __$$app$$__.current;
  4. __$$module$$__.module = DeviceRuntimeCore.Page({
  5. build() {
  6. hmSetting.setBrightScreen(180);
  7. // Bell icon
  8. let counter = 0;
  9. let icon = hmUI.createWidget(hmUI.widget.IMG, {
  10. x: (192-64)/2,
  11. y: 120,
  12. src: "timer/bell.png"
  13. });
  14. // Auto-exit after 0.5m
  15. timer.createTimer(30000, 30000, () => {
  16. hmApp.goBack();
  17. });
  18. // Exit button
  19. hmUI.createWidget(hmUI.widget.IMG, {
  20. x: (192-72)/2,
  21. y: 300,
  22. src: "timer/bell_stop.png"
  23. }).addEventListener(hmUI.event.CLICK_UP, () => {
  24. hmApp.goBack();
  25. });
  26. // Vibro
  27. vibrate = hmSensor.createSensor(hmSensor.id.VIBRATE);
  28. vibrate.scene = 1;
  29. vibrate.start();
  30. // Wipe
  31. hmFS.SysProSetChars("mmk_tb_timer_state", "");
  32. },
  33. onDestroy: () => {
  34. vibrate.stop();
  35. hmSetting.setBrightScreenCancel();
  36. }
  37. })
  38. })();