Hide button bar on round watches; scale fonts based on display width; use fixed version of sleep icon that displays properly without AA

This commit is contained in:
2026-04-24 18:49:20 -04:00
parent 6d820e01fd
commit 8da2f9f1ef
3 changed files with 31 additions and 12 deletions

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 20.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" viewBox="0 0 25 23" xml:space="preserve">
<polygon fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
18,1 24,7 24,15 17,22 9,22 7,20 1,22 4,17 2,15 2,7 8,1 "/>
<polyline fill="#FFFFFF" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
9,8 16,8 9,15 16,15 "/>
</svg>

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

View File

@@ -59,7 +59,7 @@ static void update_sleep_time(time_t start, time_t end) {
} }
static void button_bar_update_proc(Layer *layer, GContext *ctx) { static void button_bar_update_proc(Layer *layer, GContext *ctx) {
graphics_context_set_fill_color(ctx, GColorLiberty); graphics_context_set_fill_color(ctx, GColorPictonBlue);
graphics_fill_rect(ctx, layer_get_bounds(layer), 0, GCornerNone); graphics_fill_rect(ctx, layer_get_bounds(layer), 0, GCornerNone);
} }
@@ -69,14 +69,11 @@ static void sleep_bar_update_proc(Layer *layer, GContext *ctx) {
} }
static void sleep_icon_update_proc(Layer *layer, GContext *ctx) { static void sleep_icon_update_proc(Layer *layer, GContext *ctx) {
graphics_context_set_antialiased(ctx, false);
gdraw_command_image_draw(ctx, s_sleep_icon, GPoint(0, 0)); gdraw_command_image_draw(ctx, s_sleep_icon, GPoint(0, 0));
} }
static void main_window_load(Window *window) { static void main_window_load(Window *window) {
// button bar
s_button_bar_layer = layer_create(GRect(PBL_DISPLAY_WIDTH - 25, 0, 25, PBL_DISPLAY_HEIGHT));
layer_set_update_proc(s_button_bar_layer, button_bar_update_proc);
// sleep bar // sleep bar
s_sleep_bar_layer = layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_IF_ROUND_ELSE(49, 31))); 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); layer_set_update_proc(s_sleep_bar_layer, sleep_bar_update_proc);
@@ -88,7 +85,11 @@ static void main_window_load(Window *window) {
// sleep time // sleep time
s_sleep_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(24, -2), PBL_DISPLAY_WIDTH, 30)); 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); text_layer_set_background_color(s_sleep_time_layer, GColorClear);
text_layer_set_font(s_sleep_time_layer, fonts_get_system_font(PBL_IF_ROUND_ELSE(FONT_KEY_GOTHIC_18_BOLD, FONT_KEY_GOTHIC_24_BOLD))); #if PBL_DISPLAY_WIDTH >= 200
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_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) {
@@ -103,20 +104,28 @@ static void main_window_load(Window *window) {
// watched title // watched title
s_last_watched_layer = text_layer_create(GRect(0, PBL_DISPLAY_HEIGHT / 2 - 24, PBL_DISPLAY_WIDTH - 4, PBL_DISPLAY_HEIGHT)); s_last_watched_layer = text_layer_create(GRect(0, PBL_DISPLAY_HEIGHT / 2 - 24, PBL_DISPLAY_WIDTH - 4, PBL_DISPLAY_HEIGHT));
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);
#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)); 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 {
text_layer_set_text(s_last_watched_layer, "Sleep data inaccessible!\nEnsure Pebble Health is enabled."); text_layer_set_text(s_last_watched_layer, "Sleep data inaccessible!\nEnsure Pebble Health is enabled.");
} }
#if PBL_ROUND
text_layer_set_text_alignment(s_last_watched_layer, GTextAlignmentCenter);
#endif
// add layers as children to windows // add layers as children to windows
Layer *window_layer = window_get_root_layer(window); Layer *window_layer = window_get_root_layer(window);
#if PBL_ROUND
text_layer_set_text_alignment(s_last_watched_layer, GTextAlignmentCenter);
#else
// button bar
s_button_bar_layer = layer_create(GRect(PBL_DISPLAY_WIDTH - 25, 0, 25, PBL_DISPLAY_HEIGHT));
layer_set_update_proc(s_button_bar_layer, button_bar_update_proc);
layer_add_child(window_layer, s_button_bar_layer); layer_add_child(window_layer, s_button_bar_layer);
#endif
layer_add_child(window_layer, s_sleep_bar_layer); layer_add_child(window_layer, s_sleep_bar_layer);
layer_add_child(window_layer, s_sleep_icon_layer); layer_add_child(window_layer, s_sleep_icon_layer);
layer_add_child(window_layer, text_layer_get_layer(s_sleep_time_layer)); layer_add_child(window_layer, text_layer_get_layer(s_sleep_time_layer));
@@ -134,6 +143,7 @@ static void main_window_unload(Window *window) {
static void init() { static void init() {
// initialize window // initialize window
s_main_window = window_create(); s_main_window = window_create();
window_set_background_color(s_main_window, GColorBlack);
window_set_window_handlers( window_set_window_handlers(
s_main_window, s_main_window,
(WindowHandlers){.load = main_window_load, .unload = main_window_unload}); (WindowHandlers){.load = main_window_load, .unload = main_window_unload});