11
11
12
12
static void xremote_control_view_draw_vertical (Canvas * canvas , XRemoteViewModel * model )
13
13
{
14
- xremote_canvas_draw_frame (canvas , model -> up_pressed , 17 , 30 , 31 , "VOL +" );
15
- xremote_canvas_draw_frame (canvas , model -> left_pressed , 4 , 50 , 23 , "< CH" );
16
- xremote_canvas_draw_frame (canvas , model -> right_pressed , 37 , 50 , 23 , "CH >" );
17
- xremote_canvas_draw_frame (canvas , model -> down_pressed , 17 , 70 , 31 , "VOL -" );
18
- xremote_canvas_draw_button_wide (canvas , model -> ok_pressed , 0 , 95 , "Mute" , XRemoteIconEnter );
14
+ XRemoteAppContext * app_ctx = model -> context ;
15
+
16
+ xremote_canvas_draw_button_png (canvas , model -> up_pressed , 23 , 30 , & I_Chanup_Icon_11x11 );
17
+ xremote_canvas_draw_button_png (canvas , model -> down_pressed , 23 , 72 , & I_Chandown_Icon_11x11 );
18
+ xremote_canvas_draw_button_png (canvas , model -> left_pressed , 2 , 51 , & I_Voldown_Icon_11x11 );
19
+ xremote_canvas_draw_button_png (canvas , model -> right_pressed , 44 , 51 , & I_Volup_Icon_11x11 );
20
+ xremote_canvas_draw_button_png (canvas , model -> back_pressed , 2 , 95 , & I_Mute_Icon_11x11 );
21
+ xremote_canvas_draw_button (canvas , model -> ok_pressed , 23 , 51 , XRemoteIconPlayPause );
22
+
23
+ if (app_ctx -> app_settings -> exit_behavior == XRemoteAppExitPress )
24
+ canvas_draw_icon (canvas , 22 , 107 , & I_Hold_Text_17x4 );
19
25
}
20
26
21
27
static void xremote_control_view_draw_horizontal (Canvas * canvas , XRemoteViewModel * model )
22
28
{
23
- xremote_canvas_draw_frame (canvas , model -> up_pressed , 17 , 5 , 31 , "VOL +" );
24
- xremote_canvas_draw_frame (canvas , model -> left_pressed , 4 , 25 , 23 , "< CH" );
25
- xremote_canvas_draw_frame (canvas , model -> right_pressed , 37 , 25 , 23 , "CH >" );
26
- xremote_canvas_draw_frame (canvas , model -> down_pressed , 17 , 45 , 31 , "VOL -" );
27
- xremote_canvas_draw_button_size (canvas , model -> ok_pressed , 70 , 30 , 44 , "Mute" , XRemoteIconEnter );
29
+ XRemoteAppContext * app_ctx = model -> context ;
30
+
31
+ xremote_canvas_draw_button_png (canvas , model -> up_pressed , 23 , 2 , & I_Chanup_Icon_11x11 );
32
+ xremote_canvas_draw_button_png (canvas , model -> down_pressed , 23 , 44 , & I_Chandown_Icon_11x11 );
33
+ xremote_canvas_draw_button_png (canvas , model -> left_pressed , 2 , 23 , & I_Voldown_Icon_11x11 );
34
+ xremote_canvas_draw_button_png (canvas , model -> right_pressed , 44 , 23 , & I_Volup_Icon_11x11 );
35
+ xremote_canvas_draw_button_png (canvas , model -> back_pressed , 70 , 33 , & I_Mute_Icon_11x11 );
36
+ xremote_canvas_draw_button (canvas , model -> ok_pressed , 23 , 23 , XRemoteIconPlayPause );
37
+
38
+ if (app_ctx -> app_settings -> exit_behavior == XRemoteAppExitPress )
39
+ canvas_draw_icon (canvas , 90 , 45 , & I_Hold_Text_17x4 );
28
40
}
29
41
30
42
static void xremote_control_view_draw_callback (Canvas * canvas , void * context )
@@ -49,44 +61,61 @@ static void xremote_control_view_process(XRemoteView* view, InputEvent* event)
49
61
xremote_view_get_view (view ),
50
62
XRemoteViewModel * model ,
51
63
{
52
- model -> context = xremote_view_get_app_context (view );
64
+ XRemoteAppContext * app_ctx = xremote_view_get_app_context (view );
65
+ XRemoteAppExit exit = app_ctx -> app_settings -> exit_behavior ;
53
66
InfraredRemoteButton * button = NULL ;
67
+ model -> context = app_ctx ;
54
68
55
69
if (event -> type == InputTypePress )
56
70
{
57
71
if (event -> key == InputKeyOk )
58
72
{
59
- button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_MUTE );
73
+ button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_PLAY_PAUSE );
60
74
if (xremote_view_press_button (view , button )) model -> ok_pressed = true;
61
75
}
62
76
else if (event -> key == InputKeyUp )
63
77
{
64
- button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_VOL_UP );
78
+ button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_NEXT_CHAN );
65
79
if (xremote_view_press_button (view , button )) model -> up_pressed = true;
66
80
}
67
81
else if (event -> key == InputKeyDown )
68
82
{
69
- button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_VOL_DOWN );
83
+ button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_PREV_CHAN );
70
84
if (xremote_view_press_button (view , button )) model -> down_pressed = true;
71
85
}
72
86
else if (event -> key == InputKeyLeft )
73
87
{
74
- button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_PREV_CHAN );
88
+ button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_VOL_DOWN );
75
89
if (xremote_view_press_button (view , button )) model -> left_pressed = true;
76
90
}
77
91
else if (event -> key == InputKeyRight )
78
92
{
79
- button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_NEXT_CHAN );
93
+ button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_VOL_UP );
80
94
if (xremote_view_press_button (view , button )) model -> right_pressed = true;
81
95
}
82
96
}
97
+ else if (event -> type == InputTypeShort &&
98
+ event -> key == InputKeyBack &&
99
+ exit == XRemoteAppExitHold )
100
+ {
101
+ button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_MUTE );
102
+ if (xremote_view_press_button (view , button )) model -> back_pressed = true;
103
+ }
104
+ else if (event -> type == InputTypeLong &&
105
+ event -> key == InputKeyBack &&
106
+ exit == XRemoteAppExitPress )
107
+ {
108
+ button = xremote_view_get_button_by_name (view , XREMOTE_COMMAND_MUTE );
109
+ if (xremote_view_press_button (view , button )) model -> back_pressed = true;
110
+ }
83
111
else if (event -> type == InputTypeRelease )
84
112
{
85
113
if (event -> key == InputKeyOk ) model -> ok_pressed = false;
86
114
else if (event -> key == InputKeyUp ) model -> up_pressed = false;
87
115
else if (event -> key == InputKeyDown ) model -> down_pressed = false;
88
116
else if (event -> key == InputKeyLeft ) model -> left_pressed = false;
89
117
else if (event -> key == InputKeyRight ) model -> right_pressed = false;
118
+ else if (event -> key == InputKeyBack ) model -> back_pressed = false;
90
119
}
91
120
},
92
121
true);
@@ -96,7 +125,15 @@ static bool xremote_control_view_input_callback(InputEvent* event, void* context
96
125
{
97
126
furi_assert (context );
98
127
XRemoteView * view = (XRemoteView * )context ;
99
- if (event -> key == InputKeyBack ) return false;
128
+ XRemoteAppContext * app_ctx = xremote_view_get_app_context (view );
129
+ XRemoteAppExit exit = app_ctx -> app_settings -> exit_behavior ;
130
+
131
+ if (event -> key == InputKeyBack &&
132
+ event -> type == InputTypeShort &&
133
+ exit == XRemoteAppExitPress ) return false;
134
+ else if (event -> key == InputKeyBack &&
135
+ event -> type == InputTypeLong &&
136
+ exit == XRemoteAppExitHold ) return false;
100
137
101
138
xremote_control_view_process (view , event );
102
139
return true;
0 commit comments