Restore Tile.cpp changes

This commit is contained in:
Riku Isokoski 2021-07-19 10:21:42 +03:00
parent 3e42297bd8
commit dc2b5f0c6b
2 changed files with 6 additions and 4 deletions

View file

@ -12,7 +12,9 @@ namespace {
static void event_handler(lv_obj_t* obj, lv_event_t event) { static void event_handler(lv_obj_t* obj, lv_event_t event) {
Tile* screen = static_cast<Tile*>(obj->user_data); Tile* screen = static_cast<Tile*>(obj->user_data);
screen->OnObjectEvent(obj, event); uint32_t* eventDataPtr = (uint32_t*) lv_event_get_data();
uint32_t eventData = *eventDataPtr;
screen->OnObjectEvent(obj, event, eventData);
} }
} }
@ -123,9 +125,9 @@ bool Tile::Refresh() {
return running; return running;
} }
void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event) { void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId) {
if (event == LV_EVENT_VALUE_CHANGED) { if (event == LV_EVENT_VALUE_CHANGED) {
app->StartApp(apps[lv_btnmatrix_get_active_btn(obj)], DisplayApp::FullRefreshDirections::Up); app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
running = false; running = false;
} }
} }

View file

@ -32,7 +32,7 @@ namespace Pinetime {
bool Refresh() override; bool Refresh() override;
void UpdateScreen(); void UpdateScreen();
void OnObjectEvent(lv_obj_t* obj, lv_event_t event); void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId);
private: private:
Pinetime::Controllers::Battery& batteryController; Pinetime::Controllers::Battery& batteryController;