From fdd81320a7cb959609887f318c53d3c8028d7b58 Mon Sep 17 00:00:00 2001
From: James Barr <jbarr@uber.com>
Date: Sun, 19 Nov 2023 22:05:59 -0800
Subject: [PATCH] Update zaphod_lite status screen to match zaphod

---
 .../zaphod_lite/zaphod_status_screen.c        | 38 +++++++++----------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/boards/shields/zaphod_lite/zaphod_status_screen.c b/boards/shields/zaphod_lite/zaphod_status_screen.c
index e97f8979..8ffe4109 100644
--- a/boards/shields/zaphod_lite/zaphod_status_screen.c
+++ b/boards/shields/zaphod_lite/zaphod_status_screen.c
@@ -10,7 +10,7 @@
 #include <zmk/display/widgets/wpm_status.h>
 #include <zmk/display/status_screen.h>
 
-#include <logging/log.h>
+#include <zephyr/logging/log.h>
 LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
 
 #if IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
@@ -47,52 +47,52 @@ lv_obj_t *zmk_display_status_screen() {
     lv_obj_t *center_frame;
 
     lv_style_init(&global_style);
-    lv_style_set_text_font(&global_style, LV_STATE_DEFAULT, &lv_font_montserrat_26);
-    lv_style_set_text_letter_space(&global_style, LV_STATE_DEFAULT, 1);
-    lv_style_set_text_line_space(&global_style, LV_STATE_DEFAULT, 1);
+    lv_style_set_text_font(&global_style, &lv_font_montserrat_26);
+    lv_style_set_text_letter_space(&global_style, 1);
+    lv_style_set_text_line_space(&global_style, 1);
 
-    screen = lv_obj_create(NULL, NULL);
-    lv_obj_add_style(screen, LV_LABEL_PART_MAIN, &global_style);
+    screen = lv_obj_create(NULL);
+    lv_obj_add_style(screen, &global_style, LV_PART_MAIN);
 
 #if IS_ENABLED(CONFIG_ZMK_WIDGET_BATTERY_STATUS)
     zmk_widget_battery_status_init(&battery_status_widget, screen);
-    lv_obj_align(zmk_widget_battery_status_obj(&battery_status_widget), NULL, LV_ALIGN_IN_TOP_RIGHT,
+    lv_obj_align(zmk_widget_battery_status_obj(&battery_status_widget), LV_ALIGN_TOP_RIGHT,
                  0, 0);
 #endif
 
 #if IS_ENABLED(CONFIG_ZMK_WIDGET_OUTPUT_STATUS)
     zmk_widget_output_status_init(&output_status_widget, screen);
-    lv_obj_align(zmk_widget_output_status_obj(&output_status_widget), NULL, LV_ALIGN_IN_TOP_LEFT, 0,
+    lv_obj_align(zmk_widget_output_status_obj(&output_status_widget), LV_ALIGN_TOP_LEFT, 0,
                  0);
 #endif
 
-    center_frame = lv_cont_create(screen, NULL);
-    lv_obj_set_auto_realign(center_frame, true);
-    lv_obj_align(center_frame, NULL, LV_ALIGN_CENTER, 0,
-                 0);
-    lv_cont_set_fit(center_frame, LV_FIT_TIGHT);
-    lv_cont_set_layout(center_frame, LV_LAYOUT_CENTER);
+    center_frame = lv_obj_create(screen);
+    lv_obj_align(center_frame, LV_ALIGN_CENTER, 0, 0);
+    lv_obj_center(center_frame);
 
 #if IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
     zaphod_bongo_cat_widget_init(&bongo_widget, center_frame);
 #else
-    dont_label = lv_label_create(center_frame, NULL);
+    dont_label = lv_label_create(center_frame);
     lv_label_set_text(dont_label, "Don't");
 
-    panic_label = lv_label_create(center_frame, NULL);
+    panic_label = lv_label_create(center_frame);
     lv_label_set_text(panic_label, "Panic");
+
+    lv_obj_update_layout(dont_label); // otherwise proper height is not known
+    lv_obj_set_y(panic_label, lv_obj_get_height(dont_label));
 #endif // IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
+    lv_obj_set_size(center_frame, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
 
 #if IS_ENABLED(CONFIG_ZMK_WIDGET_LAYER_STATUS)
     zmk_widget_layer_status_init(&layer_status_widget, screen);
-    lv_obj_align(zmk_widget_layer_status_obj(&layer_status_widget), NULL, LV_ALIGN_IN_BOTTOM_LEFT,
+    lv_obj_align(zmk_widget_layer_status_obj(&layer_status_widget), LV_ALIGN_BOTTOM_LEFT,
                  0, 0);
 #endif
 
 #if IS_ENABLED(CONFIG_ZMK_WIDGET_WPM_STATUS)
     zmk_widget_wpm_status_init(&wpm_status_widget, screen);
-    lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -12,
-                 0);
+    lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), LV_ALIGN_BOTTOM_RIGHT, -12, 0);
 #endif
     return screen;
 }