[FL-2344] iButton deleted back button (#1096)
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
b22ad77bbe
commit
a25552eb99
@ -22,7 +22,7 @@ void iButtonSceneDeleteConfirm::on_enter(iButtonApp* app) {
|
|||||||
app->set_text_store("\e#Delete %s?\e#", ibutton_key_get_name_p(key));
|
app->set_text_store("\e#Delete %s?\e#", ibutton_key_get_name_p(key));
|
||||||
widget_add_text_box_element(
|
widget_add_text_box_element(
|
||||||
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, app->get_text_store());
|
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, app->get_text_store());
|
||||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", widget_callback, app);
|
widget_add_button_element(widget, GuiButtonTypeLeft, "Cancel", widget_callback, app);
|
||||||
widget_add_button_element(widget, GuiButtonTypeRight, "Delete", widget_callback, app);
|
widget_add_button_element(widget, GuiButtonTypeRight, "Delete", widget_callback, app);
|
||||||
|
|
||||||
switch(ibutton_key_get_type(key)) {
|
switch(ibutton_key_get_type(key)) {
|
||||||
|
@ -1,18 +1,6 @@
|
|||||||
#include "ibutton_scene_info.h"
|
#include "ibutton_scene_info.h"
|
||||||
#include "../ibutton_app.h"
|
#include "../ibutton_app.h"
|
||||||
|
|
||||||
static void widget_callback(GuiButtonType result, InputType type, void* context) {
|
|
||||||
furi_assert(context);
|
|
||||||
iButtonApp* app = static_cast<iButtonApp*>(context);
|
|
||||||
iButtonEvent event;
|
|
||||||
|
|
||||||
if(type == InputTypeShort) {
|
|
||||||
event.type = iButtonEvent::Type::EventTypeWidgetButtonResult;
|
|
||||||
event.payload.widget_button_result = result;
|
|
||||||
app->get_view_manager()->send_event(&event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void iButtonSceneInfo::on_enter(iButtonApp* app) {
|
void iButtonSceneInfo::on_enter(iButtonApp* app) {
|
||||||
iButtonAppViewManager* view_manager = app->get_view_manager();
|
iButtonAppViewManager* view_manager = app->get_view_manager();
|
||||||
Widget* widget = view_manager->get_widget();
|
Widget* widget = view_manager->get_widget();
|
||||||
@ -21,8 +9,7 @@ void iButtonSceneInfo::on_enter(iButtonApp* app) {
|
|||||||
|
|
||||||
app->set_text_store("%s", ibutton_key_get_name_p(key));
|
app->set_text_store("%s", ibutton_key_get_name_p(key));
|
||||||
widget_add_text_box_element(
|
widget_add_text_box_element(
|
||||||
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, app->get_text_store());
|
widget, 0, 0, 128, 28, AlignCenter, AlignCenter, app->get_text_store());
|
||||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", widget_callback, app);
|
|
||||||
|
|
||||||
switch(ibutton_key_get_type(key)) {
|
switch(ibutton_key_get_type(key)) {
|
||||||
case iButtonKeyDS1990:
|
case iButtonKeyDS1990:
|
||||||
@ -37,36 +24,28 @@ void iButtonSceneInfo::on_enter(iButtonApp* app) {
|
|||||||
key_data[6],
|
key_data[6],
|
||||||
key_data[7]);
|
key_data[7]);
|
||||||
widget_add_string_element(
|
widget_add_string_element(
|
||||||
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Dallas");
|
widget, 64, 51, AlignCenter, AlignBottom, FontSecondary, "Dallas");
|
||||||
break;
|
break;
|
||||||
case iButtonKeyMetakom:
|
case iButtonKeyMetakom:
|
||||||
app->set_text_store(
|
app->set_text_store(
|
||||||
"%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
|
"%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
|
||||||
widget_add_string_element(
|
widget_add_string_element(
|
||||||
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Metakom");
|
widget, 64, 51, AlignCenter, AlignBottom, FontSecondary, "Metakom");
|
||||||
break;
|
break;
|
||||||
case iButtonKeyCyfral:
|
case iButtonKeyCyfral:
|
||||||
app->set_text_store("%02X %02X", key_data[0], key_data[1]);
|
app->set_text_store("%02X %02X", key_data[0], key_data[1]);
|
||||||
widget_add_string_element(
|
widget_add_string_element(
|
||||||
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Cyfral");
|
widget, 64, 51, AlignCenter, AlignBottom, FontSecondary, "Cyfral");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
widget_add_string_element(
|
widget_add_string_element(
|
||||||
widget, 64, 33, AlignCenter, AlignBottom, FontPrimary, app->get_text_store());
|
widget, 64, 35, AlignCenter, AlignBottom, FontPrimary, app->get_text_store());
|
||||||
|
|
||||||
view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewWidget);
|
view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool iButtonSceneInfo::on_event(iButtonApp* app, iButtonEvent* event) {
|
bool iButtonSceneInfo::on_event(iButtonApp* app, iButtonEvent* event) {
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
|
||||||
if(event->type == iButtonEvent::Type::EventTypeWidgetButtonResult) {
|
|
||||||
if(event->payload.widget_button_result == GuiButtonTypeLeft) {
|
|
||||||
app->switch_to_previous_scene();
|
|
||||||
consumed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user