More alignment fixes
This commit is contained in:
31
src/c/main.c
31
src/c/main.c
@@ -3,7 +3,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define DEBUG_MODE 1
|
// #define DEBUG_MODE 1
|
||||||
|
|
||||||
// declare settings-derived statics
|
// declare settings-derived statics
|
||||||
static uint8_t s_is_jellyfin;
|
static uint8_t s_is_jellyfin;
|
||||||
@@ -21,6 +21,15 @@ static Layer *s_sleep_icon_layer;
|
|||||||
static Layer *s_pin_icon_layer;
|
static Layer *s_pin_icon_layer;
|
||||||
static GDrawCommandImage *s_sleep_icon;
|
static GDrawCommandImage *s_sleep_icon;
|
||||||
static GDrawCommandImage *s_pin_icon;
|
static GDrawCommandImage *s_pin_icon;
|
||||||
|
#if PBL_ROUND
|
||||||
|
#if PBL_DISPLAY_WIDTH >= 200
|
||||||
|
static const uint8_t s_sleep_bar_drop = 53;
|
||||||
|
#else
|
||||||
|
static const uint8_t s_sleep_bar_drop = 49;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
static const uint8_t s_sleep_bar_drop = 31;
|
||||||
|
#endif
|
||||||
|
|
||||||
// declare animation statics
|
// declare animation statics
|
||||||
static GRect s_sleep_bar_start = GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT);
|
static GRect s_sleep_bar_start = GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT);
|
||||||
@@ -106,19 +115,19 @@ static void main_window_load(Window *window) {
|
|||||||
layer_set_update_proc(s_pin_icon_layer, pin_icon_update_proc);
|
layer_set_update_proc(s_pin_icon_layer, pin_icon_update_proc);
|
||||||
pin_animation_init(s_pin_icon_layer);
|
pin_animation_init(s_pin_icon_layer);
|
||||||
|
|
||||||
|
uint8_t margin = PBL_DISPLAY_WIDTH / 35;
|
||||||
|
s_last_watched_layer = text_layer_create(GRect(PBL_IF_ROUND_ELSE(28, margin), s_sleep_bar_drop + margin, PBL_DISPLAY_WIDTH - PBL_IF_ROUND_ELSE(56, 29), PBL_DISPLAY_HEIGHT));
|
||||||
#if PBL_DISPLAY_WIDTH >= 200
|
#if PBL_DISPLAY_WIDTH >= 200
|
||||||
s_sleep_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(21, -2), PBL_DISPLAY_WIDTH, 30));
|
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(PBL_IF_ROUND_ELSE(28, 4), PBL_DISPLAY_HEIGHT / 2 - 20, PBL_DISPLAY_WIDTH - PBL_IF_ROUND_ELSE(56, 29), 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));
|
||||||
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, -2), PBL_DISPLAY_WIDTH, 30));
|
s_sleep_time_layer = text_layer_create(GRect(0, PBL_IF_ROUND_ELSE(24, -2), 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_24_BOLD)));
|
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)));
|
||||||
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
|
||||||
|
text_layer_set_text_alignment(s_sleep_time_layer, GTextAlignmentCenter);
|
||||||
|
text_layer_set_text_alignment(s_last_watched_layer, GTextAlignmentCenter);
|
||||||
|
|
||||||
// sleep time
|
// sleep time
|
||||||
text_layer_set_background_color(s_sleep_time_layer, GColorClear);
|
text_layer_set_background_color(s_sleep_time_layer, GColorClear);
|
||||||
@@ -153,9 +162,7 @@ static void main_window_load(Window *window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add layers as children to windows
|
// add layers as children to windows
|
||||||
#if PBL_ROUND
|
#if PBL_RECT
|
||||||
text_layer_set_text_alignment(s_last_watched_layer, GTextAlignmentCenter);
|
|
||||||
#else
|
|
||||||
// button bar
|
// button bar
|
||||||
s_button_bar_layer = layer_create(GRect(PBL_DISPLAY_WIDTH - 25, 0, 25, PBL_DISPLAY_HEIGHT));
|
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_set_update_proc(s_button_bar_layer, button_bar_update_proc);
|
||||||
@@ -288,11 +295,7 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
|||||||
Tuple *watched_tuple = dict_find(iter, MESSAGE_KEY_PKJS_LAST_WATCHED);
|
Tuple *watched_tuple = dict_find(iter, MESSAGE_KEY_PKJS_LAST_WATCHED);
|
||||||
if (watched_tuple) {
|
if (watched_tuple) {
|
||||||
text_layer_set_text(s_last_watched_layer, watched_tuple->value->cstring);
|
text_layer_set_text(s_last_watched_layer, watched_tuple->value->cstring);
|
||||||
#if PBL_DISPLAY_WIDTH >= 200
|
PropertyAnimation *sleep_bar_prop = property_animation_create_layer_frame(s_sleep_bar_layer, &s_sleep_bar_start, &GRect(0, -PBL_DISPLAY_HEIGHT + s_sleep_bar_drop, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
|
||||||
PropertyAnimation *sleep_bar_prop = property_animation_create_layer_frame(s_sleep_bar_layer, &s_sleep_bar_start, &GRect(0, -PBL_DISPLAY_HEIGHT + PBL_IF_ROUND_ELSE(53, 31), PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
|
|
||||||
#else
|
|
||||||
PropertyAnimation *sleep_bar_prop = property_animation_create_layer_frame(s_sleep_bar_layer, &s_sleep_bar_start, &GRect(0, -PBL_DISPLAY_HEIGHT + PBL_IF_ROUND_ELSE(49, 31), PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
|
|
||||||
#endif
|
|
||||||
Animation *sleep_bar_anim = property_animation_get_animation(sleep_bar_prop);
|
Animation *sleep_bar_anim = property_animation_get_animation(sleep_bar_prop);
|
||||||
animation_set_duration(sleep_bar_anim, 512);
|
animation_set_duration(sleep_bar_anim, 512);
|
||||||
PropertyAnimation *sleep_icon_prop = property_animation_create_layer_frame(s_sleep_icon_layer, &s_sleep_icon_start, &GRect(PBL_IF_ROUND_ELSE((PBL_DISPLAY_WIDTH / 2) - 13, 4), 4, 25, 25));
|
PropertyAnimation *sleep_icon_prop = property_animation_create_layer_frame(s_sleep_icon_layer, &s_sleep_icon_start, &GRect(PBL_IF_ROUND_ELSE((PBL_DISPLAY_WIDTH / 2) - 13, 4), 4, 25, 25));
|
||||||
|
|||||||
Reference in New Issue
Block a user