mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-26 23:05:05 +03:00
7734fb4018
* Gui module byte-input: changed api * Gui: changed font height in multiline text according to guideline * Apps lrfid, nfc: changed send and receive icon * App lfrfid: fix text, fix scene switсh * Elements: multiline text framed, fix paddings * Gui: remove duplicate definition of elements_multiline_text_framed * App NFC: update byte_input callback signature * App subghz: fix text lines in capture scene * App subghz: position of the text is aligned with the guidelines and other scenes * App subghz: removed mockup Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
50 lines
1.6 KiB
C++
50 lines
1.6 KiB
C++
#include "ibutton-scene-add-value.h"
|
|
#include "../ibutton-app.h"
|
|
#include "../ibutton-view-manager.h"
|
|
#include "../ibutton-event.h"
|
|
#include <callback-connector.h>
|
|
|
|
void iButtonSceneAddValue::on_enter(iButtonApp* app) {
|
|
iButtonAppViewManager* view_manager = app->get_view_manager();
|
|
ByteInput* byte_input = view_manager->get_byte_input();
|
|
auto callback = cbc::obtain_connector(this, &iButtonSceneAddValue::byte_input_callback);
|
|
|
|
byte_input_set_result_callback(
|
|
byte_input,
|
|
callback,
|
|
NULL,
|
|
app,
|
|
app->get_key()->get_data(),
|
|
app->get_key()->get_type_data_size());
|
|
byte_input_set_header_text(byte_input, "Enter the key");
|
|
|
|
view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewByteInput);
|
|
}
|
|
|
|
bool iButtonSceneAddValue::on_event(iButtonApp* app, iButtonEvent* event) {
|
|
bool consumed = false;
|
|
|
|
if(event->type == iButtonEvent::Type::EventTypeByteEditResult) {
|
|
app->switch_to_next_scene(iButtonApp::Scene::SceneSaveName);
|
|
consumed = true;
|
|
}
|
|
|
|
return consumed;
|
|
}
|
|
|
|
void iButtonSceneAddValue::on_exit(iButtonApp* app) {
|
|
iButtonAppViewManager* view_manager = app->get_view_manager();
|
|
ByteInput* byte_input = view_manager->get_byte_input();
|
|
|
|
byte_input_set_result_callback(byte_input, NULL, NULL, NULL, NULL, 0);
|
|
byte_input_set_header_text(byte_input, {0});
|
|
}
|
|
|
|
void iButtonSceneAddValue::byte_input_callback(void* context) {
|
|
iButtonApp* app = static_cast<iButtonApp*>(context);
|
|
iButtonEvent event;
|
|
|
|
event.type = iButtonEvent::Type::EventTypeByteEditResult;
|
|
|
|
app->get_view_manager()->send_event(&event);
|
|
} |