2020-08-14 09:46:37 +02:00
|
|
|
#include "ApplicationList.h"
|
2020-11-15 16:49:36 +01:00
|
|
|
#include <lvgl/lvgl.h>
|
|
|
|
#include <array>
|
2020-08-14 09:46:37 +02:00
|
|
|
#include "Symbols.h"
|
2020-11-15 16:49:36 +01:00
|
|
|
#include "Tile.h"
|
|
|
|
#include "displayapp/Apps.h"
|
|
|
|
#include "../DisplayApp.h"
|
2020-08-14 09:46:37 +02:00
|
|
|
|
|
|
|
using namespace Pinetime::Applications::Screens;
|
|
|
|
|
2021-02-24 20:40:24 +01:00
|
|
|
ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app,
|
2021-04-04 04:08:51 +02:00
|
|
|
Pinetime::Controllers::Settings &settingsController,
|
|
|
|
Pinetime::Controllers::Battery& batteryController,
|
|
|
|
Controllers::DateTime& dateTimeController) :
|
2020-08-14 09:46:37 +02:00
|
|
|
Screen(app),
|
2021-02-24 20:40:24 +01:00
|
|
|
settingsController{settingsController},
|
2021-04-04 04:08:51 +02:00
|
|
|
batteryController{batteryController},
|
|
|
|
dateTimeController{dateTimeController},
|
2021-04-09 21:16:21 +02:00
|
|
|
screens{app,
|
2021-02-24 20:40:24 +01:00
|
|
|
settingsController.GetAppMenu(),
|
|
|
|
{
|
2020-08-14 09:46:37 +02:00
|
|
|
[this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
|
2020-08-14 20:47:21 +02:00
|
|
|
[this]() -> std::unique_ptr<Screen> { return CreateScreen2(); },
|
2020-08-14 09:46:37 +02:00
|
|
|
//[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
|
2021-02-24 20:40:24 +01:00
|
|
|
},
|
|
|
|
Screens::ScreenListModes::UpDown
|
2020-08-14 09:46:37 +02:00
|
|
|
} {}
|
|
|
|
|
|
|
|
|
|
|
|
ApplicationList::~ApplicationList() {
|
|
|
|
lv_obj_clean(lv_scr_act());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::Refresh() {
|
|
|
|
if(running)
|
|
|
|
running = screens.Refresh();
|
|
|
|
return running;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
|
|
|
return screens.OnTouchEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
|
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
2021-04-04 04:08:51 +02:00
|
|
|
{
|
|
|
|
{Symbols::stopWatch, Apps::StopWatch},
|
|
|
|
{Symbols::music, Apps::Music},
|
|
|
|
{Symbols::map, Apps::Navigation},
|
2021-04-09 21:16:21 +02:00
|
|
|
{Symbols::shoe, Apps::Motion},
|
2021-04-04 04:08:51 +02:00
|
|
|
{Symbols::heartBeat, Apps::HeartRate},
|
2021-04-11 18:20:15 +02:00
|
|
|
{"", Apps::None},
|
2020-08-14 09:46:37 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-04-04 04:08:51 +02:00
|
|
|
return std::make_unique<Screens::Tile>(0, 2, app, settingsController, batteryController, dateTimeController, applications);
|
2020-08-14 09:46:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
|
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
2021-04-04 04:08:51 +02:00
|
|
|
{
|
|
|
|
{Symbols::paintbrush, Apps::Paint},
|
|
|
|
{Symbols::paddle, Apps::Paddle},
|
|
|
|
{"2", Apps::Twos},
|
|
|
|
{"", Apps::None},
|
|
|
|
{"", Apps::None},
|
|
|
|
{"", Apps::None},
|
2020-08-14 09:46:37 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-04-04 04:08:51 +02:00
|
|
|
return std::make_unique<Screens::Tile>(1, 2, app, settingsController, batteryController, dateTimeController, applications);
|
2020-08-14 09:46:37 +02:00
|
|
|
}
|
|
|
|
|
2021-04-04 04:08:51 +02:00
|
|
|
/*std::unique_ptr<Screen> ApplicationList::CreateScreen3() {
|
2020-08-14 09:46:37 +02:00
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
|
|
|
{{"A", Apps::Meter},
|
2021-02-23 21:18:59 +01:00
|
|
|
{"B", Apps::Navigation},
|
2020-08-14 09:46:37 +02:00
|
|
|
{"C", Apps::Clock},
|
|
|
|
{"D", Apps::Music},
|
|
|
|
{"E", Apps::SysInfo},
|
|
|
|
{"F", Apps::Brightness}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-04-04 04:08:51 +02:00
|
|
|
return std::make_unique<Screens::Tile>(2, 3, app, settingsController, batteryController, dateTimeController, applications);
|
|
|
|
}*/
|
2020-12-03 15:31:03 +01:00
|
|
|
|