summaryrefslogtreecommitdiff
path: root/src/DisplayApp/Screens/Tile.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-02-23 16:14:03 +0100
committerJF <jf@codingfield.com>2020-02-23 16:14:03 +0100
commitf07ffab4c1fa876e8da9a1bcc895ecf0dfa75acf (patch)
treead7fc589d76988e1977d54926a8f776c4340b846 /src/DisplayApp/Screens/Tile.cpp
parent02772b996fb26146cf38fc6deccff7f43a49dfd6 (diff)
Re-enable BLE, BLE status on display and battery level on display.
Diffstat (limited to 'src/DisplayApp/Screens/Tile.cpp')
-rw-r--r--src/DisplayApp/Screens/Tile.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/DisplayApp/Screens/Tile.cpp b/src/DisplayApp/Screens/Tile.cpp
index c9e33544..6ee677dc 100644
--- a/src/DisplayApp/Screens/Tile.cpp
+++ b/src/DisplayApp/Screens/Tile.cpp
@@ -1,14 +1,8 @@
-#include <cstdio>
-#include <libs/date/includes/date/date.h>
-#include <Components/DateTime/DateTimeController.h>
-#include <Version.h>
#include <libs/lvgl/src/lv_core/lv_obj.h>
#include <libs/lvgl/src/lv_font/lv_font.h>
#include <libs/lvgl/lvgl.h>
-#include <libraries/log/nrf_log.h>
#include "Tile.h"
#include <DisplayApp/DisplayApp.h>
-#include <libs/lvgl/src/lv_core/lv_style.h>
using namespace Pinetime::Applications::Screens;
@@ -17,7 +11,9 @@ extern lv_font_t jetbrains_mono_bold_20;
static void event_handler(lv_obj_t * obj, lv_event_t event) {
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);
}
static const char * btnm_map1[] = {"App1", "App2", "App3", "\n", "App4", "App5", "App11", ""};
@@ -104,19 +100,28 @@ Tile::~Tile() {
lv_obj_clean(lv_scr_act());
}
-bool Tile::Refresh(bool fullRefresh) {
+bool Tile::Refresh() {
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) {
auto* tile = static_cast<Tile*>(obj->user_data);
- if(event == LV_EVENT_CLICKED) {
-
- tile->StartApp();
+ if(event == LV_EVENT_VALUE_CHANGED) {
+ switch(buttonId) {
+ case 0:
+ case 1:
+ case 2:
+ tile->StartClockApp();
+ break;
+ case 3:
+ case 4:
+ case 5:
+ tile->StartTestApp();
+
+ break;
+ }
clickCount++;
}
- else if(event == LV_EVENT_VALUE_CHANGED) {
- }
}
bool Tile::OnButtonPushed() {
@@ -125,7 +130,12 @@ bool Tile::OnButtonPushed() {
return true;
}
-void Tile::StartApp() {
+void Tile::StartClockApp() {
app->StartApp(DisplayApp::Apps::Clock);
running = false;
}
+
+void Tile::StartTestApp() {
+ app->StartApp(DisplayApp::Apps::Test);
+ running = false;
+}