|
|
@@ -123,6 +123,9 @@ ProtoViewApp* protoview_app_alloc() {
|
|
|
view_port_input_callback_set(app->view_port, input_callback, app);
|
|
|
gui_add_view_port(app->gui, app->view_port, GuiLayerFullscreen);
|
|
|
app->event_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
|
|
|
+ app->view_dispatcher = NULL;
|
|
|
+ app->text_input = NULL;
|
|
|
+ app->show_text_input = false;
|
|
|
app->current_view = ViewRawPulses;
|
|
|
for (int j = 0; j < ViewLast; j++) app->current_subview[j] = 0;
|
|
|
app->direct_sampling_enabled = false;
|
|
|
@@ -301,7 +304,48 @@ int32_t protoview_app_entry(void* p) {
|
|
|
if (!(c % 20)) FURI_LOG_E(TAG, "Loop timeout");
|
|
|
}
|
|
|
}
|
|
|
- view_port_update(app->view_port);
|
|
|
+ if (app->show_text_input) {
|
|
|
+ /* Remove our viewport: we need to use a view dispatcher
|
|
|
+ * in order to show the standard Flipper keyboard. */
|
|
|
+ gui_remove_view_port(app->gui, app->view_port);
|
|
|
+
|
|
|
+ /* Allocate a view dispatcher, add a text input view to it,
|
|
|
+ * and activate it. */
|
|
|
+ app->view_dispatcher = view_dispatcher_alloc();
|
|
|
+ view_dispatcher_enable_queue(app->view_dispatcher);
|
|
|
+ app->text_input = text_input_alloc();
|
|
|
+ view_dispatcher_set_event_callback_context(app->view_dispatcher,app);
|
|
|
+ view_dispatcher_add_view(app->view_dispatcher, 0, text_input_get_view(app->text_input));
|
|
|
+ view_dispatcher_switch_to_view(app->view_dispatcher, 0);
|
|
|
+
|
|
|
+ /* Setup the text input view. The different parameters are set
|
|
|
+ * in the app structure by the view that wanted to show the
|
|
|
+ * input text. The callback, buffer and buffer len must be set. */
|
|
|
+ text_input_set_header_text(app->text_input, "Save signal filename");
|
|
|
+ text_input_set_result_callback(
|
|
|
+ app->text_input,
|
|
|
+ app->text_input_done_callback,
|
|
|
+ app,
|
|
|
+ app->text_input_buffer,
|
|
|
+ app->text_input_buffer_len,
|
|
|
+ false);
|
|
|
+
|
|
|
+ /* Run the dispatcher with the keyboard. */
|
|
|
+ view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
|
|
|
+ view_dispatcher_run(app->view_dispatcher);
|
|
|
+
|
|
|
+ /* Undo all it: remove the view from the dispatcher, free it
|
|
|
+ * so that it removes itself from the current gui, finally
|
|
|
+ * restore our viewport. */
|
|
|
+ view_dispatcher_remove_view(app->view_dispatcher, 0);
|
|
|
+ text_input_free(app->text_input);
|
|
|
+ view_dispatcher_free(app->view_dispatcher);
|
|
|
+ app->view_dispatcher = NULL;
|
|
|
+ gui_add_view_port(app->gui, app->view_port, GuiLayerFullscreen);
|
|
|
+ app->show_text_input = false;
|
|
|
+ } else {
|
|
|
+ view_port_update(app->view_port);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/* App no longer running. Shut down and free. */
|