Improve sleep time alignment and pin icon design across platforms

This commit is contained in:
2026-05-03 16:52:42 -04:00
parent 4c97fba9f8
commit b598bbb8cb
2 changed files with 15 additions and 11 deletions

View File

@@ -5,8 +5,8 @@ static Animation *s_pin_stroke_anim;
static Layer *s_pin_layer; static Layer *s_pin_layer;
static uint8_t get_stroke_width_for_progress(AnimationProgress progress) { static uint8_t get_stroke_width_for_progress(AnimationProgress progress) {
const uint8_t min_width = 1; const uint8_t min_width = PBL_IF_ROUND_ELSE(1, 2);
const uint8_t max_width = 3; const uint8_t max_width = PBL_IF_ROUND_ELSE(3, 4);
const uint8_t delta = max_width - min_width; const uint8_t delta = max_width - min_width;
const AnimationProgress half = ANIMATION_NORMALIZED_MAX / 2; const AnimationProgress half = ANIMATION_NORMALIZED_MAX / 2;
@@ -30,7 +30,7 @@ static void pin_stroke_anim_stopped(Animation *animation, bool finished, void *c
void pin_animation_init(Layer *pin_layer) { void pin_animation_init(Layer *pin_layer) {
s_pin_layer = pin_layer; s_pin_layer = pin_layer;
s_pin_stroke_width = 1; s_pin_stroke_width = PBL_IF_ROUND_ELSE(1, 2);
} }
void pin_animation_start(void) { void pin_animation_start(void) {

View File

@@ -64,12 +64,8 @@ static void draw_pin() {
GDrawCommand *command = gdraw_command_list_get_command(command_list, i); GDrawCommand *command = gdraw_command_list_get_command(command_list, i);
if (command) { if (command) {
#if PBL_ROUND #if PBL_ROUND
if (s_is_jellyfin == 1) {
gdraw_command_set_stroke_color(command, GColorPictonBlue);
} else {
gdraw_command_set_stroke_color(command, GColorLightGray);
}
gdraw_command_set_fill_color(command, GColorClear); gdraw_command_set_fill_color(command, GColorClear);
gdraw_command_set_stroke_color(command, s_color_secondary);
#endif #endif
gdraw_command_set_stroke_width(command, pin_animation_get_stroke_width()); gdraw_command_set_stroke_width(command, pin_animation_get_stroke_width());
} }
@@ -117,9 +113,9 @@ static void main_window_load(Window *window) {
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)); text_layer_set_font(s_last_watched_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));
#else #else
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_sleep_time_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(0, 31), PBL_IF_ROUND_ELSE(24, 3), PBL_DISPLAY_WIDTH, 30));
s_last_watched_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(28, 4), PBL_DISPLAY_HEIGHT / 2 - 17, PBL_DISPLAY_WIDTH - PBL_IF_ROUND_ELSE(56, 29), PBL_DISPLAY_HEIGHT)); s_last_watched_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(28, 4), PBL_DISPLAY_HEIGHT / 2 - 17, PBL_DISPLAY_WIDTH - PBL_IF_ROUND_ELSE(56, 29), 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_font(s_sleep_time_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
text_layer_set_text_alignment(s_sleep_time_layer, PBL_IF_ROUND_ELSE(GTextAlignmentCenter, GTextAlignmentLeft)); 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)); text_layer_set_font(s_last_watched_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
#endif #endif
@@ -133,7 +129,15 @@ static void main_window_load(Window *window) {
strftime(buffer, sizeof(buffer), clock_is_24h_style() ? "%H:%M" : "%I:%M", timeinfo); strftime(buffer, sizeof(buffer), clock_is_24h_style() ? "%H:%M" : "%I:%M", timeinfo);
text_layer_set_text(s_sleep_time_layer, buffer); text_layer_set_text(s_sleep_time_layer, buffer);
} else { } else {
text_layer_set_text(s_sleep_time_layer, "No sleep times found"); #if PBL_RECT
#if PBL_DISPLAY_WIDTH >= 200
text_layer_set_text(s_sleep_time_layer, " No sleep time found");
#else
text_layer_set_text(s_sleep_time_layer, "No sleep time");
#endif
#else
text_layer_set_text(s_sleep_time_layer, "No sleep time found");
#endif
} }
layer_set_hidden(text_layer_get_layer(s_sleep_time_layer), true); layer_set_hidden(text_layer_get_layer(s_sleep_time_layer), true);