M5Stack PaperS3 improvements and other bug fixes (#512)
This commit is contained in:
@@ -204,7 +204,11 @@ public:
|
||||
lv_obj_set_width(description_label, LV_PCT(100));
|
||||
lv_label_set_long_mode(description_label, LV_LABEL_LONG_MODE_WRAP);
|
||||
if (!entry.appDescription.empty()) {
|
||||
lv_label_set_text(description_label, entry.appDescription.c_str());
|
||||
std::string description = entry.appDescription;
|
||||
for (size_t pos = 0; (pos = description.find("\\n", pos)) != std::string::npos;) {
|
||||
description.replace(pos, 2, "\n");
|
||||
}
|
||||
lv_label_set_text(description_label, description.c_str());
|
||||
} else {
|
||||
lv_label_set_text(description_label, "This app has no description yet.");
|
||||
}
|
||||
|
||||
@@ -275,6 +275,10 @@ void View::onDirEntryPressed(uint32_t index) {
|
||||
}
|
||||
|
||||
void View::onDirEntryLongPressed(int32_t index) {
|
||||
if (state->getCurrentPath() == "/") {
|
||||
return;
|
||||
}
|
||||
|
||||
dirent dir_entry;
|
||||
if (!resolveDirentFromListIndex(index, dir_entry)) {
|
||||
return;
|
||||
@@ -452,7 +456,7 @@ void View::update(size_t start_index) {
|
||||
|
||||
if (!is_root && last_loaded_index < total_entries) {
|
||||
if (total_entries > current_start_index &&
|
||||
+ (total_entries - current_start_index) > MAX_BATCH) {
|
||||
(total_entries - current_start_index) > MAX_BATCH) {
|
||||
auto* next_btn = lv_list_add_btn(dir_entry_list, LV_SYMBOL_RIGHT, "Next");
|
||||
lv_obj_add_event_cb(next_btn, [](lv_event_t* event) {
|
||||
auto* view = static_cast<View*>(lv_event_get_user_data(event));
|
||||
@@ -549,7 +553,7 @@ void View::onResult(LaunchId launchId, Result result, std::unique_ptr<Bundle> bu
|
||||
} else if (file::isFile(filepath)) {
|
||||
auto lock = file::getLock(filepath);
|
||||
lock->lock();
|
||||
if (remove(filepath.c_str()) <= 0) {
|
||||
if (remove(filepath.c_str()) != 0) {
|
||||
LOGGER.warn("Failed to delete {}", filepath);
|
||||
}
|
||||
lock->unlock();
|
||||
|
||||
@@ -48,18 +48,8 @@ class LauncherApp final : public App {
|
||||
lv_obj_set_style_text_font(button_image, lvgl_get_launcher_icon_font(), LV_STATE_DEFAULT);
|
||||
lv_image_set_src(button_image, imageFile);
|
||||
lv_obj_set_style_text_color(button_image, lv_theme_get_color_primary(button_image), LV_STATE_DEFAULT);
|
||||
|
||||
// Recolor handling:
|
||||
// For color builds use theme primary color
|
||||
// For 1-bit/monochrome builds force a visible color (black)
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
// Try forcing black recolor on monochrome builds
|
||||
lv_obj_set_style_image_recolor(button_image, lv_color_black(), LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_image_recolor_opa(button_image, LV_OPA_COVER, LV_STATE_DEFAULT);
|
||||
#else
|
||||
lv_obj_set_style_image_recolor(button_image, lv_theme_get_color_primary(parent), LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_image_recolor_opa(button_image, LV_OPA_COVER, LV_STATE_DEFAULT);
|
||||
#endif
|
||||
|
||||
// Ensure it's square (Material Symbols are slightly wider than tall)
|
||||
lv_obj_set_size(button_image, button_size, button_size);
|
||||
@@ -157,7 +147,7 @@ public:
|
||||
createAppButton(buttons_wrapper, ui_density, LVGL_ICON_LAUNCHER_SETTINGS, "Settings", margin, is_landscape_display);
|
||||
|
||||
if (shouldShowPowerButton()) {
|
||||
auto* power_button = lv_btn_create(parent);
|
||||
auto* power_button = lv_button_create(parent);
|
||||
lv_obj_set_style_pad_all(power_button, 8, 0);
|
||||
lv_obj_align(power_button, LV_ALIGN_BOTTOM_MID, 0, -10);
|
||||
lv_obj_add_event_cb(power_button, onPowerOffPressed, LV_EVENT_SHORT_CLICKED, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user