diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index 8deb2d00d..6a1beb87f 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -163,6 +163,11 @@ void AppsContainer::shutdownDueToLowBattery() { window()->redraw(true); } +void AppsContainer::setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus newStatus) { + Ion::Events::setShiftAlphaStatus(newStatus); + updateAlphaLock(); +} + bool AppsContainer::updateAlphaLock() { return m_window.updateAlphaLock(); } diff --git a/apps/apps_container.h b/apps/apps_container.h index 0611819eb..5eca2eef7 100644 --- a/apps/apps_container.h +++ b/apps/apps_container.h @@ -21,6 +21,8 @@ #include "picview/picview_app.h" #endif +#include + class AppsContainer : public Container { public: AppsContainer(); @@ -41,7 +43,7 @@ public: void refreshPreferences(); void displayExamModePopUp(bool activate); void shutdownDueToLowBattery(); - bool updateAlphaLock(); + void setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus newStatus); OnBoarding::UpdateController * updatePopUpController(); protected: Home::App::Snapshot * homeAppSnapshot() { return &m_homeSnapshot; } @@ -51,6 +53,7 @@ private: Timer * containerTimerAtIndex(int i) override; bool processEvent(Ion::Events::Event event); void resetShiftAlphaStatus(); + bool updateAlphaLock(); AppsWindow m_window; EmptyBatteryWindow m_emptyBatteryWindow; #if USE_PIC_VIEW_APP diff --git a/apps/code/menu_controller.cpp b/apps/code/menu_controller.cpp index b66804d81..04ee00cfe 100644 --- a/apps/code/menu_controller.cpp +++ b/apps/code/menu_controller.cpp @@ -1,7 +1,9 @@ #include "menu_controller.h" #include "../i18n.h" +#include "../apps_container.h" #include #include +#include namespace Code { @@ -95,6 +97,7 @@ void MenuController::renameScriptAtIndex(int i) { myCell->editableTextCell()->textField()->setText(previousText); myCell->editableTextCell()->textField()->setCursorLocation(strlen(previousText) - strlen(ScriptStore::k_scriptExtension)); app()->setFirstResponder(myCell); + static_cast(const_cast(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::AlphaLock); } void MenuController::deleteScriptAtIndex(int i) { @@ -195,6 +198,7 @@ bool MenuController::textFieldDidFinishEditing(TextField * textField, const char m_selectableTableView.selectedCell()->setHighlighted(true); reloadConsole(); app()->setFirstResponder(&m_selectableTableView); + static_cast(const_cast(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default); return true; } else { // TODO: add pop up to explain to the user that the name is too long. @@ -205,6 +209,7 @@ bool MenuController::textFieldDidFinishEditing(TextField * textField, const char bool MenuController::textFieldDidAbortEditing(TextField * textField, const char * text) { m_selectableTableView.selectCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow()); app()->setFirstResponder(&m_selectableTableView); + static_cast(const_cast(app()->container()))->setShiftAlphaStatus(Ion::Events::ShiftAlphaStatus::Default); return true; }