1
1
#include " ibutton_scene_info.h"
2
2
#include " ../ibutton_app.h"
3
3
4
- static void widget_callback (GuiButtonType result, InputType type, void * context) {
5
- furi_assert (context);
6
- iButtonApp* app = static_cast <iButtonApp*>(context);
7
- iButtonEvent event;
8
-
9
- if (type == InputTypeShort) {
10
- event.type = iButtonEvent::Type::EventTypeWidgetButtonResult;
11
- event.payload .widget_button_result = result;
12
- app->get_view_manager ()->send_event (&event);
13
- }
14
- }
15
-
16
4
void iButtonSceneInfo::on_enter (iButtonApp* app) {
17
5
iButtonAppViewManager* view_manager = app->get_view_manager ();
18
6
Widget* widget = view_manager->get_widget ();
@@ -21,8 +9,7 @@ void iButtonSceneInfo::on_enter(iButtonApp* app) {
21
9
22
10
app->set_text_store (" %s" , ibutton_key_get_name_p (key));
23
11
widget_add_text_box_element (
24
- widget, 0 , 0 , 128 , 27 , AlignCenter, AlignCenter, app->get_text_store ());
25
- widget_add_button_element (widget, GuiButtonTypeLeft, " Back" , widget_callback, app);
12
+ widget, 0 , 0 , 128 , 28 , AlignCenter, AlignCenter, app->get_text_store ());
26
13
27
14
switch (ibutton_key_get_type (key)) {
28
15
case iButtonKeyDS1990:
@@ -37,36 +24,28 @@ void iButtonSceneInfo::on_enter(iButtonApp* app) {
37
24
key_data[6 ],
38
25
key_data[7 ]);
39
26
widget_add_string_element (
40
- widget, 64 , 45 , AlignCenter, AlignBottom, FontSecondary, " Dallas" );
27
+ widget, 64 , 51 , AlignCenter, AlignBottom, FontSecondary, " Dallas" );
41
28
break ;
42
29
case iButtonKeyMetakom:
43
30
app->set_text_store (
44
31
" %02X %02X %02X %02X" , key_data[0 ], key_data[1 ], key_data[2 ], key_data[3 ]);
45
32
widget_add_string_element (
46
- widget, 64 , 45 , AlignCenter, AlignBottom, FontSecondary, " Metakom" );
33
+ widget, 64 , 51 , AlignCenter, AlignBottom, FontSecondary, " Metakom" );
47
34
break ;
48
35
case iButtonKeyCyfral:
49
36
app->set_text_store (" %02X %02X" , key_data[0 ], key_data[1 ]);
50
37
widget_add_string_element (
51
- widget, 64 , 45 , AlignCenter, AlignBottom, FontSecondary, " Cyfral" );
38
+ widget, 64 , 51 , AlignCenter, AlignBottom, FontSecondary, " Cyfral" );
52
39
break ;
53
40
}
54
41
widget_add_string_element (
55
- widget, 64 , 33 , AlignCenter, AlignBottom, FontPrimary, app->get_text_store ());
42
+ widget, 64 , 35 , AlignCenter, AlignBottom, FontPrimary, app->get_text_store ());
56
43
57
44
view_manager->switch_to (iButtonAppViewManager::Type::iButtonAppViewWidget);
58
45
}
59
46
60
47
bool iButtonSceneInfo::on_event (iButtonApp* app, iButtonEvent* event) {
61
48
bool consumed = false ;
62
-
63
- if (event->type == iButtonEvent::Type::EventTypeWidgetButtonResult) {
64
- if (event->payload .widget_button_result == GuiButtonTypeLeft) {
65
- app->switch_to_previous_scene ();
66
- consumed = true ;
67
- }
68
- }
69
-
70
49
return consumed;
71
50
}
72
51
0 commit comments