Skip to content

Commit 521410a

Browse files
committed
fix(ui): render white wallpaper without images
1 parent c429671 commit 521410a

4 files changed

Lines changed: 6 additions & 32 deletions

File tree

app/apps/app_launcher/view/view.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "view.h"
77

88
#include <apps/utils/audio/audio.h>
9-
#include <assets/assets.h>
109
#include <hal/hal.h>
1110
#include <lvgl.h>
1211
#include <mooncake_log.h>
@@ -38,12 +37,10 @@ void LauncherView::init()
3837
LvglLockGuard lock;
3938

4039
// Base screen
41-
lv_obj_remove_flag(lv_screen_active(), LV_OBJ_FLAG_SCROLLABLE);
42-
43-
// Background image
44-
_img_bg = std::make_unique<Image>(lv_screen_active());
45-
_img_bg->setAlign(LV_ALIGN_CENTER);
46-
_img_bg->setSrc(&launcher_bg);
40+
lv_obj_t* screen = lv_screen_active();
41+
lv_obj_remove_flag(screen, LV_OBJ_FLAG_SCROLLABLE);
42+
lv_obj_set_style_bg_color(screen, lv_color_white(), LV_PART_MAIN);
43+
lv_obj_set_style_bg_opa(screen, LV_OPA_COVER, LV_PART_MAIN);
4744

4845
// Install panels
4946
_panels.push_back(std::make_unique<PanelRtc>());

app/apps/app_launcher/view/view.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ namespace launcher_view
323323

324324
private:
325325
bool _is_stacked = false;
326-
std::unique_ptr<smooth_ui_toolkit::lvgl_cpp::Image> _img_bg;
327326
std::vector<std::unique_ptr<PanelBase>> _panels;
328327
ui_root_t* _ui_root = nullptr;
329328
std::unique_ptr<custom::integration::SettingsController> _settings_controller;

custom/ui/ui_wallpaper.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
#include "ui_wallpaper.h"
77

8-
#include "assets/assets.h"
9-
108
ui_wallpaper_t* ui_wallpaper_attach(lv_obj_t* parent)
119
{
1210
if (parent == NULL)
@@ -32,23 +30,10 @@ ui_wallpaper_t* ui_wallpaper_attach(lv_obj_t* parent)
3230
lv_obj_set_size(wallpaper->layer, LV_PCT(100), LV_PCT(100));
3331
lv_obj_add_flag(wallpaper->layer, LV_OBJ_FLAG_IGNORE_LAYOUT);
3432
lv_obj_move_background(wallpaper->layer);
35-
lv_obj_set_style_bg_opa(wallpaper->layer, LV_OPA_TRANSP, LV_PART_MAIN);
33+
lv_obj_set_style_bg_color(wallpaper->layer, lv_color_white(), LV_PART_MAIN);
34+
lv_obj_set_style_bg_opa(wallpaper->layer, LV_OPA_COVER, LV_PART_MAIN);
3635
lv_obj_set_style_border_width(wallpaper->layer, 0, LV_PART_MAIN);
3736

38-
wallpaper->image = lv_image_create(wallpaper->layer);
39-
if (wallpaper->image == NULL)
40-
{
41-
lv_obj_del(wallpaper->layer);
42-
lv_free(wallpaper);
43-
return NULL;
44-
}
45-
46-
lv_obj_remove_style_all(wallpaper->image);
47-
lv_image_set_src(wallpaper->image, &launcher_bg);
48-
lv_obj_set_align(wallpaper->image, LV_ALIGN_CENTER);
49-
lv_obj_add_flag(wallpaper->image, LV_OBJ_FLAG_IGNORE_LAYOUT);
50-
lv_obj_move_background(wallpaper->image);
51-
5237
return wallpaper;
5338
}
5439

@@ -59,12 +44,6 @@ void ui_wallpaper_detach(ui_wallpaper_t* wallpaper)
5944
return;
6045
}
6146

62-
if (wallpaper->image != NULL)
63-
{
64-
lv_obj_del(wallpaper->image);
65-
wallpaper->image = NULL;
66-
}
67-
6847
if (wallpaper->layer != NULL)
6948
{
7049
lv_obj_del(wallpaper->layer);

custom/ui/ui_wallpaper.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ extern "C"
2727
typedef struct ui_wallpaper_t
2828
{
2929
lv_obj_t* layer;
30-
lv_obj_t* image;
3130
} ui_wallpaper_t;
3231

3332
ui_wallpaper_t* ui_wallpaper_attach(lv_obj_t* parent);

0 commit comments

Comments
 (0)