2020-08-14 03:46:37 -04:00
|
|
|
#include "ApplicationList.h"
|
2020-11-15 10:49:36 -05:00
|
|
|
#include <lvgl/lvgl.h>
|
|
|
|
#include <array>
|
2020-08-14 03:46:37 -04:00
|
|
|
#include "Symbols.h"
|
2020-11-15 10:49:36 -05:00
|
|
|
#include "Tile.h"
|
|
|
|
#include "displayapp/Apps.h"
|
|
|
|
#include "../DisplayApp.h"
|
2020-08-14 03:46:37 -04:00
|
|
|
|
|
|
|
using namespace Pinetime::Applications::Screens;
|
|
|
|
|
2021-04-18 13:28:14 -04: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 03:46:37 -04:00
|
|
|
|
|
|
|
ApplicationList::~ApplicationList() {
|
|
|
|
lv_obj_clean(lv_scr_act());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::Refresh() {
|
2021-04-18 13:28:14 -04:00
|
|
|
if (running)
|
2020-08-14 03:46:37 -04:00
|
|
|
running = screens.Refresh();
|
|
|
|
return running;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
|
|
|
return screens.OnTouchEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
|
2021-04-18 13:28:14 -04:00
|
|
|
std::array<Screens::Tile::Applications, 6> applications {{
|
|
|
|
{Symbols::stopWatch, Apps::StopWatch},
|
|
|
|
{Symbols::music, Apps::Music},
|
|
|
|
{Symbols::map, Apps::Navigation},
|
2021-04-26 16:29:48 -04:00
|
|
|
{Symbols::shoe, Apps::Steps},
|
2021-04-18 13:28:14 -04:00
|
|
|
{Symbols::heartBeat, Apps::HeartRate},
|
|
|
|
{"", Apps::None},
|
|
|
|
}};
|
2020-08-14 03:46:37 -04:00
|
|
|
|
2021-04-03 22:08:51 -04:00
|
|
|
return std::make_unique<Screens::Tile>(0, 2, app, settingsController, batteryController, dateTimeController, applications);
|
2020-08-14 03:46:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
|
2021-04-18 13:28:14 -04:00
|
|
|
std::array<Screens::Tile::Applications, 6> applications {{
|
|
|
|
{Symbols::paintbrush, Apps::Paint},
|
|
|
|
{Symbols::paddle, Apps::Paddle},
|
|
|
|
{"2", Apps::Twos},
|
2021-04-26 16:29:48 -04:00
|
|
|
{"M", Apps::Motion},
|
2021-04-18 13:28:14 -04:00
|
|
|
{"", Apps::None},
|
|
|
|
{"", Apps::None},
|
|
|
|
}};
|
2020-08-14 03:46:37 -04:00
|
|
|
|
2021-04-03 22:08:51 -04:00
|
|
|
return std::make_unique<Screens::Tile>(1, 2, app, settingsController, batteryController, dateTimeController, applications);
|
2020-08-14 03:46:37 -04:00
|
|
|
}
|
|
|
|
|
2021-04-03 22:08:51 -04:00
|
|
|
/*std::unique_ptr<Screen> ApplicationList::CreateScreen3() {
|
2020-08-14 03:46:37 -04:00
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
|
|
|
{{"A", Apps::Meter},
|
2021-02-23 15:18:59 -05:00
|
|
|
{"B", Apps::Navigation},
|
2020-08-14 03:46:37 -04:00
|
|
|
{"C", Apps::Clock},
|
|
|
|
{"D", Apps::Music},
|
|
|
|
{"E", Apps::SysInfo},
|
|
|
|
{"F", Apps::Brightness}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-04-03 22:08:51 -04:00
|
|
|
return std::make_unique<Screens::Tile>(2, 3, app, settingsController, batteryController, dateTimeController, applications);
|
|
|
|
}*/
|