Skip to content

Commit

Permalink
add aod
Browse files Browse the repository at this point in the history
  • Loading branch information
novvember committed Nov 10, 2024
1 parent a8b290b commit f804589
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 29 deletions.
2 changes: 1 addition & 1 deletion elaborate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ One of the default watchfaces for CMF by Nothing Watch [Elaborate 2](https://int

**Model compatibility:** Amazfit GTR Mini (round, 416 x 416 pixels) / GTR 4 / T-Rex 2 and other round watches with ZeppOS 2+

**AOD:** No
**AOD:** Yes

**Tap-zones:** No

Expand Down
4 changes: 2 additions & 2 deletions elaborate/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"appName": "Elaborate",
"appType": "watchface",
"version": {
"code": 9,
"name": "1.3.2"
"code": 10,
"name": "1.4.0"
},
"icon": "icon.png",
"vender": "novvember",
Expand Down
Binary file added elaborate/assets/common.r/background/aod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 27 additions & 26 deletions elaborate/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const COLORS = {
bgOnAccent: 0x000000,
textPrimary: 0x000000,
textSecondary: 0xebebed,
aod: 0xebebed,
};

export const FONT_FAMILY = {
Expand Down Expand Up @@ -53,33 +54,33 @@ export const DATE_TEXT = {
textSize: px(18),
months: isRusLang
? [
'Янв',
'Фев',
'Мар',
'Апр',
'Май',
'Июн',
'Июл',
'Авг',
'Сен',
'Окт',
'Ноя',
'Дек',
]
'Янв',
'Фев',
'Мар',
'Апр',
'Май',
'Июн',
'Июл',
'Авг',
'Сен',
'Окт',
'Ноя',
'Дек',
]
: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
};

export const DATE_WEEK = {
Expand Down
13 changes: 13 additions & 0 deletions elaborate/watchface/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import {
SLEEP_WAKE_STAGE_ARC_PROPS,
WEATHER_NO_ICON_TEXT_PROPS,
PULSE_PREV_POINTER_GROUP_PROPS,
BACKGROUND_AOD_IMAGE_PROPS,
TIME_AOD_TEXT_PROPS,
} from './index.r.layout';
import { decline } from '../utils/decline';
import { formatNumber } from '../utils/formatNumber';
Expand All @@ -53,6 +55,8 @@ WatchFace({
build() {
console.log('index page.js on build invoke');

this.buildBackground();

this.buildSleep();
this.buildDate();
this.buildSeconds();
Expand All @@ -71,6 +75,10 @@ WatchFace({
console.log('index page.js on destroy invoke');
},

buildBackground() {
hmUI.createWidget(hmUI.widget.IMG, BACKGROUND_AOD_IMAGE_PROPS);
},

buildSleep() {
const noDataWidget = hmUI.createWidget(hmUI.widget.IMG, SLEEP_NO_DATA_IMAGE_PROPS);
const arcWidget = hmUI.createWidget(hmUI.widget.ARC_PROGRESS, null);
Expand Down Expand Up @@ -205,6 +213,7 @@ WatchFace({
buildTime() {
hmUI.createWidget(hmUI.widget.FILL_RECT, TIME_BACKGROUND_PROPS);
const textWidget = hmUI.createWidget(hmUI.widget.TEXT, TIME_TEXT_PROPS);
const textAodWidget = hmUI.createWidget(hmUI.widget.TEXT, TIME_AOD_TEXT_PROPS);
const is12HourFormat = hmSetting.getTimeFormat() === 0;

let prevTime = '';
Expand All @@ -223,6 +232,7 @@ WatchFace({
prevTime = timeString;

textWidget.setProperty(hmUI.prop.TEXT, timeString);
textAodWidget.setProperty(hmUI.prop.TEXT, timeString);
};

hmUI.createWidget(hmUI.widget.WIDGET_DELEGATE, {
Expand All @@ -232,6 +242,9 @@ WatchFace({
if (hmSetting.getScreenType() == hmSetting.screen_type.WATCHFACE) {
updateTimer = timer.createTimer(1000, 1000, update);
update();
} else if (hmSetting.getScreenType() == hmSetting.screen_type.AOD) {
updateTimer = timer.createTimer(3000, 3000, update);
update();
}
},
pause_call: () => {
Expand Down
16 changes: 16 additions & 0 deletions elaborate/watchface/index.r.layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@ import {
FONT_FAMILY,
FONT_SIZE,
PULSE,
SCREEN,
SECONDS,
SLEEP,
STEPS,
TIME,
WEATHER,
} from '../utils/constants';

export const BACKGROUND_AOD_IMAGE_PROPS = {
x: 0,
y: 0,
w: SCREEN.width,
h: SCREEN.height,
src: 'background/aod.png',
show_level: hmUI.show_level.ONAL_AOD,
};

export const SLEEP_NO_DATA_IMAGE_PROPS = {
x: SLEEP.x,
y: SLEEP.y,
Expand Down Expand Up @@ -126,6 +136,12 @@ export const TIME_TEXT_PROPS = {
show_level: hmUI.show_level.ONLY_NORMAL,
};

export const TIME_AOD_TEXT_PROPS = {
...TIME_TEXT_PROPS,
color: COLORS.aod,
show_level: hmUI.show_level.ONAL_AOD,
};

export const WEATHER_BACKGROUND_PROPS = {
x: WEATHER.x,
y: WEATHER.y,
Expand Down

0 comments on commit f804589

Please sign in to comment.