Significant platform-specific design work (TODO: b&w support + shift sleep time GRect depending on if time or error)

This commit is contained in:
2026-04-26 02:50:53 -04:00
parent a64f24f60b
commit bd388a5646
3 changed files with 57 additions and 33 deletions

View File

@@ -38,14 +38,33 @@
{ {
"type": "raw", "type": "raw",
"name": "PIN_ICON", "name": "PIN_ICON",
"file": "pin.pdc" "file": "pin.pdc",
"targetPlatforms": [
"basalt",
"diorite",
"flint",
"emery"
]
},
{
"type": "raw",
"name": "PIN_ROUND_JELLYFIN_ICON",
"file": "pin_round_jellyfin.pdc",
"targetPlatforms": [
"chalk",
"gabbro"
]
} }
] ]
}, },
"sdkVersion": "3", "sdkVersion": "3",
"targetPlatforms": [ "targetPlatforms": [
"basalt",
"diorite",
"chalk", "chalk",
"emery" "flint",
"emery",
"gabbro"
], ],
"uuid": "3097b48e-552c-4a78-92b2-566b9128640e", "uuid": "3097b48e-552c-4a78-92b2-566b9128640e",
"watchapp": { "watchapp": {

Binary file not shown.

View File

@@ -81,27 +81,32 @@ static void pin_icon_update_proc(Layer *layer, GContext *ctx) {
} }
static void main_window_load(Window *window) { static void main_window_load(Window *window) {
// sleep bar
s_sleep_bar_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_IF_ROUND_ELSE(49, 31)));
layer_set_update_proc(s_sleep_bar_layer, sleep_bar_update_proc);
// sleep icon // sleep icon
s_sleep_icon_layer = layer_create(GRect(PBL_IF_ROUND_ELSE((PBL_DISPLAY_WIDTH / 2) - 13, 4), 4, PBL_DISPLAY_WIDTH, 50)); s_sleep_icon_layer = layer_create(GRect(PBL_IF_ROUND_ELSE((PBL_DISPLAY_WIDTH / 2) - 13, 4), 4, 25, 25));
layer_set_update_proc(s_sleep_icon_layer, sleep_icon_update_proc); layer_set_update_proc(s_sleep_icon_layer, sleep_icon_update_proc);
// pin icon // pin icon
s_pin_icon_layer = layer_create(GRect(PBL_DISPLAY_WIDTH-25, (PBL_DISPLAY_HEIGHT/2)-13, 50, 50)); s_pin_icon_layer = layer_create(GRect(PBL_DISPLAY_WIDTH - PBL_IF_ROUND_ELSE(27, 25), (PBL_DISPLAY_HEIGHT / 2) - 13, 25, 25));
layer_set_update_proc(s_pin_icon_layer, pin_icon_update_proc); layer_set_update_proc(s_pin_icon_layer, pin_icon_update_proc);
// sleep time
s_sleep_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(24, -2), PBL_DISPLAY_WIDTH, 30));
text_layer_set_background_color(s_sleep_time_layer, GColorClear);
#if PBL_DISPLAY_WIDTH >= 200 #if PBL_DISPLAY_WIDTH >= 200
s_sleep_bar_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_IF_ROUND_ELSE(53, 31)));
s_sleep_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(21, -2), PBL_DISPLAY_WIDTH, 30));
s_last_watched_layer = text_layer_create(GRect(0, PBL_DISPLAY_HEIGHT / 2 - 20, PBL_DISPLAY_WIDTH - 4, PBL_DISPLAY_HEIGHT));
text_layer_set_font(s_sleep_time_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_font(s_sleep_time_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
#else
text_layer_set_font(s_sleep_time_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
#endif
text_layer_set_text_alignment(s_sleep_time_layer, GTextAlignmentCenter); text_layer_set_text_alignment(s_sleep_time_layer, GTextAlignmentCenter);
text_layer_set_font(s_last_watched_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));
#else
s_sleep_bar_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_IF_ROUND_ELSE(49, 31)));
s_sleep_time_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(0, 31), PBL_IF_ROUND_ELSE(24, 6), PBL_DISPLAY_WIDTH, 30));
s_last_watched_layer = text_layer_create(GRect(0, PBL_DISPLAY_HEIGHT / 2 - 17, PBL_DISPLAY_WIDTH - 4, PBL_DISPLAY_HEIGHT));
text_layer_set_font(s_sleep_time_layer, fonts_get_system_font(PBL_IF_ROUND_ELSE(FONT_KEY_GOTHIC_18_BOLD, FONT_KEY_GOTHIC_14_BOLD)));
text_layer_set_text_alignment(s_sleep_time_layer, PBL_IF_ROUND_ELSE(GTextAlignmentCenter, GTextAlignmentLeft));
text_layer_set_font(s_last_watched_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
#endif
// sleep time
text_layer_set_background_color(s_sleep_time_layer, GColorClear);
text_layer_set_text_color(s_sleep_time_layer, GColorWhite); text_layer_set_text_color(s_sleep_time_layer, GColorWhite);
if (s_sleep_timestamp != 0) { if (s_sleep_timestamp != 0) {
static char buffer[8]; static char buffer[8];
@@ -112,15 +117,11 @@ static void main_window_load(Window *window) {
text_layer_set_text(s_sleep_time_layer, "No sleep last night"); text_layer_set_text(s_sleep_time_layer, "No sleep last night");
} }
// watched title // misc. properties
s_last_watched_layer = text_layer_create(GRect(0, PBL_DISPLAY_HEIGHT / 2 - 24, PBL_DISPLAY_WIDTH - 4, PBL_DISPLAY_HEIGHT)); layer_set_update_proc(s_sleep_bar_layer, sleep_bar_update_proc);
text_layer_set_background_color(s_last_watched_layer, GColorClear); text_layer_set_background_color(s_last_watched_layer, GColorClear);
text_layer_set_text_color(s_last_watched_layer, GColorWhite); text_layer_set_text_color(s_last_watched_layer, GColorWhite);
#if PBL_DISPLAY_WIDTH >= 200
text_layer_set_font(s_last_watched_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));
#else
text_layer_set_font(s_last_watched_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
#endif
if (s_sleep_data_accessible) { if (s_sleep_data_accessible) {
text_layer_set_text(s_last_watched_layer, "N/A"); // default - will be updated before display text_layer_set_text(s_last_watched_layer, "N/A"); // default - will be updated before display
} else { } else {
@@ -176,7 +177,11 @@ static void init() {
// load PDCs // load PDCs
s_sleep_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_SLEEP_ICON); s_sleep_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_SLEEP_ICON);
#if PBL_ROUND
s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ROUND_JELLYFIN_ICON);
#else
s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ICON); s_pin_icon = gdraw_command_image_create_with_resource(RESOURCE_ID_PIN_ICON);
#endif
window_stack_push(s_main_window, true); window_stack_push(s_main_window, true);
} }