// 更新界面 - 显示更新图标 + GIF动画
// 手机APP上传图片时自动切换到此界面

#include "../ui.h"
#include "ui_ScreenUpdate.h"

lv_obj_t *ui_ScreenUpdate = NULL;
static lv_obj_t *gengxin_img = NULL;
static lv_obj_t *update_gif_obj = NULL;

void ui_ScreenUpdate_screen_init(void) {
    ui_ScreenUpdate = lv_obj_create(NULL);
    lv_obj_clear_flag(ui_ScreenUpdate, LV_OBJ_FLAG_SCROLLABLE);
    lv_obj_set_style_bg_color(ui_ScreenUpdate, lv_color_hex(0x000000), LV_PART_MAIN);
    lv_obj_set_style_bg_opa(ui_ScreenUpdate, 255, LV_PART_MAIN);

    // "更新"文字图片（172x54），居中偏上
    gengxin_img = lv_img_create(ui_ScreenUpdate);
    lv_img_set_src(gengxin_img, &Gengxin);
    lv_obj_set_align(gengxin_img, LV_ALIGN_CENTER);
    lv_obj_set_y(gengxin_img, -30);
    lv_obj_clear_flag(gengxin_img, LV_OBJ_FLAG_SCROLLABLE);

    // GIF动画（65x49），在"更新"图片下方
#if LV_USE_GIF
    update_gif_obj = lv_gif_create(ui_ScreenUpdate);
    lv_gif_set_src(update_gif_obj, &Update_GIF);
    lv_obj_set_align(update_gif_obj, LV_ALIGN_CENTER);
    lv_obj_set_y(update_gif_obj, 45);
    lv_obj_clear_flag(update_gif_obj, LV_OBJ_FLAG_SCROLLABLE);
#endif

}

void ui_ScreenUpdate_screen_destroy(void) {
    if (ui_ScreenUpdate) lv_obj_del(ui_ScreenUpdate);
    ui_ScreenUpdate = NULL;
    gengxin_img = NULL;
    update_gif_obj = NULL;
}
