Support time mg in timeline peak support
This commit is contained in:
+35
-1
@@ -32,6 +32,7 @@ static GColor s_applied_time_date = GColorWhite;
|
||||
static GBitmap *s_font_bitmaps[10];
|
||||
static GBitmap *s_font_bitmaps_mini[10];
|
||||
static GBitmap *s_time_mg_super8;
|
||||
static GBitmap *s_time_mg_super8_mini;
|
||||
static GBitmap *s_c_icon;
|
||||
static GBitmap *s_h_icon;
|
||||
static GBitmap *s_e_icon;
|
||||
@@ -200,10 +201,18 @@ static void update_minute_1() {
|
||||
s_time_digits[3] = minute % 10;
|
||||
|
||||
if (!s_peek_active) {
|
||||
if (settings.ShowTimeMG) {
|
||||
bitmap_layer_set_bitmap(s_time_mg_layers[2], s_time_mg_super8);
|
||||
bitmap_layer_set_bitmap(s_time_mg_layers[3], s_time_mg_super8);
|
||||
}
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
bitmap_layer_set_bitmap(s_time_fg_layers[i], s_font_bitmaps[s_time_digits[i]]);
|
||||
}
|
||||
} else {
|
||||
if (settings.ShowTimeMG) {
|
||||
bitmap_layer_set_bitmap(s_time_mg_layers[2], s_time_mg_super8_mini);
|
||||
bitmap_layer_set_bitmap(s_time_mg_layers[3], s_time_mg_super8_mini);
|
||||
}
|
||||
bitmap_layer_set_bitmap(s_time_fg_layers[0], s_font_bitmaps[s_time_digits[0]]);
|
||||
bitmap_layer_set_bitmap(s_time_fg_layers[1], s_font_bitmaps[s_time_digits[1]]);
|
||||
bitmap_layer_set_bitmap(s_time_fg_layers[2], s_font_bitmaps_mini[s_time_digits[2]]);
|
||||
@@ -260,10 +269,18 @@ static void peek_change(AnimationProgress progress, void *context) {
|
||||
if (!s_peek_active) {
|
||||
layer_set_frame(bitmap_layer_get_layer(s_time_fg_layers[2]), s_time_grects[2]);
|
||||
layer_set_frame(bitmap_layer_get_layer(s_time_fg_layers[3]), s_time_grects[3]);
|
||||
if (settings.ShowTimeMG) {
|
||||
layer_set_frame(bitmap_layer_get_layer(s_time_mg_layers[2]), s_time_grects[2]);
|
||||
layer_set_frame(bitmap_layer_get_layer(s_time_mg_layers[3]), s_time_grects[3]);
|
||||
}
|
||||
} else {
|
||||
uint8_t y = s_time_grects[2].origin.y - 1;
|
||||
layer_set_frame(bitmap_layer_get_layer(s_time_fg_layers[2]), GRect(s_time_grects[2].origin.x, y, 69, 54));
|
||||
layer_set_frame(bitmap_layer_get_layer(s_time_fg_layers[3]), GRect(s_time_grects[3].origin.x, y, 69, 54));
|
||||
if (settings.ShowTimeMG) {
|
||||
layer_set_frame(bitmap_layer_get_layer(s_time_mg_layers[2]), GRect(s_time_grects[2].origin.x, y, 69, 54));
|
||||
layer_set_frame(bitmap_layer_get_layer(s_time_mg_layers[3]), GRect(s_time_grects[3].origin.x, y, 69, 54));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +380,7 @@ static void apply_settings() {
|
||||
}
|
||||
|
||||
// re-sub timeline peek and create/destroy resources as needed
|
||||
// TODO add mg support, fix broken-ness when toggling peak support off while running
|
||||
// TODO fix fg and mg color not applying to mini varients
|
||||
unobstructed_area_service_unsubscribe();
|
||||
if (settings.EnablePeek) {
|
||||
if (!s_font_bitmaps_mini[0]) {
|
||||
@@ -378,6 +395,16 @@ static void apply_settings() {
|
||||
s_font_bitmaps_mini[8] = gbitmap_create_with_resource(RESOURCE_ID_8_M);
|
||||
s_font_bitmaps_mini[9] = gbitmap_create_with_resource(RESOURCE_ID_9_M);
|
||||
}
|
||||
if (!s_time_mg_super8_mini) {
|
||||
if (settings.ShowTimeMG) {
|
||||
s_time_mg_super8_mini = gbitmap_create_with_resource(RESOURCE_ID_SUPER8_M);
|
||||
}
|
||||
} else {
|
||||
if (!settings.ShowTimeMG) {
|
||||
gbitmap_destroy(s_time_mg_super8_mini);
|
||||
s_time_mg_super8_mini = NULL;
|
||||
}
|
||||
}
|
||||
peek_will_change(layer_get_unobstructed_bounds(s_window_layer), NULL);
|
||||
peek_change(0, NULL);
|
||||
peek_did_change(NULL);
|
||||
@@ -397,6 +424,10 @@ static void apply_settings() {
|
||||
s_font_bitmaps_mini[i] = NULL;
|
||||
}
|
||||
}
|
||||
if (s_time_mg_super8_mini) {
|
||||
gbitmap_destroy(s_time_mg_super8_mini);
|
||||
s_time_mg_super8_mini = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_first_settings_application) {
|
||||
@@ -455,6 +486,9 @@ static void main_window_unload() {
|
||||
bitmap_layer_destroy(s_e_layer);
|
||||
bitmap_layer_destroy(s_h_layer);
|
||||
bitmap_layer_destroy(s_c_layer);
|
||||
if (s_time_mg_super8_mini) {
|
||||
gbitmap_destroy(s_time_mg_super8_mini);
|
||||
}
|
||||
if (s_time_mg_super8) {
|
||||
gbitmap_destroy(s_time_mg_super8);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user