Various improvements and fixes (#131)
- Added a custom spinner using the Tactility logo - Fix for crash in version logging - Make file browsing less verbose in log - Fix memory leak in FileUtils - Fix bug when display brightness was set to 255: after reboot it would be set to 0 - Smaller boot logo (removed empty space)
This commit is contained in:
committed by
GitHub
parent
80b69b7f45
commit
b4592dd7d1
@@ -0,0 +1,53 @@
|
||||
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
|
||||
|
||||
#include "lvgl.h"
|
||||
#include "CoreDefines.h"
|
||||
#include "Log.h"
|
||||
|
||||
static void tt_spinner_constructor(const lv_obj_class_t* object_class, lv_obj_t* object);
|
||||
|
||||
const lv_obj_class_t tt_spinner_class = {
|
||||
.base_class = &lv_image_class,
|
||||
.constructor_cb = tt_spinner_constructor,
|
||||
.destructor_cb = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.name = "tt_spinner",
|
||||
.width_def = 0,
|
||||
.height_def = 0,
|
||||
.editable = 0,
|
||||
.group_def = 0,
|
||||
.instance_size = 0,
|
||||
.theme_inheritable = 0
|
||||
};
|
||||
|
||||
lv_obj_t* tt_spinner_create(lv_obj_t* parent) {
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&tt_spinner_class, parent);
|
||||
lv_obj_class_init_obj(obj);
|
||||
|
||||
lv_image_set_src(obj, "A:/assets/spinner.png");
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void anim_rotation_callback(void* var, int32_t v) {
|
||||
auto* object = (lv_obj_t*) var;
|
||||
auto width = lv_obj_get_width(object);
|
||||
auto height = lv_obj_get_width(object);
|
||||
lv_obj_set_style_transform_pivot_x(object, width / 2, 0);
|
||||
lv_obj_set_style_transform_pivot_y(object, height / 2, 0);
|
||||
lv_obj_set_style_transform_rotation(object, v, 0);
|
||||
}
|
||||
|
||||
static void tt_spinner_constructor(TT_UNUSED const lv_obj_class_t* object_class, lv_obj_t* object) {
|
||||
lv_obj_remove_flag(object, LV_OBJ_FLAG_CLICKABLE);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, object);
|
||||
lv_anim_set_values(&a, 0, 3600);
|
||||
lv_anim_set_duration(&a, 800);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_set_exec_cb(&a, anim_rotation_callback);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "lvgl.h"
|
||||
|
||||
/**
|
||||
* Create the Tactility spinner widget
|
||||
* @param parent pointer to an object, it will be the parent of the new spinner.
|
||||
* @return the created spinner
|
||||
*/
|
||||
lv_obj_t* tt_spinner_create(lv_obj_t* parent);
|
||||
@@ -1,10 +1,10 @@
|
||||
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
|
||||
#include "Toolbar.h"
|
||||
#include "Tactility.h"
|
||||
|
||||
#include "service/loader/Loader.h"
|
||||
#include "lvgl/Spacer.h"
|
||||
#include "lvgl/Style.h"
|
||||
#include "Spinner.h"
|
||||
|
||||
#define SPINNER_HEIGHT TOOLBAR_HEIGHT
|
||||
|
||||
@@ -90,6 +90,7 @@ lv_obj_t* toolbar_create(lv_obj_t* parent, const std::string& title) {
|
||||
lv_obj_set_flex_flow(toolbar->action_container, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_style_pad_all(toolbar->action_container, 0, 0);
|
||||
lv_obj_set_style_border_width(toolbar->action_container, 0, 0);
|
||||
lv_obj_set_flex_align(toolbar->action_container, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START);
|
||||
|
||||
toolbar_set_nav_action(obj, LV_SYMBOL_CLOSE, &stop_app, nullptr);
|
||||
|
||||
@@ -137,11 +138,7 @@ lv_obj_t* toolbar_add_switch_action(lv_obj_t* obj) {
|
||||
|
||||
lv_obj_t* toolbar_add_spinner_action(lv_obj_t* obj) {
|
||||
auto* toolbar = (Toolbar*)obj;
|
||||
lv_obj_t* widget = lv_spinner_create(toolbar->action_container);
|
||||
lv_obj_set_size(widget, SPINNER_HEIGHT, SPINNER_HEIGHT);
|
||||
lv_spinner_set_anim_params(widget, 1000, 60);
|
||||
lv_obj_set_style_pad_all(widget, 4, 0);
|
||||
return widget;
|
||||
return tt_spinner_create(toolbar->action_container);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user