mirror of
https://git.wetfence.xyz/RandyTheSilly/Trigalarm.git
synced 2026-08-27 22:26:25 -04:00
Add set alarm time to status success page; improve alignment of status text
This commit is contained in:
+5
-4
@@ -118,29 +118,30 @@ static void status_2_click_config_provider(void *ctx) {
|
|||||||
|
|
||||||
static void status_window_load(StatusWindowPurpose purpose) {
|
static void status_window_load(StatusWindowPurpose purpose) {
|
||||||
Layer *window_layer = window_get_root_layer(s_status_window);
|
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) {
|
switch (purpose) {
|
||||||
case STATUS_CONFIRMATION:
|
case STATUS_CONFIRMATION:
|
||||||
tick_timer_service_unsubscribe();
|
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_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);
|
window_set_click_config_provider(s_status_window, status_0_click_config_provider);
|
||||||
break;
|
break;
|
||||||
case STATUS_SET_FAILURE:
|
case STATUS_SET_FAILURE:
|
||||||
tick_timer_service_unsubscribe();
|
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_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.");
|
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);
|
window_set_click_config_provider(s_status_window, status_1_click_config_provider);
|
||||||
break;
|
break;
|
||||||
case 2:
|
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_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!");
|
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);
|
window_set_click_config_provider(s_status_window, status_2_click_config_provider);
|
||||||
}
|
}
|
||||||
text_layer_set_background_color(s_status_txt_layer, GColorClear);
|
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);
|
text_layer_set_text_alignment(s_status_txt_layer, GTextAlignmentCenter);
|
||||||
|
|
||||||
layer_add_child(window_layer, text_layer_get_layer(s_status_txt_layer));
|
layer_add_child(window_layer, text_layer_get_layer(s_status_txt_layer));
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include <pebble.h>
|
#include <pebble.h>
|
||||||
|
|
||||||
|
struct TheTime the_time;
|
||||||
|
|
||||||
static void glance_reload_callback(AppGlanceReloadSession *session, size_t limit, void *target) {
|
static void glance_reload_callback(AppGlanceReloadSession *session, size_t limit, void *target) {
|
||||||
static char s_glance_buffer[22];
|
static char s_glance_buffer[22];
|
||||||
time_t alarm_time = (time_t)(uintptr_t)target;
|
time_t alarm_time = (time_t)(uintptr_t)target;
|
||||||
|
|||||||
+1
-1
@@ -15,6 +15,6 @@ typedef struct TheTime {
|
|||||||
uint8_t MinuteSet;
|
uint8_t MinuteSet;
|
||||||
} __attribute__((__packed__)) TheTime;
|
} __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);
|
WakeupId wakeup_schedule_simple_robust(time_t wakeup_time, int8_t retry_diff, WakeupReason wakeup_reason);
|
||||||
|
|||||||
Reference in New Issue
Block a user