2021-10-13 22:08:35 +02:00
|
|
|
#include "displayapp/screens/ApplicationList.h"
|
2020-11-15 16:49:36 +01:00
|
|
|
#include <lvgl/lvgl.h>
|
|
|
|
#include <array>
|
2021-10-13 22:08:35 +02:00
|
|
|
#include "displayapp/screens/Symbols.h"
|
|
|
|
#include "displayapp/screens/Tile.h"
|
2020-11-15 16:49:36 +01:00
|
|
|
#include "displayapp/Apps.h"
|
2021-10-13 22:08:35 +02:00
|
|
|
#include "displayapp/DisplayApp.h"
|
2020-08-14 09:46:37 +02:00
|
|
|
|
|
|
|
using namespace Pinetime::Applications::Screens;
|
|
|
|
|
2021-04-18 19:28:14 +02:00
|
|
|
ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app,
|
|
|
|
Pinetime::Controllers::Settings& settingsController,
|
|
|
|
Pinetime::Controllers::Battery& batteryController,
|
|
|
|
Controllers::DateTime& dateTimeController)
|
|
|
|
: Screen(app),
|
|
|
|
settingsController {settingsController},
|
|
|
|
batteryController {batteryController},
|
|
|
|
dateTimeController {dateTimeController},
|
|
|
|
screens {app,
|
|
|
|
settingsController.GetAppMenu(),
|
|
|
|
{
|
|
|
|
[this]() -> std::unique_ptr<Screen> {
|
|
|
|
return CreateScreen1();
|
|
|
|
},
|
|
|
|
[this]() -> std::unique_ptr<Screen> {
|
|
|
|
return CreateScreen2();
|
|
|
|
},
|
|
|
|
//[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
|
|
|
|
},
|
|
|
|
Screens::ScreenListModes::UpDown} {
|
|
|
|
}
|
2020-08-14 09:46:37 +02:00
|
|
|
|
|
|
|
ApplicationList::~ApplicationList() {
|
|
|
|
lv_obj_clean(lv_scr_act());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
|
|
|
return screens.OnTouchEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
|
2021-04-18 19:28:14 +02:00
|
|
|
std::array<Screens::Tile::Applications, 6> applications {{
|
|
|
|
{Symbols::stopWatch, Apps::StopWatch},
|
|
|
|
{Symbols::music, Apps::Music},
|
|
|
|
{Symbols::map, Apps::Navigation},
|
2021-04-26 22:29:48 +02:00
|
|
|
{Symbols::shoe, Apps::Steps},
|
2021-04-18 19:28:14 +02:00
|
|
|
{Symbols::heartBeat, Apps::HeartRate},
|
2021-05-20 20:43:54 +02:00
|
|
|
{Symbols::hourGlass, Apps::Timer},
|
2021-04-18 19:28:14 +02:00
|
|
|
}};
|
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() {
|
2021-04-18 19:28:14 +02:00
|
|
|
std::array<Screens::Tile::Applications, 6> applications {{
|
|
|
|
{Symbols::paintbrush, Apps::Paint},
|
|
|
|
{Symbols::paddle, Apps::Paddle},
|
|
|
|
{"2", Apps::Twos},
|
2021-07-13 15:30:24 +02:00
|
|
|
{Symbols::chartLine, Apps::Motion},
|
2021-07-02 17:34:32 +02:00
|
|
|
{Symbols::drum, Apps::Metronome},
|
2021-09-11 00:40:13 +02:00
|
|
|
{Symbols::clock, Apps::Alarm},
|
2021-04-18 19:28:14 +02:00
|
|
|
}};
|
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);
|
|
|
|
}*/
|