feat(color): run widget 'background' function while in setup pages (#4393)
This commit is contained in:
@@ -232,7 +232,7 @@ class OutputLineButton : public ListLineButton
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
Window::checkEvents();
|
||||
ListLineButton::checkEvents();
|
||||
if (!init) return;
|
||||
|
||||
int newValue = channelOutputs[index];
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "keyboard_base.h"
|
||||
#include "opentx.h"
|
||||
#include "theme.h"
|
||||
#include "view_main.h"
|
||||
|
||||
PageHeader::PageHeader(Page * parent, uint8_t icon):
|
||||
FormWindow(parent, { 0, 0, LCD_W, MENU_HEADER_HEIGHT }, OPAQUE),
|
||||
@@ -94,3 +95,9 @@ void Page::onCancel()
|
||||
}
|
||||
|
||||
void Page::onClicked() { Keyboard::hide(false); }
|
||||
|
||||
void Page::checkEvents()
|
||||
{
|
||||
ViewMain::instance()->runBackground();
|
||||
NavWindow::checkEvents();
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ class Page : public NavWindow
|
||||
PageHeader header;
|
||||
FormWindow body;
|
||||
|
||||
void checkEvents() override;
|
||||
bool bubbleEvents() override { return false; }
|
||||
};
|
||||
|
||||
|
||||
@@ -401,7 +401,7 @@ class ThemeEditPage : public Page
|
||||
started = true;
|
||||
_themeName->setText(_theme.getName());
|
||||
}
|
||||
Window::checkEvents();
|
||||
Page::checkEvents();
|
||||
}
|
||||
|
||||
void editColorPage()
|
||||
|
||||
@@ -255,6 +255,7 @@ void TabsGroup::checkEvents()
|
||||
if (currentTab) {
|
||||
currentTab->checkEvents();
|
||||
}
|
||||
ViewMain::instance()->runBackground();
|
||||
|
||||
static uint32_t lastRefresh = 0;
|
||||
uint32_t now = RTOS_GET_MS();
|
||||
|
||||
@@ -116,6 +116,7 @@ void BluetoothTrainerWindow::checkEvents()
|
||||
refresh();
|
||||
lastbtstate = bluetooth.state;
|
||||
devcount = reusableBuffer.moduleSetup.bt.devicesCount;
|
||||
Window::checkEvents();
|
||||
}
|
||||
|
||||
void BluetoothTrainerWindow::refresh()
|
||||
|
||||
@@ -379,3 +379,12 @@ void ViewMain::long_pressed(lv_event_t* e)
|
||||
lv_indev_wait_release(lv_indev_get_act());
|
||||
}
|
||||
}
|
||||
|
||||
void ViewMain::runBackground()
|
||||
{
|
||||
topbar->runBackground();
|
||||
for (int i = 0; i < MAX_CUSTOM_SCREENS; i += 1) {
|
||||
if (customScreens[i])
|
||||
customScreens[i]->runBackground();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ class ViewMain : public NavWindow
|
||||
void onClicked() override;
|
||||
void onCancel() override;
|
||||
|
||||
void runBackground();
|
||||
|
||||
protected:
|
||||
static ViewMain* _instance;
|
||||
|
||||
|
||||
@@ -145,6 +145,15 @@ class WidgetsContainerImpl : public WidgetsContainer
|
||||
void adjustLayout() override {}
|
||||
void updateFromTheme() override {};
|
||||
|
||||
void runBackground() override
|
||||
{
|
||||
for (int i = 0; i < N; i++) {
|
||||
if (widgets[i]) {
|
||||
widgets[i]->background();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
PersistentData* persistentData;
|
||||
Widget* widgets[N] = {};
|
||||
|
||||
@@ -89,6 +89,7 @@ class WidgetsContainer: public Window
|
||||
virtual void adjustLayout() = 0;
|
||||
virtual void updateZones() = 0;
|
||||
virtual void updateFromTheme() = 0;
|
||||
virtual void runBackground() = 0;
|
||||
|
||||
virtual bool isLayout() { return false; }
|
||||
bool isWidgetsContainer() override { return true; }
|
||||
|
||||
Reference in New Issue
Block a user