Add base scaffolding for new Agenda application

This commit is contained in:
Olivier 'reivilibre' 2022-06-15 21:22:04 +01:00
parent 373289c072
commit 72a020127f
6 changed files with 60 additions and 5 deletions

View File

@ -39,7 +39,9 @@ namespace Pinetime {
SettingChimes,
SettingShakeThreshold,
SettingBluetooth,
Error
Error,
// oli: custom
Agenda
};
}
}

View File

@ -30,6 +30,8 @@
#include "displayapp/screens/PassKey.h"
#include "displayapp/screens/Error.h"
#include "displayapp/screens/Agenda.h"
#include "drivers/Cst816s.h"
#include "drivers/St7789.h"
#include "drivers/Watchdog.h"
@ -474,6 +476,10 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
case Apps::Steps:
currentScreen = std::make_unique<Screens::Steps>(this, motionController, settingsController);
break;
case Apps::Agenda:
currentScreen = std::make_unique<Screens::Agenda>(this);
break;
}
currentApp = app;
}

View File

@ -0,0 +1,15 @@
#include "displayapp/screens/Agenda.h"
#include "displayapp/DisplayApp.h"
using namespace Pinetime::Applications::Screens;
Agenda::Agenda(DisplayApp* app) : Screen(app) {
lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(title, "My test application");
lv_label_set_align(title, LV_LABEL_ALIGN_CENTER);
lv_obj_align(title, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
}
Agenda::~Agenda() {
lv_obj_clean(lv_scr_act());
}

View File

@ -0,0 +1,16 @@
#pragma once
#include "displayapp/screens/Screen.h"
#include <lvgl/lvgl.h>
namespace Pinetime {
namespace Applications {
namespace Screens {
class Agenda : public Screen {
public:
Agenda(DisplayApp* app);
~Agenda() override;
};
}
}
}

View File

@ -25,6 +25,9 @@ ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app,
[this]() -> std::unique_ptr<Screen> {
return CreateScreen2();
},
[this]() -> std::unique_ptr<Screen> {
return CreateScreen3();
},
//[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
},
Screens::ScreenListModes::UpDown} {
@ -48,7 +51,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
{Symbols::music, Apps::Music},
}};
return std::make_unique<Screens::Tile>(0, 2, app, settingsController, batteryController, dateTimeController, applications);
return std::make_unique<Screens::Tile>(0, 3, app, settingsController, batteryController, dateTimeController, applications);
}
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
@ -61,7 +64,20 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
{Symbols::map, Apps::Navigation},
}};
return std::make_unique<Screens::Tile>(1, 2, app, settingsController, batteryController, dateTimeController, applications);
return std::make_unique<Screens::Tile>(1, 3, app, settingsController, batteryController, dateTimeController, applications);
}
std::unique_ptr<Screen> ApplicationList::CreateScreen3() {
std::array<Screens::Tile::Applications, 6> applications {{
{"A", Apps::Agenda},
{".", Apps::Paddle},
{".", Apps::Twos},
{".", Apps::Motion},
{".", Apps::Metronome},
{".", Apps::Navigation},
}};
return std::make_unique<Screens::Tile>(2, 3, app, settingsController, batteryController, dateTimeController, applications);
}
/*std::unique_ptr<Screen> ApplicationList::CreateScreen3() {

View File

@ -25,10 +25,10 @@ namespace Pinetime {
Pinetime::Controllers::Battery& batteryController;
Controllers::DateTime& dateTimeController;
ScreenList<2> screens;
ScreenList<3> screens;
std::unique_ptr<Screen> CreateScreen1();
std::unique_ptr<Screen> CreateScreen2();
// std::unique_ptr<Screen> CreateScreen3();
std::unique_ptr<Screen> CreateScreen3();
};
}
}