Update apps for SDK updates (#38)
The updates mainly relate to lvgl-module changes.
This commit is contained in:
committed by
GitHub
parent
4f635d38e3
commit
b1e7eb999a
@@ -1,7 +1,7 @@
|
||||
#include "EpubReader.h"
|
||||
#include "HtmlStrip.h" // stripHtmlToText
|
||||
#include <tt_bundle.h>
|
||||
#include <tt_lvgl_toolbar.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <tt_app_alertdialog.h>
|
||||
#include <tt_app_selectiondialog.h>
|
||||
#include <tactility/log.h>
|
||||
@@ -239,7 +239,7 @@ void EpubReader::onShow(AppHandle app, lv_obj_t* parent) {
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
toolbar_ = tt_lvgl_toolbar_create_for_app(parent, app);
|
||||
toolbar_ = lvgl_toolbar_create(parent, "Epub Reader");
|
||||
|
||||
wrapperWidget_ = lv_obj_create(parent);
|
||||
lv_obj_set_width(wrapperWidget_, LV_PCT(100));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "EpubReader.h"
|
||||
#include <tt_lvgl_toolbar.h>
|
||||
#include <tt_lock.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <tactility/filesystem/file_mutex.h>
|
||||
#include <tactility/log.h>
|
||||
#include <Tactility/kernel/Kernel.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
@@ -43,7 +43,7 @@ void EpubReader::spawnOpenTask(EpubReader* self, bool restore) {
|
||||
|
||||
// Show a brief placeholder so old content doesn't linger during the open
|
||||
lv_obj_clean(self->wrapperWidget_);
|
||||
tt_lvgl_toolbar_clear_actions(self->toolbar_);
|
||||
lvgl_toolbar_clear_actions(self->toolbar_);
|
||||
lv_obj_t* lbl = lv_label_create(self->wrapperWidget_);
|
||||
lv_obj_set_style_pad_all(lbl, 8, 0);
|
||||
lv_label_set_text(lbl, restore ? "Loading..." : "Opening...");
|
||||
@@ -115,14 +115,9 @@ void EpubReader::backgroundOpenTask(void* data) {
|
||||
|
||||
// Acquire the filesystem lock before any SD card I/O - prevents concurrent
|
||||
// SDMMC access from the background and LVGL tasks (bus errors 0x107/0x108).
|
||||
auto lock = tt_lock_alloc_for_path(a->filePath.c_str());
|
||||
if (!tt_lock_acquire(lock, tt::kernel::MAX_TICKS)) {
|
||||
LOG_E(TAG, "FS lock timed out, skipping open: %s", a->filePath.c_str());
|
||||
tt_lock_free(lock);
|
||||
lv_async_call(asyncOpenComplete, a);
|
||||
vTaskDelete(nullptr);
|
||||
return;
|
||||
}
|
||||
struct FileMutex mutex;
|
||||
file_mutex_get(&mutex, a->filePath.c_str());
|
||||
file_mutex_lock(&mutex);
|
||||
|
||||
if (isTextFile(a->filePath)) {
|
||||
// Read the entire text file here (under the lock) so asyncOpenComplete
|
||||
@@ -146,8 +141,7 @@ void EpubReader::backgroundOpenTask(void* data) {
|
||||
a->epub = EpubService::open(a->filePath);
|
||||
}
|
||||
|
||||
tt_lock_release(lock);
|
||||
tt_lock_free(lock);
|
||||
file_mutex_unlock(&mutex);
|
||||
|
||||
// Signal the LVGL task that the work is done
|
||||
lv_async_call(asyncOpenComplete, a);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "EpubReader.h"
|
||||
#include <tt_lvgl_toolbar.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <tactility/log.h>
|
||||
#include <esp_heap_caps.h>
|
||||
#include <dirent.h>
|
||||
@@ -37,20 +37,20 @@ static void setListBtnLongMode(lv_obj_t* btn, lv_label_long_mode_t mode) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void EpubReader::setReaderToolbarButtons() {
|
||||
tt_lvgl_toolbar_clear_actions(toolbar_);
|
||||
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_PREV, onPrevPressed, this);
|
||||
lvgl_toolbar_clear_actions(toolbar_);
|
||||
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_PREV, onPrevPressed, this);
|
||||
if (!textMode_) {
|
||||
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_LIST, onTocPressed, this);
|
||||
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_LIST, onTocPressed, this);
|
||||
}
|
||||
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_NEXT, onNextPressed, this);
|
||||
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_DIRECTORY, onBrowsePressed, this);
|
||||
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_NEXT, onNextPressed, this);
|
||||
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_DIRECTORY, onBrowsePressed, this);
|
||||
}
|
||||
|
||||
void EpubReader::setBrowserToolbarButtons() {
|
||||
tt_lvgl_toolbar_clear_actions(toolbar_);
|
||||
lvgl_toolbar_clear_actions(toolbar_);
|
||||
// Show "Use Folder" button when the current browse path isn't already the saved books folder
|
||||
if (browsePath_ != booksPath_) {
|
||||
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_DIRECTORY, onSetBooksFolder, this);
|
||||
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_DIRECTORY, onSetBooksFolder, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user