mirror of
https://protopirate.net/ProtoPirate/ProtoPirate.git
synced 2026-10-06 08:27:14 +00:00
CONFIG UI BUG: Only show the Lock Keyboard Option if we came from Receiver.
This commit is contained in:
@@ -355,7 +355,7 @@ static void
|
||||
}
|
||||
}
|
||||
|
||||
static void plugin_on_enter(void* context) {
|
||||
static void plugin_on_enter(void* context, bool show_lock_keyboard) {
|
||||
ProtoPirateApp* app = context;
|
||||
VariableItem* item;
|
||||
uint8_t value_index;
|
||||
@@ -480,10 +480,12 @@ static void plugin_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, app->sound);
|
||||
variable_item_set_current_value_text(item, on_off_text[app->sound ? 1 : 0]);
|
||||
|
||||
variable_item_list_add(app->variable_item_list, "Lock Keyboard", 1, NULL, NULL);
|
||||
//Only show the Lock Keyboard Option in Receiver. Timing Tuner Doesnt respect it, and its wierd in Configuration from the Main Menu.
|
||||
variable_item_list_set_enter_callback(
|
||||
app->variable_item_list, protopirate_scene_receiver_config_var_list_enter_callback, app);
|
||||
|
||||
if(show_lock_keyboard) {
|
||||
variable_item_list_add(app->variable_item_list, "Lock Keyboard", 1, NULL, NULL);
|
||||
}
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, ProtoPirateViewVariableItemList);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,6 @@ typedef struct ProtoPirateConfigPlugin {
|
||||
uint16_t model_count,
|
||||
SubGhzSetting* app_settings);
|
||||
uint16_t (*car_model_get_count)(void);
|
||||
void (*on_enter)(void* app);
|
||||
void (*on_enter)(void* app, bool show_lock_keyboard);
|
||||
void (*set_host_api)(const ProtoPirateConfigSceneHostApi* host_api);
|
||||
} ProtoPirateConfigPlugin;
|
||||
|
||||
@@ -435,7 +435,13 @@ bool protopirate_scene_receiver_on_event(void* context, SceneManagerEvent event)
|
||||
}
|
||||
|
||||
case ProtoPirateCustomEventViewReceiverConfig:
|
||||
//Leaving for Subscene
|
||||
scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneReceiver, 1);
|
||||
|
||||
//Show the lock keyboard option.
|
||||
scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneReceiverConfig, 1);
|
||||
|
||||
//Start receiver Config.
|
||||
scene_manager_next_scene(app->scene_manager, ProtoPirateSceneReceiverConfig);
|
||||
consumed = true;
|
||||
break;
|
||||
|
||||
@@ -17,7 +17,10 @@ void protopirate_scene_receiver_config_on_enter(void* context) {
|
||||
return;
|
||||
}
|
||||
app->config_plugin->set_host_api(&protopirate_config_scene_host_api);
|
||||
app->config_plugin->on_enter(app);
|
||||
//We have to grab this from the scene manager, from inside the plugin it just doesnt work!
|
||||
bool show_lock_keyboard =
|
||||
(scene_manager_get_scene_state(app->scene_manager, ProtoPirateSceneReceiverConfig) == 1);
|
||||
app->config_plugin->on_enter(app, show_lock_keyboard);
|
||||
}
|
||||
|
||||
bool protopirate_scene_receiver_config_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
@@ -102,6 +102,8 @@ bool protopirate_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(app->scene_manager, ProtoPirateSceneSaved);
|
||||
consumed = true;
|
||||
} else if(event.event == SubmenuIndexProtoPirateReceiverConfig) {
|
||||
//Hide the lock keyboard option.
|
||||
scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneReceiverConfig, 0);
|
||||
scene_manager_next_scene(app->scene_manager, ProtoPirateSceneReceiverConfig);
|
||||
consumed = true;
|
||||
}
|
||||
@@ -113,6 +115,8 @@ bool protopirate_scene_start_on_event(void* context, SceneManagerEvent event) {
|
||||
#endif
|
||||
#ifdef ENABLE_TIMING_TUNER_SCENE
|
||||
else if(event.event == SubmenuIndexProtoPirateTimingTuner) {
|
||||
//Hide the lock keyboard option.
|
||||
scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneReceiverConfig, 0);
|
||||
scene_manager_next_scene(app->scene_manager, ProtoPirateSceneTimingTuner);
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user