fix: cleanup, AOD fixes
This commit is contained in:
parent
dd8aa149af
commit
0c961f777a
2
app.json
2
app.json
@ -6,7 +6,7 @@
|
||||
"appType": "watchface",
|
||||
"version": {
|
||||
"code": 1,
|
||||
"name": "1.0.2"
|
||||
"name": "1.0.3"
|
||||
},
|
||||
"icon": "icon.png",
|
||||
"vender": "zepp",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vhs-watch",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "vhs watch for Zepp OS 3.0 (GTS 4)",
|
||||
"main": "app.js",
|
||||
"scripts": {
|
||||
|
@ -6,10 +6,6 @@ import heartRateModule from "./modules/heartRate"
|
||||
|
||||
WatchFace({
|
||||
onInit() {
|
||||
|
||||
},
|
||||
|
||||
build() {
|
||||
clockModule()
|
||||
dateModule()
|
||||
batteryModule()
|
||||
@ -17,6 +13,9 @@ WatchFace({
|
||||
distanceModule()
|
||||
},
|
||||
|
||||
build() {
|
||||
},
|
||||
|
||||
onDestroy() {
|
||||
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { getScene, SCENE_AOD } from '@zos/app'
|
||||
import * as hmSensor from '@zos/sensor'
|
||||
import * as hmUI from '@zos/ui'
|
||||
import fontArray from '../fontData/secondaryFont'
|
||||
@ -10,6 +11,7 @@ export default function(){
|
||||
let battery = new hmSensor.Battery()
|
||||
updateBatteryWidget(battery.getCurrent())
|
||||
battery.onChange(() => updateBatteryWidget(battery.getCurrent()))
|
||||
if (getScene() != SCENE_AOD)
|
||||
hmUI.createWidget(hmUI.widget.IMG, {
|
||||
x: moduleX,
|
||||
y: moduleY,
|
||||
@ -17,9 +19,10 @@ export default function(){
|
||||
})
|
||||
}
|
||||
function updateBatteryWidget(batteryPercentage) {
|
||||
if(batteryWg){
|
||||
if (batteryWg)
|
||||
hmUI.deleteWidget(batteryWg)
|
||||
}
|
||||
|
||||
if (getScene() != SCENE_AOD) {
|
||||
batteryWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
||||
x: moduleX - 85,
|
||||
y: moduleY,
|
||||
@ -30,3 +33,4 @@ function updateBatteryWidget(batteryPercentage){
|
||||
text: batteryPercentage
|
||||
})
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
import * as hmUI from '@zos/ui'
|
||||
import { getScene, SCENE_AOD } from '@zos/app'
|
||||
import timeArray from '../fontData/primaryFont'
|
||||
|
||||
export default function () {
|
||||
console.log("[modules]: clock module init")
|
||||
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
||||
@ -19,6 +21,7 @@ export default function(){
|
||||
minute_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V,
|
||||
show_level: hmUI.show_level.ONLY_NORMAL | hmUI.show_level.ONAL_AOD
|
||||
})
|
||||
if (getScene() != SCENE_AOD) {
|
||||
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
||||
second_startX: 220,
|
||||
second_startY: 290,
|
||||
@ -27,3 +30,4 @@ export default function(){
|
||||
second_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V
|
||||
})
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { getScene, SCENE_AOD } from '@zos/app'
|
||||
import * as hmSensor from '@zos/sensor'
|
||||
import * as hmUI from '@zos/ui';
|
||||
import secondaryFont from '../fontData/secondaryFont';
|
||||
@ -10,20 +11,23 @@ export default function(){
|
||||
let distance = new hmSensor.Distance();
|
||||
updateDistance(distance.getCurrent())
|
||||
distance.onChange(() => updateDistance(distance.getCurrent()))
|
||||
if (getScene() != SCENE_AOD) {
|
||||
hmUI.createWidget(hmUI.widget.IMG, {
|
||||
x: moduleX,
|
||||
y: moduleY,
|
||||
src: 'misc/dist.PNG'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function updateDistance(dist) {
|
||||
if(!dist){
|
||||
if (!dist)
|
||||
dist = 0
|
||||
}
|
||||
if(distWg){
|
||||
|
||||
if (distWg)
|
||||
hmUI.deleteWidget(distWg)
|
||||
}
|
||||
|
||||
if (getScene() != SCENE_AOD) {
|
||||
distWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
||||
x: moduleX + 150,
|
||||
y: moduleY,
|
||||
@ -34,3 +38,4 @@ function updateDistance(dist){
|
||||
text: dist
|
||||
})
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { getScene, SCENE_AOD } from '@zos/app'
|
||||
import * as hmSensor from '@zos/sensor'
|
||||
import * as hmUI from '@zos/ui';
|
||||
import secondaryFont from '../fontData/secondaryFont';
|
||||
@ -8,6 +9,7 @@ export default function(){
|
||||
let heart = new hmSensor.HeartRate();
|
||||
updateHeartWidget(heart.getCurrent())
|
||||
heart.onCurrentChange(() => updateHeartWidget(heart.getCurrent()))
|
||||
if (!getScene() != SCENE_AOD)
|
||||
hmUI.createWidget(hmUI.widget.IMG, {
|
||||
x: 10,
|
||||
y: 365,
|
||||
@ -22,6 +24,7 @@ function updateHeartWidget(hbpm){
|
||||
if (heartRateWg) {
|
||||
hmUI.deleteWidget(heartRateWg)
|
||||
}
|
||||
if (!getScene() != SCENE_AOD) {
|
||||
heartRateWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
||||
x: 100,
|
||||
y: 365,
|
||||
@ -32,3 +35,4 @@ function updateHeartWidget(hbpm){
|
||||
text: hbpm
|
||||
})
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user