build(release): v1.0 of VHS Watchface
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules/**
|
||||||
|
dist/*
|
||||||
|
npm-debug.log
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
yarn.lock
|
||||||
|
package-lock.json
|
||||||
|
selenium-debug.log
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
10
app.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
App({
|
||||||
|
globalData: {},
|
||||||
|
onCreate(options) {
|
||||||
|
console.log('app on create invoke')
|
||||||
|
},
|
||||||
|
|
||||||
|
onDestroy(options) {
|
||||||
|
console.log('app on destroy invoke')
|
||||||
|
}
|
||||||
|
})
|
57
app.json
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"configVersion": "v2",
|
||||||
|
"app": {
|
||||||
|
"appId": 24808,
|
||||||
|
"appName": "VHS Watch",
|
||||||
|
"appType": "watchface",
|
||||||
|
"version": {
|
||||||
|
"code": 1,
|
||||||
|
"name": "1.0.0"
|
||||||
|
},
|
||||||
|
"icon": "icon.png",
|
||||||
|
"vender": "zepp",
|
||||||
|
"description": "VHS watchface"
|
||||||
|
},
|
||||||
|
"permissions": [
|
||||||
|
"data:os.device.info",
|
||||||
|
"data:user.hd.heart_rate",
|
||||||
|
"data:user.hd.distance"
|
||||||
|
],
|
||||||
|
"runtime": {
|
||||||
|
"apiVersion": {
|
||||||
|
"compatible": "2.0.0",
|
||||||
|
"target": "2.0.0",
|
||||||
|
"minVersion": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"targets": {
|
||||||
|
"390x450-amazfit-gts-4": {
|
||||||
|
"module": {
|
||||||
|
"watchface": {
|
||||||
|
"path": "watchface/index",
|
||||||
|
"main": 1,
|
||||||
|
"editable": 0,
|
||||||
|
"lockscreen": 0,
|
||||||
|
"hightCost": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"platforms": [
|
||||||
|
{
|
||||||
|
"name": "Lille",
|
||||||
|
"deviceSource": 7995648
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Lillew",
|
||||||
|
"deviceSource": 7995649
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"designWidth": 390
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"i18n": {
|
||||||
|
"en-US": {
|
||||||
|
"appName": "VHS Watch"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultLanguage": "en-US"
|
||||||
|
}
|
BIN
assets/390x450-amazfit-gts-4/clk/0.PNG
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
assets/390x450-amazfit-gts-4/clk/1.PNG
Normal file
After Width: | Height: | Size: 637 B |
BIN
assets/390x450-amazfit-gts-4/clk/2.PNG
Normal file
After Width: | Height: | Size: 883 B |
BIN
assets/390x450-amazfit-gts-4/clk/3.PNG
Normal file
After Width: | Height: | Size: 1014 B |
BIN
assets/390x450-amazfit-gts-4/clk/4.PNG
Normal file
After Width: | Height: | Size: 825 B |
BIN
assets/390x450-amazfit-gts-4/clk/5.PNG
Normal file
After Width: | Height: | Size: 856 B |
BIN
assets/390x450-amazfit-gts-4/clk/6.PNG
Normal file
After Width: | Height: | Size: 967 B |
BIN
assets/390x450-amazfit-gts-4/clk/7.PNG
Normal file
After Width: | Height: | Size: 695 B |
BIN
assets/390x450-amazfit-gts-4/clk/8.PNG
Normal file
After Width: | Height: | Size: 1019 B |
BIN
assets/390x450-amazfit-gts-4/clk/9.PNG
Normal file
After Width: | Height: | Size: 988 B |
BIN
assets/390x450-amazfit-gts-4/clk/point.PNG
Normal file
After Width: | Height: | Size: 325 B |
BIN
assets/390x450-amazfit-gts-4/clk/points.PNG
Normal file
After Width: | Height: | Size: 399 B |
BIN
assets/390x450-amazfit-gts-4/date/0.PNG
Normal file
After Width: | Height: | Size: 613 B |
BIN
assets/390x450-amazfit-gts-4/date/1.PNG
Normal file
After Width: | Height: | Size: 309 B |
BIN
assets/390x450-amazfit-gts-4/date/2.PNG
Normal file
After Width: | Height: | Size: 505 B |
BIN
assets/390x450-amazfit-gts-4/date/3.PNG
Normal file
After Width: | Height: | Size: 600 B |
BIN
assets/390x450-amazfit-gts-4/date/4.PNG
Normal file
After Width: | Height: | Size: 453 B |
BIN
assets/390x450-amazfit-gts-4/date/5.PNG
Normal file
After Width: | Height: | Size: 482 B |
BIN
assets/390x450-amazfit-gts-4/date/6.PNG
Normal file
After Width: | Height: | Size: 559 B |
BIN
assets/390x450-amazfit-gts-4/date/7.PNG
Normal file
After Width: | Height: | Size: 347 B |
BIN
assets/390x450-amazfit-gts-4/date/8.PNG
Normal file
After Width: | Height: | Size: 598 B |
BIN
assets/390x450-amazfit-gts-4/date/9.PNG
Normal file
After Width: | Height: | Size: 583 B |
BIN
assets/390x450-amazfit-gts-4/date/perc.PNG
Normal file
After Width: | Height: | Size: 663 B |
BIN
assets/390x450-amazfit-gts-4/date/point.PNG
Normal file
After Width: | Height: | Size: 175 B |
BIN
assets/390x450-amazfit-gts-4/date/points.PNG
Normal file
After Width: | Height: | Size: 213 B |
BIN
assets/390x450-amazfit-gts-4/icon.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/390x450-amazfit-gts-4/misc/dist.PNG
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/390x450-amazfit-gts-4/misc/hb.PNG
Normal file
After Width: | Height: | Size: 777 B |
17
package.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "vhs-watch",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "vhs watch for Zepp OS 3.0 (GTS 4)",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "Lisoveliy",
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"@zeppos/device-types": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@zeppos/zml": "^0.0.9"
|
||||||
|
}
|
||||||
|
}
|
12
watchface/fontData/primaryFont.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export default [
|
||||||
|
'clk/0.PNG',
|
||||||
|
'clk/1.PNG',
|
||||||
|
'clk/2.PNG',
|
||||||
|
'clk/3.PNG',
|
||||||
|
'clk/4.PNG',
|
||||||
|
'clk/5.PNG',
|
||||||
|
'clk/6.PNG',
|
||||||
|
'clk/7.PNG',
|
||||||
|
'clk/8.PNG',
|
||||||
|
'clk/9.PNG'
|
||||||
|
];
|
12
watchface/fontData/secondaryFont.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export default [
|
||||||
|
'date/0.PNG',
|
||||||
|
'date/1.PNG',
|
||||||
|
'date/2.PNG',
|
||||||
|
'date/3.PNG',
|
||||||
|
'date/4.PNG',
|
||||||
|
'date/5.PNG',
|
||||||
|
'date/6.PNG',
|
||||||
|
'date/7.PNG',
|
||||||
|
'date/8.PNG',
|
||||||
|
'date/9.PNG'
|
||||||
|
];
|
23
watchface/index.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import batteryModule from "./modules/battery"
|
||||||
|
import clockModule from "./modules/clock"
|
||||||
|
import dateModule from "./modules/date"
|
||||||
|
import distanceModule from "./modules/distance"
|
||||||
|
import heartRateModule from "./modules/heartRate"
|
||||||
|
|
||||||
|
WatchFace({
|
||||||
|
onInit() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
build() {
|
||||||
|
clockModule()
|
||||||
|
dateModule()
|
||||||
|
batteryModule()
|
||||||
|
heartRateModule()
|
||||||
|
distanceModule()
|
||||||
|
},
|
||||||
|
|
||||||
|
onDestroy() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
31
watchface/modules/battery.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import * as hmSensor from '@zos/sensor'
|
||||||
|
import * as hmUI from '@zos/ui'
|
||||||
|
import fontArray from '../fontData/secondaryFont'
|
||||||
|
|
||||||
|
let batteryWg;
|
||||||
|
|
||||||
|
export default function(){
|
||||||
|
console.log("[modules]: battery module init")
|
||||||
|
let battery = new hmSensor.Battery()
|
||||||
|
updateBatteryWidget(battery.getCurrent())
|
||||||
|
battery.onChange(() => updateBatteryWidget(battery.getCurrent()))
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG, {
|
||||||
|
x: 355,
|
||||||
|
y: 10,
|
||||||
|
src: 'date/perc.PNG'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function updateBatteryWidget(batteryPercentage){
|
||||||
|
if(batteryWg){
|
||||||
|
hmUI.deleteWidget(batteryWg)
|
||||||
|
}
|
||||||
|
batteryWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
||||||
|
x: 270,
|
||||||
|
y: 10,
|
||||||
|
type: hmUI.data_type.BATTERY,
|
||||||
|
font_array: fontArray,
|
||||||
|
h_space: 1,
|
||||||
|
align_h: hmUI.align.RIGHT,
|
||||||
|
text: batteryPercentage
|
||||||
|
})
|
||||||
|
}
|
29
watchface/modules/clock.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import * as hmUI from '@zos/ui'
|
||||||
|
import timeArray from '../fontData/primaryFont'
|
||||||
|
export default function(){
|
||||||
|
console.log("[modules]: clock module init")
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
||||||
|
hour_zero: 1, // Whether to make up zero.
|
||||||
|
hour_startX: 10,
|
||||||
|
hour_startY: 50,
|
||||||
|
hour_array: timeArray,
|
||||||
|
hour_space: 1,
|
||||||
|
hour_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V, //Я хз работает ли это
|
||||||
|
show_level: hmUI.show_level.ONLY_NORMAL | hmUI.show_level.ONAL_AOD
|
||||||
|
})
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
||||||
|
minute_startX: 118, //120 - space on center(2)
|
||||||
|
minute_startY: 170,
|
||||||
|
minute_array: timeArray,
|
||||||
|
minute_space: 1,
|
||||||
|
minute_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V,
|
||||||
|
show_level: hmUI.show_level.ONLY_NORMAL | hmUI.show_level.ONAL_AOD
|
||||||
|
})
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG_TIME, {
|
||||||
|
second_startX: 220,
|
||||||
|
second_startY: 290,
|
||||||
|
second_array: timeArray,
|
||||||
|
second_space: 1,
|
||||||
|
second_align: hmUI.align.CENTER_H | hmUI.align.CENTER_V
|
||||||
|
})
|
||||||
|
}
|
26
watchface/modules/date.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import * as hmUI from '@zos/ui'
|
||||||
|
import fontArray from '../fontData/secondaryFont'
|
||||||
|
export default function () {
|
||||||
|
console.log("[modules]: date module init")
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG_DATE, {
|
||||||
|
day_startX: 10,
|
||||||
|
day_startY: 10,
|
||||||
|
day_align: hmUI.align.LEFT,
|
||||||
|
day_space: 0,
|
||||||
|
day_zero: 1,
|
||||||
|
day_en_array: fontArray
|
||||||
|
})
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG, {
|
||||||
|
x: 54,
|
||||||
|
y: 14,
|
||||||
|
src: 'date/point.PNG'
|
||||||
|
})
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG_DATE, {
|
||||||
|
month_startX: 70,
|
||||||
|
month_startY: 10,
|
||||||
|
month_align: hmUI.align.LEFT,
|
||||||
|
month_space: 0,
|
||||||
|
month_zero: 1,
|
||||||
|
month_en_array: fontArray
|
||||||
|
})
|
||||||
|
}
|
35
watchface/modules/distance.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import * as hmSensor from '@zos/sensor'
|
||||||
|
import * as hmUI from '@zos/ui';
|
||||||
|
import secondaryFont from '../fontData/secondaryFont';
|
||||||
|
|
||||||
|
let distWg;
|
||||||
|
export default function(){
|
||||||
|
console.log("[modules]: distance module init")
|
||||||
|
let distance = new hmSensor.Distance();
|
||||||
|
updateDistance(distance.getCurrent())
|
||||||
|
distance.onChange(() => updateDistance(distance.getCurrent()))
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG, {
|
||||||
|
x: 10,
|
||||||
|
y: 405,
|
||||||
|
src: 'misc/dist.PNG'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateDistance(dist){
|
||||||
|
if(!dist){
|
||||||
|
dist = 0
|
||||||
|
}
|
||||||
|
if(distWg){
|
||||||
|
hmUI.deleteWidget(distWg)
|
||||||
|
}
|
||||||
|
dist = (dist * 1000).toFixed(0)
|
||||||
|
distWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
||||||
|
x: 160,
|
||||||
|
y: 405,
|
||||||
|
type: hmUI.data_type.DISTANCE,
|
||||||
|
font_array: secondaryFont,
|
||||||
|
h_space: 1,
|
||||||
|
align_h: hmUI.align.LEFT,
|
||||||
|
text: dist
|
||||||
|
})
|
||||||
|
}
|
34
watchface/modules/heartRate.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import * as hmSensor from '@zos/sensor'
|
||||||
|
import * as hmUI from '@zos/ui';
|
||||||
|
import secondaryFont from '../fontData/secondaryFont';
|
||||||
|
|
||||||
|
let heartRateWg;
|
||||||
|
export default function(){
|
||||||
|
console.log("[modules]: heartrate module init")
|
||||||
|
let heart = new hmSensor.HeartRate();
|
||||||
|
updateHeartWidget(heart.getCurrent())
|
||||||
|
heart.onCurrentChange(() => updateHeartWidget(heart.getCurrent()))
|
||||||
|
hmUI.createWidget(hmUI.widget.IMG, {
|
||||||
|
x: 10,
|
||||||
|
y: 365,
|
||||||
|
src: 'misc/hb.PNG'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateHeartWidget(hbpm){
|
||||||
|
if(!hbpm){
|
||||||
|
hbpm = 0
|
||||||
|
}
|
||||||
|
if(heartRateWg){
|
||||||
|
hmUI.deleteWidget(heartRateWg)
|
||||||
|
}
|
||||||
|
heartRateWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
|
||||||
|
x: 100,
|
||||||
|
y: 365,
|
||||||
|
type: hmUI.data_type.BATTERY,
|
||||||
|
font_array: secondaryFont,
|
||||||
|
h_space: 1,
|
||||||
|
align_h: hmUI.align.LEFT,
|
||||||
|
text: hbpm
|
||||||
|
})
|
||||||
|
}
|