Simplify keyboard support (#22)
* simplify keyboard support * removed cleanup code as it wasn't necessary * improved docs
This commit is contained in:
committed by
GitHub
parent
7a7b31e426
commit
618f557a16
@@ -4,7 +4,6 @@
|
||||
#include "lvgl.h"
|
||||
#include "services/gui/gui.h"
|
||||
#include "services/wifi/wifi_credentials.h"
|
||||
#include "ui/lvgl_keypad.h"
|
||||
#include "ui/spacer.h"
|
||||
#include "ui/style.h"
|
||||
#include "wifi_connect.h"
|
||||
@@ -13,15 +12,6 @@
|
||||
|
||||
#define TAG "wifi_connect"
|
||||
|
||||
static void show_keyboard(lv_event_t* event) {
|
||||
gui_keyboard_show(event->current_target);
|
||||
lv_obj_scroll_to_view(event->current_target, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
static void hide_keyboard(TT_UNUSED lv_event_t* event) {
|
||||
gui_keyboard_hide();
|
||||
}
|
||||
|
||||
static void on_connect(lv_event_t* event) {
|
||||
WifiConnect* wifi = (WifiConnect*)event->user_data;
|
||||
WifiConnectView* view = &wifi->view;
|
||||
@@ -104,14 +94,8 @@ void wifi_connect_view_create(App app, void* wifi, lv_obj_t* parent) {
|
||||
|
||||
wifi_connect_view_create_bottom_buttons(wifi, parent);
|
||||
|
||||
if (gui_keyboard_is_enabled()) {
|
||||
lv_obj_add_event_cb(view->ssid_textarea, show_keyboard, LV_EVENT_FOCUSED, NULL);
|
||||
lv_obj_add_event_cb(view->ssid_textarea, hide_keyboard, LV_EVENT_DEFOCUSED, NULL);
|
||||
lv_obj_add_event_cb(view->ssid_textarea, hide_keyboard, LV_EVENT_READY, NULL);
|
||||
lv_obj_add_event_cb(view->password_textarea, show_keyboard, LV_EVENT_FOCUSED, NULL);
|
||||
lv_obj_add_event_cb(view->password_textarea, hide_keyboard, LV_EVENT_DEFOCUSED, NULL);
|
||||
lv_obj_add_event_cb(view->password_textarea, hide_keyboard, LV_EVENT_READY, NULL);
|
||||
}
|
||||
gui_keyboard_add_textarea(view->ssid_textarea);
|
||||
gui_keyboard_add_textarea(view->password_textarea);
|
||||
|
||||
// Init from app parameters
|
||||
Bundle* _Nullable bundle = tt_app_get_parameters(app);
|
||||
@@ -126,18 +110,10 @@ void wifi_connect_view_create(App app, void* wifi, lv_obj_t* parent) {
|
||||
lv_textarea_set_text(view->password_textarea, password);
|
||||
}
|
||||
}
|
||||
|
||||
// Hardware keyboard("keypad") requires a group
|
||||
view->group = lv_group_create();
|
||||
lv_group_add_obj(view->group, view->ssid_textarea);
|
||||
lv_group_add_obj(view->group, view->password_textarea);
|
||||
tt_lvgl_keypad_activate(view->group);
|
||||
}
|
||||
|
||||
void wifi_connect_view_destroy(TT_UNUSED WifiConnectView* view) {
|
||||
// Cleanup keypad group
|
||||
tt_lvgl_keypad_deactivate();
|
||||
lv_group_del(view->group);
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
void wifi_connect_view_update(
|
||||
|
||||
Reference in New Issue
Block a user