Use new recolor helper in bt_callback
This commit is contained in:
+10
-13
@@ -96,6 +96,15 @@ static void toggle_temp_warning_state(bool enable_warning, bool force) {
|
||||
s_temp_is_warning = enable_warning;
|
||||
}
|
||||
|
||||
static void recolor_digit_bitmaps(GBitmap **bitmaps, GColor *applied, GColor new_color) {
|
||||
if (applied->argb == new_color.argb)
|
||||
return;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
replace_gbitmap_color(*applied, new_color, bitmaps[i], NULL);
|
||||
}
|
||||
*applied = new_color;
|
||||
}
|
||||
|
||||
static void bt_callback(bool connected) {
|
||||
GColor dst = connected ? settings.ColorHours : settings.ColorWarning;
|
||||
if (s_first_settings_application && connected && dst.argb == s_applied_hour.argb) {
|
||||
@@ -103,13 +112,10 @@ static void bt_callback(bool connected) {
|
||||
// for those using white fg, do not pointlessly replace white at startup if that is the destination anyway
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
replace_gbitmap_color(s_applied_hour, dst, s_hour_bitmaps[i], NULL);
|
||||
}
|
||||
recolor_digit_bitmaps(s_hour_bitmaps, &s_applied_hour, dst);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
layer_mark_dirty(bitmap_layer_get_layer(s_digit_fg_layers[i]));
|
||||
}
|
||||
s_applied_hour = dst;
|
||||
}
|
||||
|
||||
static void batt_callback(BatteryChargeState state) {
|
||||
@@ -310,15 +316,6 @@ static void peek_did_change(void *context) {
|
||||
}
|
||||
}
|
||||
|
||||
static void recolor_digit_bitmaps(GBitmap **bitmaps, GColor *applied, GColor new_color) {
|
||||
if (applied->argb == new_color.argb)
|
||||
return;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
replace_gbitmap_color(*applied, new_color, bitmaps[i], NULL);
|
||||
}
|
||||
*applied = new_color;
|
||||
}
|
||||
|
||||
static void apply_settings() {
|
||||
bool force_update_minutes = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user