Finish fitting to each platform

This commit is contained in:
2026-04-12 01:23:47 -04:00
parent f43f540a32
commit b6551abdde

View File

@@ -18,7 +18,11 @@ static TextLayer *s_bitwidth_text_layer;
static char s_cidr_text[24];
static char s_mask_text[32];
static char s_usable_hosts_text[40];
#if PBL_DISPLAY_WIDTH > 180
static char s_bitwidth_text[37];
#else
static char s_bitwidth_text[36];
#endif
static uint8_t s_current_prefix = 24;
static bool s_up_boundary_haptic_sent = false;
static bool s_down_boundary_haptic_sent = false;
@@ -120,6 +124,7 @@ static void update_result_text(void) {
snprintf(s_mask_text, sizeof(s_mask_text), "\nMask:\n%s", mask_text);
snprintf(s_usable_hosts_text, sizeof(s_usable_hosts_text), "\nUsable Hosts:\n%llu", usable_hosts);
#else
snprintf(s_mask_text, sizeof(s_mask_text), "Mask: %s", mask_text);
#if PBL_PLATFORM_CHALK
snprintf(s_usable_hosts_text, sizeof(s_usable_hosts_text), "Usable Hosts:\n%llu", usable_hosts);
#else
@@ -127,7 +132,12 @@ static void update_result_text(void) {
#endif
#endif
#if PBL_DISPLAY_WIDTH > 180
s_bitwidth_text[0] = '\n';
int pos = 1;
#else
int pos = 0;
#endif
for (int i = 0; i < 32; i++) {
s_bitwidth_text[pos++] = (i < s_current_prefix) ? '1' : '0';
if (i == 7 || i == 15 || i == 23) {
@@ -373,7 +383,11 @@ static void result_window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
#if PBL_DISPLAY_WIDTH > 144
#if PBL_PLATFORM_CHALK
s_bitwidth_text_layer = text_layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, 14));
#else
s_bitwidth_text_layer = text_layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, 56));
#endif
text_layer_set_background_color(s_bitwidth_text_layer, GColorClear);
text_layer_set_text_color(s_bitwidth_text_layer, GColorLightGray);
text_layer_set_font(s_bitwidth_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_09));