## Time & Date - Added time to statusbar widget - Added Time & Date Settings app - Added TimeZone app for selecting TimeZone - Added `tt::time` namespace with timezone code ## Other changes - Added `SystemEvent` to publish/subscribe to system wide (e.g. for init code, but also for time settings changes) - Changed the way the statusbar widget works: now there's only 1 that gets shown/hidden, instead of 1 instance per app instance. - Moved `lowercase()` function to new namespace: `tt::string` - Increased T-Deck flash & PSRAM SPI frequencies to 120 MHz (from 80 MHz) - Temporary work-around (+ TODO item) for LVGL stack size (issue with WiFi app) - Suppress T-Deck keystroke debugging to debug level (privacy issue) - Improved SDL dependency wiring in various `CMakeLists.txt` - `Loader` service had some variables renamed to the newer C++ style (from previous C style)
66 lines
1.6 KiB
C++
66 lines
1.6 KiB
C++
#include "Check.h"
|
|
#include "TactilityConfig.h"
|
|
#include "service/gui/Gui_i.h"
|
|
#include "lvgl/LvglKeypad.h"
|
|
#include "lvgl/LvglSync.h"
|
|
|
|
namespace tt::service::gui {
|
|
|
|
extern Gui* gui;
|
|
|
|
static void show_keyboard(lv_event_t* event) {
|
|
lv_obj_t* target = lv_event_get_current_target_obj(event);
|
|
keyboardShow(target);
|
|
lv_obj_scroll_to_view(target, LV_ANIM_ON);
|
|
}
|
|
|
|
static void hide_keyboard(TT_UNUSED lv_event_t* event) {
|
|
keyboardHide();
|
|
}
|
|
|
|
bool keyboardIsEnabled() {
|
|
return !lvgl::keypad_is_available() || TT_CONFIG_FORCE_ONSCREEN_KEYBOARD;
|
|
}
|
|
|
|
void keyboardShow(lv_obj_t* textarea) {
|
|
lock();
|
|
|
|
if (gui->keyboard) {
|
|
lv_obj_clear_flag(gui->keyboard, LV_OBJ_FLAG_HIDDEN);
|
|
lv_keyboard_set_textarea(gui->keyboard, textarea);
|
|
}
|
|
|
|
unlock();
|
|
}
|
|
|
|
void keyboardHide() {
|
|
lock();
|
|
|
|
if (gui->keyboard) {
|
|
lv_obj_add_flag(gui->keyboard, LV_OBJ_FLAG_HIDDEN);
|
|
}
|
|
|
|
unlock();
|
|
}
|
|
|
|
void keyboardAddTextArea(lv_obj_t* textarea) {
|
|
lock();
|
|
tt_check(lvgl::lock(0), "lvgl should already be locked before calling this method");
|
|
|
|
if (keyboardIsEnabled()) {
|
|
lv_obj_add_event_cb(textarea, show_keyboard, LV_EVENT_FOCUSED, nullptr);
|
|
lv_obj_add_event_cb(textarea, hide_keyboard, LV_EVENT_DEFOCUSED, nullptr);
|
|
lv_obj_add_event_cb(textarea, hide_keyboard, LV_EVENT_READY, nullptr);
|
|
}
|
|
|
|
// lv_obj_t auto-remove themselves from the group when they are destroyed (last checked in LVGL 8.3)
|
|
lv_group_add_obj(gui->keyboardGroup, textarea);
|
|
|
|
lvgl::keypad_activate(gui->keyboardGroup);
|
|
|
|
lvgl::unlock();
|
|
unlock();
|
|
}
|
|
|
|
} // namespace
|