2020-08-14 07:46:37 +00:00
|
|
|
#include "ApplicationList.h"
|
2020-11-15 15:49:36 +00:00
|
|
|
#include <lvgl/lvgl.h>
|
|
|
|
#include <array>
|
2020-08-14 07:46:37 +00:00
|
|
|
#include "Symbols.h"
|
2020-11-15 15:49:36 +00:00
|
|
|
#include "Tile.h"
|
|
|
|
#include "displayapp/Apps.h"
|
|
|
|
#include "../DisplayApp.h"
|
2020-08-14 07:46:37 +00:00
|
|
|
|
|
|
|
using namespace Pinetime::Applications::Screens;
|
|
|
|
|
2021-02-24 19:40:24 +00:00
|
|
|
ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app,
|
|
|
|
Pinetime::Controllers::Settings &settingsController) :
|
2020-08-14 07:46:37 +00:00
|
|
|
Screen(app),
|
2021-02-24 19:40:24 +00:00
|
|
|
settingsController{settingsController},
|
|
|
|
screens{app,
|
|
|
|
settingsController.GetAppMenu(),
|
|
|
|
{
|
2020-08-14 07:46:37 +00:00
|
|
|
[this]() -> std::unique_ptr<Screen> { return CreateScreen1(); },
|
2020-08-14 18:47:21 +00:00
|
|
|
[this]() -> std::unique_ptr<Screen> { return CreateScreen2(); },
|
2020-08-14 07:46:37 +00:00
|
|
|
//[this]() -> std::unique_ptr<Screen> { return CreateScreen3(); }
|
2021-02-24 19:40:24 +00:00
|
|
|
},
|
|
|
|
Screens::ScreenListModes::UpDown
|
2020-08-14 07:46:37 +00:00
|
|
|
} {}
|
|
|
|
|
|
|
|
|
|
|
|
ApplicationList::~ApplicationList() {
|
|
|
|
lv_obj_clean(lv_scr_act());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::Refresh() {
|
|
|
|
if(running)
|
|
|
|
running = screens.Refresh();
|
|
|
|
return running;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::OnButtonPushed() {
|
|
|
|
running = false;
|
|
|
|
app->StartApp(Apps::Clock);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
|
|
|
return screens.OnTouchEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
|
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
2020-08-14 18:47:21 +00:00
|
|
|
{{Symbols::clock, Apps::Clock},
|
|
|
|
{Symbols::music, Apps::Music},
|
|
|
|
{Symbols::sun, Apps::Brightness},
|
|
|
|
{Symbols::list, Apps::SysInfo},
|
|
|
|
{Symbols::check, Apps::FirmwareValidation},
|
2021-01-10 16:57:26 +00:00
|
|
|
{Symbols::heartBeat, Apps::HeartRate}
|
2020-08-14 07:46:37 +00:00
|
|
|
}
|
2020-08-14 18:47:21 +00:00
|
|
|
|
|
|
|
|
2020-08-14 07:46:37 +00:00
|
|
|
};
|
|
|
|
|
2021-03-22 17:56:26 +00:00
|
|
|
return std::make_unique<Screens::Tile>(0, app, settingsController, applications);
|
2020-08-14 07:46:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
|
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
2021-01-20 20:34:09 +00:00
|
|
|
{{Symbols::map, Apps::Navigation},
|
2021-03-20 21:42:13 +00:00
|
|
|
{Symbols::stopWatch, Apps::StopWatch},
|
2020-08-21 09:55:59 +00:00
|
|
|
{Symbols::paintbrush, Apps::Paint},
|
2021-03-20 21:42:13 +00:00
|
|
|
{Symbols::info, Apps::Notifications},
|
|
|
|
{Symbols::paddle, Apps::Paddle},
|
|
|
|
{"2", Apps::Twos}
|
2020-08-14 07:46:37 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-22 17:56:26 +00:00
|
|
|
return std::make_unique<Screens::Tile>(1, app, settingsController, applications);
|
2020-08-14 07:46:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Screen> ApplicationList::CreateScreen3() {
|
|
|
|
std::array<Screens::Tile::Applications, 6> applications {
|
|
|
|
{{"A", Apps::Meter},
|
2021-02-23 20:18:59 +00:00
|
|
|
{"B", Apps::Navigation},
|
2020-08-14 07:46:37 +00:00
|
|
|
{"C", Apps::Clock},
|
|
|
|
{"D", Apps::Music},
|
|
|
|
{"E", Apps::SysInfo},
|
|
|
|
{"F", Apps::Brightness}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-22 17:56:26 +00:00
|
|
|
return std::make_unique<Screens::Tile>(2, app, settingsController, applications);
|
2020-08-14 07:46:37 +00:00
|
|
|
}
|
2020-12-03 14:31:03 +00:00
|
|
|
|