Add set alarm time to status success page; improve alignment of status text

This commit is contained in:
2026-08-14 00:32:33 -04:00
parent db3294d89b
commit f97e18ac48
3 changed files with 8 additions and 5 deletions
+5 -4
View File
@@ -118,29 +118,30 @@ static void status_2_click_config_provider(void *ctx) {
static void status_window_load(StatusWindowPurpose purpose) {
Layer *window_layer = window_get_root_layer(s_status_window);
s_status_txt_layer = text_layer_create(GRect(0, 0, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
switch (purpose) {
case STATUS_CONFIRMATION:
tick_timer_service_unsubscribe();
s_status_txt_layer = text_layer_create(GRect(0, 8, PBL_DISPLAY_WIDTH, 500));
text_layer_set_font(s_status_txt_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
text_layer_set_text(s_status_txt_layer, "Alarm disarmed and re-set successfully.");
static char s_status_confirmed_buffer[105];
snprintf(s_status_confirmed_buffer, sizeof(s_status_confirmed_buffer), "Alarm disarmed and re-set (%02u:%02u) successfully.\n\nPress SELECT to exit or BACK to change the alarm time.", the_time.HourSet, the_time.MinuteSet);
text_layer_set_text(s_status_txt_layer, s_status_confirmed_buffer);
window_set_click_config_provider(s_status_window, status_0_click_config_provider);
break;
case STATUS_SET_FAILURE:
tick_timer_service_unsubscribe();
s_status_txt_layer = text_layer_create(GRect(0, PBL_DISPLAY_HEIGHT / 2, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
text_layer_set_font(s_status_txt_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));
text_layer_set_text(s_status_txt_layer, "Failed to set an alarm.\nPress any button to return to alarm setter.");
window_set_click_config_provider(s_status_window, status_1_click_config_provider);
break;
case 2:
s_status_txt_layer = text_layer_create(GRect(0, (PBL_DISPLAY_HEIGHT / 2) - 37, PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
text_layer_set_font(s_status_txt_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28));
text_layer_set_text(s_status_txt_layer, "Incorrect equation.\nTry again!");
window_set_click_config_provider(s_status_window, status_2_click_config_provider);
}
text_layer_set_background_color(s_status_txt_layer, GColorClear);
layer_set_frame(text_layer_get_layer(s_status_txt_layer), GRect(0, (PBL_DISPLAY_HEIGHT / 2) - (text_layer_get_content_size(s_status_txt_layer).h / 2), PBL_DISPLAY_WIDTH, PBL_DISPLAY_HEIGHT));
text_layer_set_text_alignment(s_status_txt_layer, GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(s_status_txt_layer));
+2
View File
@@ -1,6 +1,8 @@
#include "scheduler.h"
#include <pebble.h>
struct TheTime the_time;
static void glance_reload_callback(AppGlanceReloadSession *session, size_t limit, void *target) {
static char s_glance_buffer[22];
time_t alarm_time = (time_t)(uintptr_t)target;
+1 -1
View File
@@ -15,6 +15,6 @@ typedef struct TheTime {
uint8_t MinuteSet;
} __attribute__((__packed__)) TheTime;
struct TheTime the_time;
extern struct TheTime the_time;
WakeupId wakeup_schedule_simple_robust(time_t wakeup_time, int8_t retry_diff, WakeupReason wakeup_reason);