Improve sleep time alignment and pin icon design across platforms
This commit is contained in:
@@ -5,8 +5,8 @@ static Animation *s_pin_stroke_anim;
|
||||
static Layer *s_pin_layer;
|
||||
|
||||
static uint8_t get_stroke_width_for_progress(AnimationProgress progress) {
|
||||
const uint8_t min_width = 1;
|
||||
const uint8_t max_width = 3;
|
||||
const uint8_t min_width = PBL_IF_ROUND_ELSE(1, 2);
|
||||
const uint8_t max_width = PBL_IF_ROUND_ELSE(3, 4);
|
||||
const uint8_t delta = max_width - min_width;
|
||||
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) {
|
||||
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) {
|
||||
|
||||
20
src/c/main.c
20
src/c/main.c
@@ -64,12 +64,8 @@ static void draw_pin() {
|
||||
GDrawCommand *command = gdraw_command_list_get_command(command_list, i);
|
||||
if (command) {
|
||||
#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_stroke_color(command, s_color_secondary);
|
||||
#endif
|
||||
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_font(s_last_watched_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));
|
||||
#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));
|
||||
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_font(s_last_watched_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
|
||||
#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);
|
||||
text_layer_set_text(s_sleep_time_layer, buffer);
|
||||
} 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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user