[FL-2212] File validators and archive fixes #972
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -35,9 +35,9 @@ void LfRfidAppSceneDeleteConfirm::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
|
||||
string_printf(string_header, "Delete %s?", key.get_name());
|
||||
line_1->set_text(
|
||||
string_get_cstr(string_header), 64, 19, AlignCenter, AlignBottom, FontPrimary);
|
||||
string_get_cstr(string_header), 64, 19, 128 - 2, AlignCenter, AlignBottom, FontPrimary);
|
||||
line_2->set_text(
|
||||
string_get_cstr(string_data), 64, 29, AlignCenter, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string_data), 64, 29, 0, AlignCenter, AlignBottom, FontSecondary);
|
||||
|
||||
switch(key.get_type()) {
|
||||
case LfrfidKeyType::KeyEM4100:
|
||||
@@ -52,12 +52,13 @@ void LfRfidAppSceneDeleteConfirm::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
break;
|
||||
}
|
||||
line_3->set_text(
|
||||
string_get_cstr(string_decrypted), 64, 39, AlignCenter, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string_decrypted), 64, 39, 0, AlignCenter, AlignBottom, FontSecondary);
|
||||
|
||||
line_4->set_text(
|
||||
lfrfid_key_get_type_string(key.get_type()),
|
||||
64,
|
||||
49,
|
||||
0,
|
||||
AlignCenter,
|
||||
AlignBottom,
|
||||
FontSecondary);
|
||||
|
@@ -36,9 +36,9 @@ void LfRfidAppSceneReadSuccess::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
|
||||
switch(app->worker.key.get_type()) {
|
||||
case LfrfidKeyType::KeyEM4100:
|
||||
line_1_text->set_text("HEX:", 65, 23, AlignRight, AlignBottom, FontSecondary);
|
||||
line_2_text->set_text("Mod:", 65, 35, AlignRight, AlignBottom, FontSecondary);
|
||||
line_3_text->set_text("ID:", 65, 47, AlignRight, AlignBottom, FontSecondary);
|
||||
line_1_text->set_text("HEX:", 65, 23, 0, AlignRight, AlignBottom, FontSecondary);
|
||||
line_2_text->set_text("Mod:", 65, 35, 0, AlignRight, AlignBottom, FontSecondary);
|
||||
line_3_text->set_text("ID:", 65, 47, 0, AlignRight, AlignBottom, FontSecondary);
|
||||
|
||||
for(uint8_t i = 0; i < app->worker.key.get_type_data_count(); i++) {
|
||||
string_cat_printf(string[0], "%02X", data[i]);
|
||||
@@ -48,17 +48,17 @@ void LfRfidAppSceneReadSuccess::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
string_printf(string[2], "%03u,%05u", data[2], (uint16_t)((data[3] << 8) | (data[4])));
|
||||
|
||||
line_1_value->set_text(
|
||||
string_get_cstr(string[0]), 68, 23, AlignLeft, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string[0]), 68, 23, 0, AlignLeft, AlignBottom, FontSecondary);
|
||||
line_2_value->set_text(
|
||||
string_get_cstr(string[1]), 68, 35, AlignLeft, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string[1]), 68, 35, 0, AlignLeft, AlignBottom, FontSecondary);
|
||||
line_3_value->set_text(
|
||||
string_get_cstr(string[2]), 68, 47, AlignLeft, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string[2]), 68, 47, 0, AlignLeft, AlignBottom, FontSecondary);
|
||||
break;
|
||||
case LfrfidKeyType::KeyH10301:
|
||||
case LfrfidKeyType::KeyI40134:
|
||||
line_1_text->set_text("HEX:", 65, 23, AlignRight, AlignBottom, FontSecondary);
|
||||
line_2_text->set_text("FC:", 65, 35, AlignRight, AlignBottom, FontSecondary);
|
||||
line_3_text->set_text("Card:", 65, 47, AlignRight, AlignBottom, FontSecondary);
|
||||
line_1_text->set_text("HEX:", 65, 23, 0, AlignRight, AlignBottom, FontSecondary);
|
||||
line_2_text->set_text("FC:", 65, 35, 0, AlignRight, AlignBottom, FontSecondary);
|
||||
line_3_text->set_text("Card:", 65, 47, 0, AlignRight, AlignBottom, FontSecondary);
|
||||
|
||||
for(uint8_t i = 0; i < app->worker.key.get_type_data_count(); i++) {
|
||||
string_cat_printf(string[0], "%02X", data[i]);
|
||||
@@ -68,11 +68,11 @@ void LfRfidAppSceneReadSuccess::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
string_printf(string[2], "%u", (uint16_t)((data[1] << 8) | (data[2])));
|
||||
|
||||
line_1_value->set_text(
|
||||
string_get_cstr(string[0]), 68, 23, AlignLeft, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string[0]), 68, 23, 0, AlignLeft, AlignBottom, FontSecondary);
|
||||
line_2_value->set_text(
|
||||
string_get_cstr(string[1]), 68, 35, AlignLeft, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string[1]), 68, 35, 0, AlignLeft, AlignBottom, FontSecondary);
|
||||
line_3_value->set_text(
|
||||
string_get_cstr(string[2]), 68, 47, AlignLeft, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string[2]), 68, 47, 0, AlignLeft, AlignBottom, FontSecondary);
|
||||
break;
|
||||
}
|
||||
|
||||
|
9
applications/lfrfid/scene/lfrfid_app_scene_save_name.cpp
Executable file → Normal file
9
applications/lfrfid/scene/lfrfid_app_scene_save_name.cpp
Executable file → Normal file
@@ -21,6 +21,10 @@ void LfRfidAppSceneSaveName::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
app->worker.key.get_name_length(),
|
||||
key_name_empty);
|
||||
|
||||
ValidatorIsFile* validator_is_file =
|
||||
validator_is_file_alloc_init(app->app_folder, app->app_extension);
|
||||
text_input->set_validator(validator_is_file_callback, validator_is_file);
|
||||
|
||||
app->view_controller.switch_to<TextInputVM>();
|
||||
}
|
||||
|
||||
@@ -46,6 +50,11 @@ bool LfRfidAppSceneSaveName::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
|
||||
}
|
||||
|
||||
void LfRfidAppSceneSaveName::on_exit(LfRfidApp* app) {
|
||||
void* validator_context =
|
||||
app->view_controller.get<TextInputVM>()->get_validator_callback_context();
|
||||
app->view_controller.get<TextInputVM>()->set_validator(NULL, NULL);
|
||||
validator_is_file_free((ValidatorIsFile*)validator_context);
|
||||
|
||||
app->view_controller.get<TextInputVM>()->clean();
|
||||
}
|
||||
|
||||
|
@@ -28,8 +28,9 @@ void LfRfidAppSceneSavedInfo::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
string_cat_printf(string_data, "%02X", data[i]);
|
||||
}
|
||||
|
||||
line_1->set_text(key.get_name(), 64, 17, AlignCenter, AlignBottom, FontSecondary);
|
||||
line_2->set_text(string_get_cstr(string_data), 64, 29, AlignCenter, AlignBottom, FontPrimary);
|
||||
line_1->set_text(key.get_name(), 64, 17, 128 - 2, AlignCenter, AlignBottom, FontSecondary);
|
||||
line_2->set_text(
|
||||
string_get_cstr(string_data), 64, 29, 0, AlignCenter, AlignBottom, FontPrimary);
|
||||
|
||||
switch(key.get_type()) {
|
||||
case LfrfidKeyType::KeyEM4100:
|
||||
@@ -44,12 +45,13 @@ void LfRfidAppSceneSavedInfo::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
break;
|
||||
}
|
||||
line_3->set_text(
|
||||
string_get_cstr(string_decrypted), 64, 39, AlignCenter, AlignBottom, FontSecondary);
|
||||
string_get_cstr(string_decrypted), 64, 39, 0, AlignCenter, AlignBottom, FontSecondary);
|
||||
|
||||
line_4->set_text(
|
||||
lfrfid_key_get_type_string(key.get_type()),
|
||||
64,
|
||||
49,
|
||||
0,
|
||||
AlignCenter,
|
||||
AlignBottom,
|
||||
FontSecondary);
|
||||
|
Reference in New Issue
Block a user